@Override public void validate(BpmnModel bpmnModel, List<ValidationError> errors) { for (Process process : bpmnModel.getProcesses()) { executeValidation(bpmnModel, process, errors); } }
protected static List<FlowNode> gatherAllFlowNodes(BpmnModel bpmnModel) { List<FlowNode> flowNodes = new ArrayList<FlowNode>(); for (Process process : bpmnModel.getProcesses()) { flowNodes.addAll(gatherAllFlowNodes(process)); } return flowNodes; }
protected static List<Artifact> gatherAllArtifacts(BpmnModel bpmnModel) { List<Artifact> artifacts = new ArrayList<Artifact>(); for (Process process : bpmnModel.getProcesses()) { artifacts.addAll(process.getArtifacts()); } return artifacts; }
/** * Parses the 'definitions' root element */ protected void applyParseHandlers() { sequenceFlows = new HashMap<String, SequenceFlow>(); for (Process process : bpmnModel.getProcesses()) { currentProcess = process; if (process.isExecutable()) { bpmnParserHandlers.parseElement(this, process); } } }
public void execute() { // Reset any previous DI information bpmnModel.getLocationMap().clear(); bpmnModel.getFlowLocationMap().clear(); // Generate DI for each process for (Process process : bpmnModel.getProcesses()) { layout(process); // Operations that can only be done after all elements have received // DI translateNestedSubprocesses(process); } }
/** * Returns 'true' if at least one process definition in the {@link BpmnModel} is executable. */ protected boolean validateAtLeastOneExecutable(BpmnModel bpmnModel, List<ValidationError> errors) { int nrOfExecutableDefinitions = 0; for (Process process : bpmnModel.getProcesses()) { if (process.isExecutable()) { nrOfExecutableDefinitions++; } } if (nrOfExecutableDefinitions == 0) { addError(errors, Problems.ALL_PROCESS_DEFINITIONS_NOT_EXECUTABLE, "All process definition are set to be non-executable (property 'isExecutable' on process). This is not allowed."); } return nrOfExecutableDefinitions > 0; }
public Process parse(XMLStreamReader xtr, BpmnModel model) throws Exception { Process process = null; if (StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_ID))) { String processId = xtr.getAttributeValue(null, ATTRIBUTE_ID); process = new Process(); process.setId(processId); BpmnXMLUtil.addXMLLocation(process, xtr); process.setName(xtr.getAttributeValue(null, ATTRIBUTE_NAME)); if (StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_PROCESS_EXECUTABLE))) { process.setExecutable(Boolean.parseBoolean(xtr.getAttributeValue(null, ATTRIBUTE_PROCESS_EXECUTABLE))); } String candidateUsersString = xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_PROCESS_CANDIDATE_USERS); if (StringUtils.isNotEmpty(candidateUsersString)) { List<String> candidateUsers = BpmnXMLUtil.parseDelimitedList(candidateUsersString); process.setCandidateStarterUsers(candidateUsers); } String candidateGroupsString = xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_PROCESS_CANDIDATE_GROUPS); if (StringUtils.isNotEmpty(candidateGroupsString)) { List<String> candidateGroups = BpmnXMLUtil.parseDelimitedList(candidateGroupsString); process.setCandidateStarterGroups(candidateGroups); } BpmnXMLUtil.addCustomAttributes(xtr, process, ProcessExport.defaultProcessAttributes); model.getProcesses().add(process); } return process; } }
SignalAndMessageDefinitionExport.writeSignalsAndMessages(model, xtw); for (Process process : model.getProcesses()) {
for (Process process : model.getProcesses()) { for (Pool pool : model.getPools()) { if (process.getId().equals(pool.getProcessRef())) {
public void parse(XMLStreamReader xtr, BpmnModel model) throws Exception { String resourceId = xtr.getAttributeValue(null, ATTRIBUTE_ID); String resourceName = xtr.getAttributeValue(null, ATTRIBUTE_NAME); Resource resource; if (model.containsResourceId(resourceId)) { resource = model.getResource(resourceId); resource.setName(resourceName); for (org.activiti.bpmn.model.Process process : model.getProcesses()) { for (FlowElement fe : process.getFlowElements()) { if (fe instanceof UserTask && ((UserTask) fe).getCandidateGroups().contains(resourceId)) { ((UserTask) fe).getCandidateGroups().remove(resourceId); ((UserTask) fe).getCandidateGroups().add(resourceName); } } } } else { resource = new Resource(resourceId, resourceName); model.addResource(resource); } BpmnXMLUtil.addXMLLocation(resource, xtr); } }
@Override public void validate(BpmnModel bpmnModel, List<ValidationError> errors) { // Global associations Collection<Artifact> artifacts = bpmnModel.getGlobalArtifacts(); if (artifacts != null) { for (Artifact artifact : artifacts) { if (artifact instanceof Association) { validate(null, (Association) artifact, errors); } } } // Process associations for (Process process : bpmnModel.getProcesses()) { artifacts = process.getArtifacts(); for (Artifact artifact : artifacts) { if (artifact instanceof Association) { validate(process, (Association) artifact, errors); } } } }
SignalAndMessageDefinitionExport.writeSignalsAndMessages(model, xtw); for (Process process : model.getProcesses()) {
@Override public void validate(BpmnModel bpmnModel, List<ValidationError> errors) { // If all process definitions of this bpmnModel are not executable, raise an error boolean isAtLeastOneExecutable = validateAtLeastOneExecutable(bpmnModel, errors); // If at least one process definition is executable, show a warning for each of the none-executables if (isAtLeastOneExecutable) { for (Process process : bpmnModel.getProcesses()) { if (!process.isExecutable()) { addWarning(errors, Problems.PROCESS_DEFINITION_NOT_EXECUTABLE, process, process, "Process definition is not executable. Please verify that this is intentional."); } handleProcessConstraints(bpmnModel, process, errors); } } handleBPMNModelConstraints(bpmnModel, errors); }
public static void writeSignalsAndMessages(BpmnModel model, XMLStreamWriter xtw) throws Exception { for (Process process : model.getProcesses()) { for (FlowElement flowElement : process.findFlowElementsOfType(Event.class)) { Event event = (Event) flowElement;
for (Process process : bpmnModel.getProcesses()) { if (!process.isExecutable()) { continue;
bpmnModel.getProcesses().add(process); process.setId(BpmnJsonConverterUtil.getPropertyValueAsString(PROPERTY_PROCESS_ID, modelNode)); modelNode, this, bpmnModel.getProcesses().get(0), shapeMap, bpmnModel); for (Process process : bpmnModel.getProcesses()) { for (FlowElement flowElement : process.findFlowElementsOfType(SubProcess.class)) { SubProcess subProcess = (SubProcess) flowElement; List<Gateway> gatewayWithOrderList = new ArrayList<Gateway>(); for (Process process : bpmnModel.getProcesses()) { postProcessElements(process, process.getFlowElements(),
for (Process process : model.getProcesses()) { processDataStoreReferences(process, baseElement.getId(),
for (Process process : bpmnModel.getProcesses()) { for (Lane lane : process.getLanes()) { GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(lane.getId()); for (Process process : bpmnModel.getProcesses()) { for (FlowNode flowNode : process.findFlowElementsOfType(FlowNode.class)) { drawActivity(processDiagramCanvas, for (Process process : bpmnModel.getProcesses()) {
/** * 校验资源文件是否存在 * * @param type xml image 类型 * @param modelId 模型id * @return * @throws IOException */ @RequestMapping(value = "/model/exist/{type}/{modelId}", method = RequestMethod.POST) @ResponseBody public Result resourceExist(@PathVariable("type") String type, @PathVariable("modelId") String modelId) throws IOException { Model modelData = repositoryService.getModel(modelId); if (type.equals("xml")) { BpmnJsonConverter jsonConverter = new BpmnJsonConverter(); JsonNode editorNode = objectMapper.readTree(repositoryService.getModelEditorSource(modelData.getId())); BpmnModel bpmnModel = jsonConverter.convertToBpmnModel(editorNode); return new Result(!bpmnModel.getProcesses().isEmpty()); } else { byte[] pngBytes = repositoryService.getModelEditorSourceExtra(modelData.getId()); return new Result(pngBytes.length > 0); } }
for (Process process : bpmnModel.getProcesses()) { for (Lane l : process.getLanes()) {