@Override public boolean accept(DocumentModel docModel) { String lifeCycleState = docModel.getCurrentLifeCycleState(); if (excluded != null) { if (excluded.contains(lifeCycleState)) { return false; } } if (accepted != null) { if (!accepted.contains(lifeCycleState)) { return false; } } return true; }
public Object getValue(DocumentModel doc) { return doc.getCurrentLifeCycleState(); } };
public Object getValue(DocumentModel doc) { return doc.getCurrentLifeCycleState(); } };
public String getLifeCycle() { return doc.getCurrentLifeCycleState(); }
public String getLifeCycle() { return doc.getCurrentLifeCycleState(); }
@Override public Boolean isCancelled() { return TaskConstants.TASK_CANCELLED_LIFE_CYCLE_STATE.equals(doc.getCurrentLifeCycleState()); }
@Override public Boolean hasEnded() { return TaskConstants.TASK_ENDED_LIFE_CYCLE_STATE.equals(doc.getCurrentLifeCycleState()); }
@Override public Boolean isOpened() { return TaskConstants.TASK_OPENED_LIFE_CYCLE_STATE.equals(doc.getCurrentLifeCycleState()); }
@Override public boolean accept(DocumentModel docModel) { boolean notTrashed = !StringUtils.equals(LifeCycleConstants.DELETED_STATE, docModel.getCurrentLifeCycleState()); return !docModel.isVersion() && notTrashed; } };
@Override public State getState() { if (localState != null) { return localState; } String s = document.getCurrentLifeCycleState(); return State.fromString(s); }
protected boolean checkLifeCycleState(ElementLifeCycleState state) { return document.getCurrentLifeCycleState().equalsIgnoreCase(state.name()); }
@Override public boolean accept(DocumentModel docModel) { boolean status = false; try { status = !docModel.isImmutable() && !LifeCycleConstants.DELETED_STATE.equals(docModel.getCurrentLifeCycleState()); } catch (ClientException e) { log.error("Failed to evaluate children, error: " + e.getMessage()); } return status; }
protected void readLifeCycleInfo(Element element, DocumentModel doc) { String lifeCycleState = doc.getCurrentLifeCycleState(); if (lifeCycleState != null && lifeCycleState.length() > 0) { element.addElement(ExportConstants.LIFECYCLE_STATE_TAG).addText(lifeCycleState); } String lifeCyclePolicy = doc.getLifeCyclePolicy(); if (lifeCyclePolicy != null && lifeCyclePolicy.length() > 0) { element.addElement(ExportConstants.LIFECYCLE_POLICY_TAG).addText(lifeCyclePolicy); } }
@Override public void setState(State state) { if (state == null) { throw new NullPointerException("null state"); } String lc = state.getLifeCycleState(); if (lc == null) { localState = state; } else { localState = null; String oldLc = document.getCurrentLifeCycleState(); if (lc.equals(oldLc)) { return; } document.followTransition(state.getTransition()); saveDocument(); } }
@Override public void run() { DocumentRef idRef = new IdRef(uuid); // Check if the id matches an existing document if (!session.exists(idRef)) { throw new UserRegistrationException("There is no existing registration request with id " + uuid); } // Check if the request has not been already validated DocumentModel registrationDoc = session.getDocument(idRef); if (registrationDoc.getCurrentLifeCycleState().equals("accepted")) { throw new AlreadyProcessedRegistrationException("Registration request has already been processed"); } } }
protected void notifyEvent(CoreSession coreSession, DocumentModel document, NuxeoPrincipal principal, String eventId, Map<String, Serializable> properties) { if (properties == null) { properties = new HashMap<>(); } EventContext eventContext; if (document != null) { properties.put(CoreEventConstants.REPOSITORY_NAME, document.getRepositoryName()); properties.put(CoreEventConstants.SESSION_ID, coreSession.getSessionId()); properties.put(CoreEventConstants.DOC_LIFE_CYCLE, document.getCurrentLifeCycleState()); eventContext = new DocumentEventContext(coreSession, principal, document); } else { eventContext = new EventContextImpl(coreSession, principal); } eventContext.setProperties(properties); Event event = eventContext.newEvent(eventId); Framework.getService(EventProducer.class).fireEvent(event); }
/** * @since 10.3 */ protected void notifyPublishedEvent(DocumentModel doc) { Map<String, Serializable> properties = new HashMap<>(); properties.put(CoreEventConstants.REPOSITORY_NAME, doc.getRepositoryName()); properties.put(CoreEventConstants.SESSION_ID, session.getSessionId()); properties.put(CoreEventConstants.DOC_LIFE_CYCLE, doc.getCurrentLifeCycleState()); DocumentEventContext ctx = new DocumentEventContext(session, session.getPrincipal(), doc); ctx.setProperties(properties); ctx.setCategory(DocumentEventCategories.EVENT_DOCUMENT_CATEGORY); Event event = ctx.newEvent(DocumentEventTypes.DOCUMENT_PUBLISHED); Framework.getService(EventProducer.class).fireEvent(event); }
protected void notifyEvent(String eventId, Map<String, Serializable> properties, String comment, String category, DocumentModel dm, CoreSession coreSession) { // Default category if (category == null) { category = DocumentEventCategories.EVENT_DOCUMENT_CATEGORY; } if (properties == null) { properties = new HashMap<String, Serializable>(); } properties.put(CoreEventConstants.REPOSITORY_NAME, dm.getRepositoryName()); properties.put(CoreEventConstants.SESSION_ID, coreSession.getSessionId()); properties.put(CoreEventConstants.DOC_LIFE_CYCLE, dm.getCurrentLifeCycleState()); DocumentEventContext ctx = new DocumentEventContext(coreSession, coreSession.getPrincipal(), dm); ctx.setProperties(properties); ctx.setComment(comment); ctx.setCategory(category); Event event = ctx.newEvent(eventId); getEventProducer().fireEvent(event); }
public NodeView(GraphNode node, Locale locale) { this.x = Integer.parseInt((String) node.getDocument().getPropertyValue(GraphNode.PROP_NODE_X_COORDINATE)); this.y = Integer.parseInt((String) node.getDocument().getPropertyValue(GraphNode.PROP_NODE_Y_COORDINATE)); this.isStartNode = node.isStart(); this.isEndNode = node.isStop(); this.id = node.getId(); String titleProp = (String) node.getDocument().getPropertyValue(GraphNode.PROP_TITLE); this.title = JsonGraphRoute.getI18nLabel(titleProp, locale); this.state = node.getDocument().getCurrentLifeCycleState(); this.isMerge = node.isMerge(); this.isMultiTask = node.hasMultipleTasks(); this.hasSubWorkflow = node.hasSubRoute(); }
public ShallowDocumentModel(DocumentModel doc) { id = doc.getId(); repoName = doc.getRepositoryName(); name = doc.getName(); path = doc.getPath(); type = doc.getType(); isFolder = doc.isFolder(); isVersion = doc.isVersion(); isProxy = doc.isProxy(); isImmutable = doc.isImmutable(); contextData = new HashMap<>(doc.getContextData()); facets = doc.getFacets(); if (doc.isLifeCycleLoaded()) { lifecycleState = doc.getCurrentLifeCycleState(); } else { lifecycleState = null; } }