Java Code Examples for org.activiti.bpmn.model.Activity#getId()
The following examples show how to use
org.activiti.bpmn.model.Activity#getId() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractActivityBpmnParseHandler.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
protected void createMultiInstanceLoopCharacteristics(BpmnParse bpmnParse, Activity modelActivity) { MultiInstanceLoopCharacteristics loopCharacteristics = modelActivity.getLoopCharacteristics(); // Activity Behavior MultiInstanceActivityBehavior miActivityBehavior = null; ActivityImpl activity = bpmnParse.getCurrentScope().findActivity(modelActivity.getId()); if (activity == null) { throw new ActivitiException("Activity " + modelActivity.getId() + " needed for multi instance cannot bv found"); } if (loopCharacteristics.isSequential()) { miActivityBehavior = bpmnParse.getActivityBehaviorFactory().createSequentialMultiInstanceBehavior( activity, (AbstractBpmnActivityBehavior) activity.getActivityBehavior()); } else { miActivityBehavior = bpmnParse.getActivityBehaviorFactory().createParallelMultiInstanceBehavior( activity, (AbstractBpmnActivityBehavior) activity.getActivityBehavior()); } // ActivityImpl settings activity.setScope(true); activity.setProperty("multiInstance", loopCharacteristics.isSequential() ? "sequential" : "parallel"); activity.setActivityBehavior(miActivityBehavior); ExpressionManager expressionManager = bpmnParse.getExpressionManager(); BpmnModel bpmnModel = bpmnParse.getBpmnModel(); // loopcardinality if (StringUtils.isNotEmpty(loopCharacteristics.getLoopCardinality())) { miActivityBehavior.setLoopCardinalityExpression(expressionManager.createExpression(loopCharacteristics.getLoopCardinality())); } // completion condition if (StringUtils.isNotEmpty(loopCharacteristics.getCompletionCondition())) { miActivityBehavior.setCompletionConditionExpression(expressionManager.createExpression(loopCharacteristics.getCompletionCondition())); } // activiti:collection if (StringUtils.isNotEmpty(loopCharacteristics.getInputDataItem())) { if (loopCharacteristics.getInputDataItem().contains("{")) { miActivityBehavior.setCollectionExpression(expressionManager.createExpression(loopCharacteristics.getInputDataItem())); } else { miActivityBehavior.setCollectionVariable(loopCharacteristics.getInputDataItem()); } } // activiti:elementVariable if (StringUtils.isNotEmpty(loopCharacteristics.getElementVariable())) { miActivityBehavior.setCollectionElementVariable(loopCharacteristics.getElementVariable()); } // activiti:elementIndexVariable if (StringUtils.isNotEmpty(loopCharacteristics.getElementIndexVariable())) { miActivityBehavior.setCollectionElementIndexVariable(loopCharacteristics.getElementIndexVariable()); } }
Example 2
Source File: BaseBpmnJsonConverter.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
protected void createDataAssociation(DataAssociation dataAssociation, boolean incoming, Activity activity) { String sourceRef = null; String targetRef = null; if (incoming) { sourceRef = dataAssociation.getSourceRef(); targetRef = activity.getId(); } else { sourceRef = activity.getId(); targetRef = dataAssociation.getTargetRef(); } ObjectNode flowNode = BpmnJsonConverterUtil.createChildShape(dataAssociation.getId(), STENCIL_DATA_ASSOCIATION, 172, 212, 128, 212); ArrayNode dockersArrayNode = objectMapper.createArrayNode(); ObjectNode dockNode = objectMapper.createObjectNode(); dockNode.put(EDITOR_BOUNDS_X, model.getGraphicInfo(sourceRef).getWidth() / 2.0); dockNode.put(EDITOR_BOUNDS_Y, model.getGraphicInfo(sourceRef).getHeight() / 2.0); dockersArrayNode.add(dockNode); if (model.getFlowLocationGraphicInfo(dataAssociation.getId()).size() > 2) { for (int i = 1; i < model.getFlowLocationGraphicInfo(dataAssociation.getId()).size() - 1; i++) { GraphicInfo graphicInfo = model.getFlowLocationGraphicInfo(dataAssociation.getId()).get(i); dockNode = objectMapper.createObjectNode(); dockNode.put(EDITOR_BOUNDS_X, graphicInfo.getX()); dockNode.put(EDITOR_BOUNDS_Y, graphicInfo.getY()); dockersArrayNode.add(dockNode); } } dockNode = objectMapper.createObjectNode(); dockNode.put(EDITOR_BOUNDS_X, model.getGraphicInfo(targetRef).getWidth() / 2.0); dockNode.put(EDITOR_BOUNDS_Y, model.getGraphicInfo(targetRef).getHeight() / 2.0); dockersArrayNode.add(dockNode); flowNode.set("dockers", dockersArrayNode); ArrayNode outgoingArrayNode = objectMapper.createArrayNode(); outgoingArrayNode.add(BpmnJsonConverterUtil.createResourceNode(targetRef)); flowNode.set("outgoing", outgoingArrayNode); flowNode.set("target", BpmnJsonConverterUtil.createResourceNode(targetRef)); ObjectNode propertiesNode = objectMapper.createObjectNode(); propertiesNode.put(PROPERTY_OVERRIDE_ID, dataAssociation.getId()); flowNode.set(EDITOR_SHAPE_PROPERTIES, propertiesNode); shapesArrayNode.add(flowNode); }
Example 3
Source File: FlowElementValidator.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
protected void handleConstraints(Process process, Activity activity, List<ValidationError> errors) { if (activity.getId() != null && activity.getId().length() > ID_MAX_LENGTH) { addError(errors, Problems.FLOW_ELEMENT_ID_TOO_LONG, process, activity, "The id of a flow element must not contain more than " + ID_MAX_LENGTH + " characters"); } }