org.activiti.bpmn.model.CallActivity Java Examples

The following examples show how to use org.activiti.bpmn.model.CallActivity. 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: CallActivityConverterTest.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
private void validateModel(BpmnModel model) {
  FlowElement flowElement = model.getMainProcess().getFlowElement("callactivity", true);
  assertNotNull(flowElement);
  assertTrue(flowElement instanceof CallActivity);
  CallActivity callActivity = (CallActivity) flowElement;
  assertEquals("callactivity", callActivity.getId());
  assertEquals("Call activity", callActivity.getName());

  assertEquals("processId", callActivity.getCalledElement());

  List<IOParameter> parameters = callActivity.getInParameters();
  assertEquals(2, parameters.size());
  IOParameter parameter = parameters.get(0);
  assertEquals("test", parameter.getSource());
  assertEquals("test", parameter.getTarget());
  parameter = parameters.get(1);
  assertEquals("${test}", parameter.getSourceExpression());
  assertEquals("test", parameter.getTarget());

  parameters = callActivity.getOutParameters();
  assertEquals(1, parameters.size());
  parameter = parameters.get(0);
  assertEquals("test", parameter.getSource());
  assertEquals("test", parameter.getTarget());
}
 
Example #2
Source File: CallActivityConverterTest.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
private void validateModel(BpmnModel model) {
  FlowElement flowElement = model.getMainProcess().getFlowElement("callactivity");
  assertNotNull(flowElement);
  assertTrue(flowElement instanceof CallActivity);
  CallActivity callActivity = (CallActivity) flowElement;
  assertEquals("callactivity", callActivity.getId());
  assertEquals("Call activity", callActivity.getName());

  assertEquals("processId", callActivity.getCalledElement());

  List<IOParameter> parameters = callActivity.getInParameters();
  assertEquals(2, parameters.size());
  IOParameter parameter = parameters.get(0);
  assertEquals("test", parameter.getSource());
  assertEquals("test", parameter.getTarget());
  parameter = parameters.get(1);
  assertEquals("${test}", parameter.getSourceExpression());
  assertEquals("test", parameter.getTarget());

  parameters = callActivity.getOutParameters();
  assertEquals(1, parameters.size());
  parameter = parameters.get(0);
  assertEquals("test", parameter.getSource());
  assertEquals("test", parameter.getTarget());
}
 
Example #3
Source File: CallActivityXMLConverter.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
public void parseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model) throws Exception {
  String source = xtr.getAttributeValue(null, ATTRIBUTE_IOPARAMETER_SOURCE);
  String sourceExpression = xtr.getAttributeValue(null, ATTRIBUTE_IOPARAMETER_SOURCE_EXPRESSION);
  String target = xtr.getAttributeValue(null, ATTRIBUTE_IOPARAMETER_TARGET);
  if ((StringUtils.isNotEmpty(source) || StringUtils.isNotEmpty(sourceExpression)) && StringUtils.isNotEmpty(target)) {

    IOParameter parameter = new IOParameter();
    if (StringUtils.isNotEmpty(sourceExpression)) {
      parameter.setSourceExpression(sourceExpression);
    } else {
      parameter.setSource(source);
    }

    parameter.setTarget(target);

    ((CallActivity) parentElement).getOutParameters().add(parameter);
  }
}
 
Example #4
Source File: CallActivityXMLConverter.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
public void parseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model) throws Exception {
  String source = xtr.getAttributeValue(null, ATTRIBUTE_IOPARAMETER_SOURCE);
  String sourceExpression = xtr.getAttributeValue(null, ATTRIBUTE_IOPARAMETER_SOURCE_EXPRESSION);
  String target = xtr.getAttributeValue(null, ATTRIBUTE_IOPARAMETER_TARGET);
  if ((StringUtils.isNotEmpty(source) || StringUtils.isNotEmpty(sourceExpression)) && StringUtils.isNotEmpty(target)) {

    IOParameter parameter = new IOParameter();
    if (StringUtils.isNotEmpty(sourceExpression)) {
      parameter.setSourceExpression(sourceExpression);
    } else {
      parameter.setSource(source);
    }

    parameter.setTarget(target);

    ((CallActivity) parentElement).getInParameters().add(parameter);
  }
}
 
Example #5
Source File: CallActivityParseHandler.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected void executeParse(BpmnParse bpmnParse, CallActivity callActivity) {
  
  ActivityImpl activity = createActivityOnCurrentScope(bpmnParse, callActivity, BpmnXMLConstants.ELEMENT_CALL_ACTIVITY);
  activity.setScope(true);
  activity.setAsync(callActivity.isAsynchronous());
  activity.setExclusive(!callActivity.isNotExclusive());
  activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createCallActivityBehavior(callActivity));
}
 
