@Override public void deleteFolder(String path, Session session) throws Exception { // Disable cache session.getDefaultContext().setCacheEnabled(false); if (path.endsWith("/")) path = path.substring(0, path.length()-1); Folder folder = (Folder)FileUtils.getObject(path, session); folder.deleteTree(true, UnfileObject.DELETE, true); // Enable cache session.getDefaultContext().setCacheEnabled(true); }
@Override public void delete(String path, String documentName, Session session) throws Exception { // Disable cache session.getDefaultContext().setCacheEnabled(false); Document document = (Document)FileUtils.getObject(path + "/" + documentName, session); document.delete(); // Enable cache session.getDefaultContext().setCacheEnabled(true); }
@Override public void move(String pathOrigin, String documentNameOrigin, String pathDestination, String documentNameDestination, Session session) throws Exception { // Disable cache session.getDefaultContext().setCacheEnabled(false); // Fetch the object FileableCmisObject fileableCmisObject = (FileableCmisObject) FileUtils.getObject(pathOrigin + documentNameOrigin, session); // ECM folder paths does not end with "/" if (pathOrigin.endsWith("/")) pathOrigin = pathOrigin.substring(0, pathOrigin.length()-1); if (pathDestination.endsWith("/")) pathDestination = pathDestination.substring(0, pathDestination.length()-1); // Fetch source folder CmisObject sourceObject = FileUtils.getObject(pathOrigin, session); // Fetch the destination folder // We need to make sure the target folder exists createFolder(pathDestination); CmisObject targetObject = FileUtils.getObject(pathDestination, session); if (documentNameDestination != documentNameOrigin){ fileableCmisObject.rename(documentNameDestination, true); } // Move the object fileableCmisObject.move(sourceObject, targetObject); // Enable cache session.getDefaultContext().setCacheEnabled(true); }
protected Session getSession(Map<String, String> parameters) { Session repoSession = this.repositorySession; if (parameters == null) { throw new CMISConnectorConnectionException("Repository sessions cannot be obtained through the connector because the connector configuration " + "is missing or incorrectly specified in the mule application configuration file."); } else if (StringUtils.isEmpty(parameters.get(SessionParameter.REPOSITORY_ID))) { // There must have been a problem dynamically obtaining the repository ID. // Try again. String repoID = getRepositoryID(parameters, this.baseURL); if (repoID != null) { parameters.put(SessionParameter.REPOSITORY_ID, repoID); } else { throw new CMISConnectorConnectionException("Repository sessions cannot be obtained through the connector because the repository ID is missing " + "from the connector configuration."); } return null; } if (repoSession == null) { Validate.notNull(parameters); try { repoSession = SessionFactoryImpl.newInstance().createSession(parameters); repoSession.getDefaultContext().setCacheEnabled(false); this.repositorySession = repoSession; } catch (Exception sessionEx) { throw new CMISConnectorConnectionException("An error occurred while attempting to obtain a new repository session - " + sessionEx.getMessage(), sessionEx); } } return repoSession; // End getSession }
@Override public T retrieve(String path, String documentName, Session session) throws Exception { // Disable cache session.getDefaultContext().setCacheEnabled(false); Document object = (Document)FileUtils.getObject(path + documentName, session); ContentStream contentStream = object.getContentStream(); Class<T> classP = getClassP(); T document = classP.newInstance(); document.setContentStream(IOUtils.toByteArray(contentStream.getStream())); document.setContentStreamFilename(documentName); document.setContentStreamLenght(contentStream.getLength()); document.setContentStreamMimeType(contentStream.getMimeType()); // Enable cache session.getDefaultContext().setCacheEnabled(true); return document; }
private Document createDocument(String path, T document, Session session) throws Exception { session.getDefaultContext().setCacheEnabled(false); session.getDefaultContext().setCacheEnabled(true); return doc;
@Override public void run() throws Exception { Session session; SessionParameterMap parameters = new SessionParameterMap(getParameters()); if (!parameters.containsKey(SessionParameter.USER_AGENT)) { parameters.setUserAgent(TCK_USER_AGENT); } String repId = parameters.get(SessionParameter.REPOSITORY_ID); if (repId != null && repId.length() > 0) { session = factory.createSession(parameters); } else { session = factory.getRepositories(parameters).get(0).createSession(); } // switch off the cache session.getDefaultContext().setCacheEnabled(false); try { run(session); } catch (Exception e) { if (!(e instanceof FatalTestException)) { addResult(createResult(UNEXPECTED_EXCEPTION, "Exception: " + e, e, true)); } } catch (Error err) { addResult(createResult(UNEXPECTED_EXCEPTION, "Error: " + err, err, true)); } finally { testFolder = null; } }
context.setCacheEnabled(false); context.setIncludeAcls(false); context.setIncludeAllowableActions(false);
context.setCacheEnabled(false); context.setFilter(properties); context.setIncludeAcls(false);
static { SELECT_ALL_NO_CACHE_OC.setFilterString("*"); SELECT_ALL_NO_CACHE_OC.setCacheEnabled(false); SELECT_ALL_NO_CACHE_OC.setIncludeAllowableActions(true); SELECT_ALL_NO_CACHE_OC.setIncludeAcls(true);