@Override public void updateRouteElement(DocumentRouteElement routeElement, CoreSession session) throws DocumentRouteNotLockedException { if (!isLockedByCurrentUser(routeElement.getDocumentRoute(session), session)) { throw new DocumentRouteNotLockedException(); } routeElement.save(session); }
public String goBackToRoute() throws ClientException { DocumentModel currentDocument = navigationContext.getCurrentDocument(); DocumentRouteElement docRouteElement = currentDocument.getAdapter(DocumentRouteElement.class); return webActions.setCurrentTabAndNavigate( docRouteElement.getDocumentRoute(documentManager).getDocument(), "TAB_DOCUMENT_ROUTE_ELEMENTS"); }
static public void fireEvent(CoreSession coreSession, DocumentRouteElement element, Map<String, Serializable> eventProperties, String eventName, DocumentModel doc) { if (eventProperties == null) { eventProperties = new HashMap<String, Serializable>(); } eventProperties.put(DocumentRoutingConstants.TASK_ROUTE_INSTANCE_DOCUMENT_ID_KEY, element.getDocumentRoute(coreSession).getDocument().getId()); eventProperties.put(DocumentRoutingConstants.DOCUMENT_ELEMENT_EVENT_CONTEXT_KEY, element); eventProperties.put(DocumentEventContext.CATEGORY_PROPERTY_KEY, DocumentEventCategories.EVENT_DOCUMENT_CATEGORY); DocumentEventContext envContext = new DocumentEventContext(coreSession, coreSession.getPrincipal(), doc); envContext.setProperties(eventProperties); getEventProducer().fireEvent(envContext.newEvent(eventName)); }
private DocumentRoute getParentRouteModel(DocumentRef documentRef, CoreSession session) { DocumentModel parentDoc = session.getDocument(documentRef); if (parentDoc.hasFacet(DocumentRoutingConstants.DOCUMENT_ROUTE_DOCUMENT_FACET)) { return parentDoc.getAdapter(DocumentRoute.class); } DocumentRouteElement rElement = parentDoc.getAdapter(DocumentRouteElement.class); return rElement.getDocumentRoute(session); }
if (relatedRouteElement != null) { docWithAttachedRouteId = null; return relatedRouteElement.getDocumentRoute(documentManager);
@Override public void removeRouteElement(DocumentRouteElement routeElement, CoreSession session) throws DocumentRouteNotLockedException { DocumentRoute parentRoute = routeElement.getDocumentRoute(session); if (!isLockedByCurrentUser(parentRoute, session)) { throw new DocumentRouteNotLockedException(); } session.removeDocument(routeElement.getDocument().getRef()); session.save();// the document will be queried later on }
DocumentModel currentDocument = navigationContext.getCurrentDocument(); DocumentRouteElement docRouteElement = currentDocument.getAdapter(DocumentRouteElement.class); DocumentRoute route = docRouteElement.getDocumentRoute(documentManager); if (getDocumentRoutingService().isLockedByCurrentUser(route, documentManager)) { docRouteElement.getDocumentRoute(documentManager).getDocument(), "TAB_DOCUMENT_ROUTE_ELEMENTS");