Example #6
Source File: AlfrescoCallActivityBpmnParseHandler.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected void executeParse(BpmnParse bpmnParse, CallActivity callActivity)
{
    if (multiTenancyEnabled && tenantService.isEnabled())
    {
        ActivityImpl activity = findActivity(bpmnParse, callActivity.getId());
        ActivityBehavior activityBehavior = activity.getActivityBehavior();
        if(activityBehavior instanceof CallActivityBehavior)
        {
            CallActivityBehavior callActivityBehavior = (CallActivityBehavior) activityBehavior;
            
            // Make name of process-definition to be called aware of the current tenant
            callActivityBehavior.setProcessDefinitonKey(tenantService.getName(callActivityBehavior.getProcessDefinitonKey()));
        }
    }
}
 
Example #7
Source File: CallActivityJsonConverter.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected void convertElementToJson(ObjectNode propertiesNode, BaseElement baseElement) {
  CallActivity callActivity = (CallActivity) baseElement;
  if (StringUtils.isNotEmpty(callActivity.getCalledElement())) {
    propertiesNode.put(PROPERTY_CALLACTIVITY_CALLEDELEMENT, callActivity.getCalledElement());
  }

  addJsonParameters(PROPERTY_CALLACTIVITY_IN, "inParameters", callActivity.getInParameters(), propertiesNode);
  addJsonParameters(PROPERTY_CALLACTIVITY_OUT, "outParameters", callActivity.getOutParameters(), propertiesNode);
}
 
Example #8
Source File: CallActivityJsonConverter.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected FlowElement convertJsonToElement(JsonNode elementNode, JsonNode modelNode, Map<String, JsonNode> shapeMap) {
  CallActivity callActivity = new CallActivity();
  if (StringUtils.isNotEmpty(getPropertyValueAsString(PROPERTY_CALLACTIVITY_CALLEDELEMENT, elementNode))) {
    callActivity.setCalledElement(getPropertyValueAsString(PROPERTY_CALLACTIVITY_CALLEDELEMENT, elementNode));
  }

  callActivity.getInParameters().addAll(convertToIOParameters(PROPERTY_CALLACTIVITY_IN, "inParameters", elementNode));
  callActivity.getOutParameters().addAll(convertToIOParameters(PROPERTY_CALLACTIVITY_OUT, "outParameters", elementNode));

  return callActivity;
}
 
Example #9
Source File: BoundaryEventActivityBehavior.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected void deleteChildExecutions(ExecutionEntity parentExecution, ExecutionEntity notToDeleteExecution, CommandContext commandContext) {

    // TODO: would be good if this deleteChildExecutions could be removed and the one on the executionEntityManager is used
    // The problem however, is that the 'notToDeleteExecution' is passed here.
    // This could be solved by not reusing an execution, but creating a new

    // Delete all child executions
    ExecutionEntityManager executionEntityManager = commandContext.getExecutionEntityManager();
    Collection<ExecutionEntity> childExecutions = executionEntityManager.findChildExecutionsByParentExecutionId(parentExecution.getId());
    if (CollectionUtil.isNotEmpty(childExecutions)) {
      for (ExecutionEntity childExecution : childExecutions) {
        if (childExecution.getId().equals(notToDeleteExecution.getId()) == false) {
          deleteChildExecutions(childExecution, notToDeleteExecution, commandContext);
        }
      }
    }

    String deleteReason = DeleteReason.BOUNDARY_EVENT_INTERRUPTING + " (" + notToDeleteExecution.getCurrentActivityId() + ")";
    if (parentExecution.getCurrentFlowElement() instanceof CallActivity) {
      ExecutionEntity subProcessExecution = executionEntityManager.findSubProcessInstanceBySuperExecutionId(parentExecution.getId());
      if (subProcessExecution != null) {
        executionEntityManager.deleteProcessInstanceExecutionEntity(subProcessExecution.getId(),
            subProcessExecution.getCurrentActivityId(), deleteReason, true, true);
      }
    }

    executionEntityManager.deleteExecutionAndRelatedData(parentExecution, deleteReason, false);
  }
 
Example #10
Source File: CallActivityXMLConverter.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@Override
protected BaseElement convertXMLToElement(XMLStreamReader xtr, BpmnModel model) throws Exception {
  CallActivity callActivity = new CallActivity();
  BpmnXMLUtil.addXMLLocation(callActivity, xtr);
  callActivity.setCalledElement(xtr.getAttributeValue(null, ATTRIBUTE_CALL_ACTIVITY_CALLEDELEMENT));
  callActivity.setBusinessKey(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_CALL_ACTIVITY_BUSINESS_KEY));
  callActivity.setInheritBusinessKey(Boolean.parseBoolean(xtr.getAttributeValue(
      ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_CALL_ACTIVITY_INHERIT_BUSINESS_KEY)));
  callActivity.setInheritVariables(Boolean.valueOf(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_CALL_ACTIVITY_INHERITVARIABLES)));
  parseChildElements(getXMLElementName(), callActivity, childParserMap, model, xtr);
  return callActivity;
}
 
