/** * 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); } }
/** * 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); } }
public void delete(CmisObject cmisObject, String objectId, boolean allVersions) { validateObjectOrId(cmisObject, objectId); validateRedundantIdentifier(cmisObject, objectId); CmisObject target = getCmisObject(cmisObject, objectId); if (target != null) { target.delete(allVersions); } }
object.delete(true); return true; default:
/** * 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)); } }