public List<Folder> getParentFolders(CmisObject cmisObject, String objectId) { validateObjectOrId(cmisObject, objectId); validateRedundantIdentifier(cmisObject, objectId); CmisObject target = getCmisObject(cmisObject, objectId); if (target != null && target instanceof FileableCmisObject) { return ((FileableCmisObject) target).getParents(); } else { logger.error("Unable to obtain the object reference, so no parent references could be obtained."); } return Collections.emptyList(); // End getParentFolders }
@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); }
if (fileableCmisObject instanceof Document) { ((Document)fileableCmisObject).delete(true); log.info("'{}' document deleted!", fileableCmisObject.getName()); return; } else if (fileableCmisObject instanceof Folder) {
if (isExistCmisObject(((FileableCmisObject) object).getParents().get(0).getPath() + "/" + after)) { CmisObject source = object.getParents().get(0); CmisObject destination = session.getObject(delta.getParentChanges().getNewPrimaryParent()); object.move(source, destination); String name = object.getName(); if (name.endsWith("-temp")) { rename(object, name.replace("-temp", ""));
FileableCmisObject fileableChild = (FileableCmisObject) child; Set<Action> actions = fileableChild.getAllowableActions().getAllowableActions(); boolean hasObjectParentsAction = actions.contains(Action.CAN_GET_OBJECT_PARENTS); boolean hasFolderParentAction = actions.contains(Action.CAN_GET_FOLDER_PARENT); List<Folder> parents = fileableChild.getParents(); List<String> paths = ((FileableCmisObject) child).getPaths();
f = createResult(FAILURE, inWhat + " query returned an object that should not be there!"); addResult(assertIsTrue( topLevelDocs.contains(object.getId()) || topLevelFolders.contains(object.getId()), null, f)); for (Folder parent : object.getParents()) { if (testFolder.getId().equals(parent.getId())) { found = true;
public FileableCmisObject moveObject(FileableCmisObject cmisObject, String objectId, String sourceFolderId, String targetFolderId) { validateObjectOrId(cmisObject, objectId); validateRedundantIdentifier(cmisObject, objectId); Validate.notEmpty(sourceFolderId, "sourceFolderId is empty"); Validate.notEmpty(targetFolderId, "targetFolderId is empty"); FileableCmisObject target = getCmisObject(cmisObject, objectId, FileableCmisObject.class); if (target != null) { return target.move(new ObjectIdImpl(sourceFolderId), new ObjectIdImpl(targetFolderId)); } else { logger.error("Unable to obtain the object reference in order to perform the object move."); } return null; }
List<String> objectPaths = ((FileableCmisObject)object).getPaths(); if (objectPaths != null) { for (String objectPath : objectPaths) {
List<String> paths = ((FileableCmisObject) object).getPaths(); if (object instanceof Folder) { f = createResult(FAILURE, "Folder does not have excatly one path! This is an OpenCMIS bug!");