/** * @return model of Direct Validation workflow. * @throws ClientException */ public DocumentModel getDirectValidationWorkflowModel() throws ClientException { String id = getDocumentRoutingService().getRouteModelDocIdWithId(documentManager, CnsConstants.CNS_VALIDATION_WF); return getRouteModel(id); }
private DocumentModel getOnlineWorkflowModel() throws NuxeoException { String id = getDocumentRoutingService().getRouteModelDocIdWithId(documentManager, ToutaticeGlobalConst.CST_WORKFLOW_PROCESS_ONLINE); return getRouteModel(id); }
@Override protected WorkflowRequest readEntity(JsonNode jn) throws IOException { String workflowModelName = getStringField(jn, "workflowModelName"); List<String> attachedDocumentIds = new ArrayList<String>(); JsonNode attachedDocumentIdsNode = jn.get("attachedDocumentIds"); if (attachedDocumentIdsNode != null) { for (Iterator<JsonNode> it = attachedDocumentIdsNode.elements(); it.hasNext();) { attachedDocumentIds.add(it.next().textValue()); } } Map<String, Serializable> variables = new HashMap<>(); JsonNode variablesNode = jn.get("variables"); if (variablesNode != null) { try (SessionWrapper closeable = ctx.getSession(null)) { CoreSession session = closeable.getSession(); String workflowModelId = documentRoutingService.getRouteModelDocIdWithId(session, workflowModelName); DocumentModel model = session.getDocument(new IdRef(workflowModelId)); String workflowSchemaFacet = (String) model.getPropertyValue(GraphRoute.PROP_VARIABLES_FACET); CompositeType type = schemaManager.getFacet(workflowSchemaFacet); String workflowSchema = type.getSchemaNames()[0]; variables.putAll(getVariables(variablesNode, workflowSchema)); } } return new WorkflowRequest(workflowModelName, attachedDocumentIds, variables); }
@GET @Path("{modelName}/graph") public JsonGraphRoute getWorkflowModelGraph(@PathParam("modelName") String modelName) { try { final String id = Framework.getService(DocumentRoutingService.class).getRouteModelDocIdWithId( getContext().getCoreSession(), modelName); return new JsonGraphRoute(getContext().getCoreSession(), id, getContext().getLocale()); } catch (NuxeoException e) { e.addInfo("Can not get workflow model graph with name: " + modelName); throw e; } }