public List<String> deleteTree(@Nullable CmisObject folder, @Nullable String folderId, UnfileObject unfile, boolean allversions, boolean continueOnFailure) { validateObjectOrId(folder, folderId); validateRedundantIdentifier(folder, folderId); CmisObject target = getCmisObject(folder, folderId); if (target != null && target instanceof Folder) { return ((Folder) target).deleteTree(allversions, unfile, continueOnFailure); } return Collections.emptyList(); }
/** * Deletes an object by path or id (string identifier). * * @param pathOrIdOfObject * the id or path of the object * @param session * the session * * @throws CmisBaseException * if something go wrong, for example the object doesn't exist */ public static void delete(String pathOrIdOfObject, Session session) { CmisObject object = getObject(pathOrIdOfObject, session); if (object instanceof Folder) { ((Folder) object).deleteTree(true, UnfileObject.DELETE, true); } else { object.delete(true); } }
@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); }
/** * Deletes an object by path or id (string identifier). * * @param pathOrIdOfObject * the id or path of the object * @param session * the session * * @throws CmisBaseException * if something go wrong, for example the object doesn't exist */ public static void delete(String pathOrIdOfObject, Session session) { CmisObject object = getObject(pathOrIdOfObject, session); if (object instanceof Folder) { ((Folder) object).deleteTree(true, UnfileObject.DELETE, true); } else { object.delete(true); } }
folder.deleteTree(true, null, true);
List<String> failedIds = testFolder.deleteTree(true, UnfileObject.DELETE, true);
/** * Deletes an object and checks if it is deleted. */ protected void deleteObject(CmisObject object) { if (object != null) { if (object instanceof Folder) { try { ((Folder) object).deleteTree(true, null, true); } catch (CmisBaseException e) { addResult(createResult(UNEXPECTED_EXCEPTION, "Folder could not be deleted! Exception: " + e.getMessage(), e, true)); } } else { try { object.delete(true); } catch (CmisBaseException e) { addResult(createResult(UNEXPECTED_EXCEPTION, "Object could not be deleted! Exception: " + e.getMessage(), e, true)); } } CmisTestResult f = createResult(FAILURE, "Object should not exist anymore but it is still there! ID: " + object.getId(), true); addResult(assertIsFalse(exists(object), null, f)); } }