DocumentRef docRef = getDocumentRef(target);
CoreSession session = ctx.getCoreSession();
if (session.getAllowedStateTransitions(docRef).contains(
DELETE_TRANSITION)) {
session.followTransition(docRef, DELETE_TRANSITION);
} else {
session.removeDocument(docRef);
}
// Must save session to ensure that currentLifeCycleState is updated