Java Code Examples for org.activiti.bpmn.model.BpmnModel#getTargetNamespace()

The following examples show how to use org.activiti.bpmn.model.BpmnModel#getTargetNamespace() . 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: ItemDefinitionParser.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
public void parse(XMLStreamReader xtr, BpmnModel model) throws Exception {
  if (StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_ID))) {
    String itemDefinitionId = model.getTargetNamespace() + ":" + xtr.getAttributeValue(null, ATTRIBUTE_ID);
    String structureRef = xtr.getAttributeValue(null, ATTRIBUTE_STRUCTURE_REF);
    if (StringUtils.isNotEmpty(structureRef)) {
      ItemDefinition item = new ItemDefinition();
      item.setId(itemDefinitionId);
      BpmnXMLUtil.addXMLLocation(item, xtr);

      int indexOfP = structureRef.indexOf(':');
      if (indexOfP != -1) {
        String prefix = structureRef.substring(0, indexOfP);
        String resolvedNamespace = model.getNamespace(prefix);
        structureRef = resolvedNamespace + ":" + structureRef.substring(indexOfP + 1);
      } else {
        structureRef = model.getTargetNamespace() + ":" + structureRef;
      }

      item.setStructureRef(structureRef);
      item.setItemKind(xtr.getAttributeValue(null, ATTRIBUTE_ITEM_KIND));
      BpmnXMLUtil.parseChildElements(ELEMENT_ITEM_DEFINITION, item, xtr, model);
      model.addItemDefinition(itemDefinitionId, item);
    }
  }
}
 
Example 2
Source File: ServiceTaskXMLConverter.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected String parseOperationRef(String operationRef, BpmnModel model) {
  String result = null;
  if (StringUtils.isNotEmpty(operationRef)) {
    int indexOfP = operationRef.indexOf(':');
    if (indexOfP != -1) {
      String prefix = operationRef.substring(0, indexOfP);
      String resolvedNamespace = model.getNamespace(prefix);
      result = resolvedNamespace + ":" + operationRef.substring(indexOfP + 1);
    } else {
      result = model.getTargetNamespace() + ":" + operationRef;
    }
  }
  return result;
}
 
Example 3
Source File: SendTaskXMLConverter.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected String parseOperationRef(String operationRef, BpmnModel model) {
  String result = null;
  if (StringUtils.isNotEmpty(operationRef)) {
    int indexOfP = operationRef.indexOf(':');
    if (indexOfP != -1) {
      String prefix = operationRef.substring(0, indexOfP);
      String resolvedNamespace = model.getNamespace(prefix);
      result = resolvedNamespace + ":" + operationRef.substring(indexOfP + 1);
    } else {
      result = model.getTargetNamespace() + ":" + operationRef;
    }
  }
  return result;
}
 
Example 4
Source File: IOSpecificationParser.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected String parseItemSubjectRef(String itemSubjectRef, BpmnModel model) {
  String result = null;
  if (StringUtils.isNotEmpty(itemSubjectRef)) {
    int indexOfP = itemSubjectRef.indexOf(':');
    if (indexOfP != -1) {
      String prefix = itemSubjectRef.substring(0, indexOfP);
      String resolvedNamespace = model.getNamespace(prefix);
      result = resolvedNamespace + ":" + itemSubjectRef.substring(indexOfP + 1);
    } else {
      result = model.getTargetNamespace() + ":" + itemSubjectRef;
    }
  }
  return result;
}
 
Example 5
Source File: BpmnModelValidator.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
protected void handleBPMNModelConstraints(BpmnModel bpmnModel, List<ValidationError> errors) {
  if (bpmnModel.getTargetNamespace() != null && bpmnModel.getTargetNamespace().length() > Constraints.BPMN_MODEL_TARGET_NAMESPACE_MAX_LENGTH) {
    addError(errors, Problems.BPMN_MODEL_TARGET_NAMESPACE_TOO_LONG,
        "The targetNamespace of the bpmn model must not contain more than " + Constraints.BPMN_MODEL_TARGET_NAMESPACE_MAX_LENGTH + " characters");
  }
}