java - How to Delete Document Using CMIS -
i have created external web application using servlets connected alfresco repository.
i able upload document in repository, download document repository.
now requirement is, have delete document based on user role. means want give delete document access site manager.
please provide sample code if have.
thanks in advance
in order delete document first need see if user have role delete why answer split in 2 part
part 1 : search authority
in part see if user have authority delete
session session = getsession(serverurl, username, password); // session object = session.getobjectbypath(idobject); // object if (object.getallowableactions().getallowableactions().contains(action.can_delete_object)) { //// can delete } else { //// can't delete system.out.println("i can't "); }
part 2 : delete method
for document simple delete
session session = getsession(serverurl, username, password); cmisobject object = session.getobject(path); document suppdoc = (document) object; suppdoc.delete(true);
note it's different folder , part 2 changed ( because when delete folder need delete child's)
to complete answer need combine part 1 part 2.
Comments
Post a Comment