Example #11
Source File: CallActivityXMLConverter.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@Override
protected void writeAdditionalAttributes(BaseElement element, BpmnModel model, XMLStreamWriter xtw) throws Exception {
  CallActivity callActivity = (CallActivity) element;
  if (StringUtils.isNotEmpty(callActivity.getCalledElement())) {
    xtw.writeAttribute(ATTRIBUTE_CALL_ACTIVITY_CALLEDELEMENT, callActivity.getCalledElement());
  }
  if (StringUtils.isNotEmpty(callActivity.getBusinessKey())) {
    writeQualifiedAttribute(ATTRIBUTE_CALL_ACTIVITY_BUSINESS_KEY, callActivity.getBusinessKey(), xtw);
  }
  if (callActivity.isInheritBusinessKey()) {
    writeQualifiedAttribute(ATTRIBUTE_CALL_ACTIVITY_INHERIT_BUSINESS_KEY, "true", xtw);
  }
  xtw.writeAttribute(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_CALL_ACTIVITY_INHERITVARIABLES, String.valueOf(callActivity.isInheritVariables()));
}
 
Example #12
Source File: CallActivityXMLConverter.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@Override
protected boolean writeExtensionChildElements(BaseElement element, boolean didWriteExtensionStartElement, XMLStreamWriter xtw) throws Exception {
  CallActivity callActivity = (CallActivity) element;
  didWriteExtensionStartElement = writeIOParameters(ELEMENT_CALL_ACTIVITY_IN_PARAMETERS, 
      callActivity.getInParameters(), didWriteExtensionStartElement, xtw);
  didWriteExtensionStartElement = writeIOParameters(ELEMENT_CALL_ACTIVITY_OUT_PARAMETERS, 
      callActivity.getOutParameters(), didWriteExtensionStartElement, xtw);
  return didWriteExtensionStartElement;
}
 
Example #13
Source File: TestActivityBehaviorFactory.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
@Override
public CallActivityBehavior createCallActivityBehavior(CallActivity callActivity) {
  return wrappedActivityBehaviorFactory.createCallActivityBehavior(callActivity);
}
 
Example #14
Source File: ActivityBehaviorFactoryDelegate.java    From openwebflow with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public CallActivityBehavior createCallActivityBehavior(CallActivity callActivity)
{
	return _source.createCallActivityBehavior(callActivity);
}
 
Example #15
Source File: AlfrescoCallActivityBpmnParseHandler.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
protected Class<? extends BaseElement> getHandledType()
{
    return CallActivity.class;
}
 
Example #16
Source File: TestActivityBehaviorFactory.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
@Override
public CallActivityBehavior createCallActivityBehavior(CallActivity callActivity) {
	return wrappedActivityBehaviorFactory.createCallActivityBehavior(callActivity);
}
 
Example #17
Source File: CallActivityXMLConverter.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
public Class<? extends BaseElement> getBpmnElementType() {
  return CallActivity.class;
}
 
Example #18
Source File: CallActivityParseHandler.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
protected void executeParse(BpmnParse bpmnParse, CallActivity callActivity) {
  callActivity.setBehavior(bpmnParse.getActivityBehaviorFactory().createCallActivityBehavior(callActivity));
}
 
Example #19
Source File: CallActivityParseHandler.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
public Class<? extends BaseElement> getHandledType() {
  return CallActivity.class;
}
 
Example #20
Source File: CallActivityJsonConverter.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
public static void fillBpmnTypes(Map<Class<? extends BaseElement>, Class<? extends BaseBpmnJsonConverter>> convertersToJsonMap) {
  convertersToJsonMap.put(CallActivity.class, CallActivityJsonConverter.class);
}
 
Example #21
Source File: CallActivityParseHandler.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
public Class< ? extends BaseElement> getHandledType() {
  return CallActivity.class;
}
 
Example #22
Source File: ActivityBehaviorFactory.java    From activiti6-boot2 with Apache License 2.0 votes vote down vote up
public abstract CallActivityBehavior createCallActivityBehavior(CallActivity callActivity); 
Example #23
Source File: ActivityBehaviorFactory.java    From activiti6-boot2 with Apache License 2.0 votes vote down vote up
public abstract CallActivityBehavior createCallActivityBehavior(CallActivity callActivity);