private static String toProcessVariableString(Property p) { String processVariableName = getProcessVariableName(p); return Optional.ofNullable(p.getItemSubjectRef()) .map(ItemDefinition::getStructureRef) .map(type -> processVariableName + ":" + type) .orElse(processVariableName); }
private Property getProcessProperty(List<Property> properties, String id, String itemSubjectRef) { for (Property property : properties) { if (id.equals(property.getId())) { if (itemSubjectRef.equals(property.getItemSubjectRef().getId())) { return property; } else { return null; } } } return null; }
private Property getProcessProperty(List<Property> properties, String id, String itemSubjectRef) { for (Property property : properties) { if (id.equals(property.getId()) || id.equals(property.getName())) { if (itemSubjectRef.equals(property.getItemSubjectRef().getId())) { return property; } else { return null; } } } return null; }
for (int i = 0; i < processProperties.size(); i++) { Property p = processProperties.get(i); String pKPI = Utils.getMetaDataValue(p.getExtensionValues(), "customKPI"); propVal += p.getId(); if (p.getItemSubjectRef() != null && p.getItemSubjectRef().getStructureRef() != null) { propVal += ":" + p.getItemSubjectRef().getStructureRef();
prop.setId(vardefParts[0]); itemdef.setId("_" + prop.getId() + "Item"); boolean haveKPI = false; String kpiValue = ""; prop.setId(vardef); itemdef.setId("_" + prop.getId() + "Item"); prop.setItemSubjectRef(itemdef); rootLevelProcess.getProperties().add(prop); ((Definitions) baseElt).getRootElements().add(itemdef); prop.setId(vardefParts[0]); itemdef.setId("_" + prop.getId() + "Item"); boolean haveKPI = false; String kpiValue = ""; prop.setId(vardef); itemdef.setId("_" + prop.getId() + "Item"); prop.setItemSubjectRef(itemdef); rootLevelProcess.getProperties().add(prop); ((Definitions) baseElt).getRootElements().add(itemdef);
List<Property> properties = process.getProperties(); for (Property prop : properties) { if (prop.getId() != null && prop.getId().equals(miCollectionInput)) { DataInput miCollectionInputDI = Bpmn2Factory.eINSTANCE.createDataInput(); miCollectionInputDI.setName("miinputCollection"); ItemDefinition miCollectionInputDIItemDefinition = this.getMessageItemDefinition(def.getRootElements(), prop.getId()); miCollectionInputDI.setItemSubjectRef(miCollectionInputDIItemDefinition); task.getIoSpecification().getDataInputs().add(miCollectionInputDI); List<Property> properties = process.getProperties(); for (Property prop : properties) { if (prop.getId() != null && prop.getId().equals(miCollectionOutput)) { DataOutput miCollectionOutputDI = Bpmn2Factory.eINSTANCE.createDataOutput(); miCollectionOutputDI.setName("mioutputCollection"); ItemDefinition miCollectionOutputDIItemDefinition = this.getMessageItemDefinition(def.getRootElements(), prop.getId()); miCollectionOutputDI.setItemSubjectRef(miCollectionOutputDIItemDefinition); task.getIoSpecification().getDataOutputs().add(miCollectionOutputDI);
public VariableDeclaration(String identifier, String type) { this.identifier = identifier; this.type = type; this.typeDeclaration = bpmn2.createItemDefinition(); this.typeDeclaration.setId(Ids.item(identifier)); this.typeDeclaration.setStructureRef(type); this.typedIdentifier = bpmn2.createProperty(); this.typedIdentifier.setId(Ids.typedIdentifier("GLOBAL", identifier)); this.typedIdentifier.setName(identifier); this.typedIdentifier.setItemSubjectRef(typeDeclaration); }
public String findVar(List<DataInputAssociation> associations, String varName) { return associations.stream() .filter(a -> { DataInput in = (DataInput) a.getTargetRef(); return in.getName().equals(varName); }) .map(a -> { Property dataOutput = (Property) a.getSourceRef().get(0); return dataOutput.getName(); }) .findFirst() .get(); }
private Set<DataHolder> getProcessDataHolders( List<Property> processProperties, String path ) { Set<DataHolder> result = new TreeSet<DataHolder>(); String[] colors = dataHolderManager.getHolderColors().keySet().toArray( new String[0] ); int index = 0; for ( Property prop : processProperties ) { String propertyName = prop.getId(); String propertyType = StringUtils.defaultIfEmpty( prop.getItemSubjectRef().getStructureRef(), "java.lang.Object" ); DataHolderBuildConfig config = new DataHolderBuildConfig( propertyName, "", propertyName, colors[index], propertyType ); config.addAttribute( "path", path ); DataHolder dataHolder = createDataHolder( config ); if ( dataHolder != null ) result.add( dataHolder ); if ( index == colors.length - 1 ) index = 0; else index++; } return result; }
@Before public void setup() { properties = new ArrayList<>(); properties.add(property1); properties.add(property2); properties.add(property3); properties.add(property4); when(property1.getName()).thenReturn(CaseFileVariables.CASE_FILE_PREFIX + "CFV1"); when(property1.getId()).thenReturn(CaseFileVariables.CASE_FILE_PREFIX + "CFV1"); when(property1.getItemSubjectRef()).thenReturn(definition); when(property2.getName()).thenReturn(null); when(property2.getId()).thenReturn(CaseFileVariables.CASE_FILE_PREFIX + "CFV2"); when(property2.getItemSubjectRef()).thenReturn(definition); when(definition.getStructureRef()).thenReturn("Boolean"); when(property3.getName()).thenReturn("PV1"); when(property3.getId()).thenReturn("PV1"); when(property4.getName()).thenReturn(null); when(property4.getId()).thenReturn("PV2"); }
for (int i = 0; i < processProperties.size(); i++) { Property p = processProperties.get(i); String pKPI = Utils.getMetaDataValue(p.getExtensionValues(), "customKPI"); propVal += p.getId(); if (p.getItemSubjectRef() != null && p.getItemSubjectRef().getStructureRef() != null) { propVal += ":" + p.getItemSubjectRef().getStructureRef();
prop.setId(vardefParts[0]); itemdef.setId("_" + prop.getId() + "Item"); boolean haveKPI = false; String kpiValue = ""; prop.setId(vardef); itemdef.setId("_" + prop.getId() + "Item"); prop.setItemSubjectRef(itemdef); sp.getProperties().add(prop); addSubprocessItemDefs(itemdef);
Variable(String parentScopeId, String identifier, String type) { this.parentScopeId = parentScopeId; this.declaration = new VariableDeclaration(identifier, type); this.typeDeclaration = bpmn2.createItemDefinition(); this.typeDeclaration.setId(Ids.item(identifier)); this.typeDeclaration.setStructureRef(type); this.typedIdentifier = bpmn2.createProperty(); this.typedIdentifier.setId(Ids.typedIdentifier(parentScopeId, identifier)); this.typedIdentifier.setName(identifier); this.typedIdentifier.setItemSubjectRef(typeDeclaration); }
private ItemAwareElement getDataInputAssociationSourceRef(Activity activity, String id) { List<DataInputAssociation> dataInputAssociations = activity.getDataInputAssociations(); if (dataInputAssociations != null) { for (DataInputAssociation dataInputAssociation : dataInputAssociations) { List<ItemAwareElement> sourceRef = dataInputAssociation.getSourceRef(); if (sourceRef != null && !sourceRef.isEmpty()) { ItemAwareElement result = Arrays.stream(sourceRef.toArray(new ItemAwareElement[sourceRef.size()])) .filter(itemAwareElement -> id.equals(itemAwareElement.getId()) || id.equals(((Property) itemAwareElement).getName())) .findFirst() .orElse(null); if (result != null) { return result; } } } } return null; }
String holderClass = StringUtils.defaultIfEmpty( prop.getItemSubjectRef().getStructureRef(), "java.lang.Object" ); DataHolderBuildConfig config = new DataHolderBuildConfig( prop.getId(), "", "", holderClass ); config.addAttribute( "path", contextUri ); associations.put( prop.getId(), config ); if ( index == colors.length - 1 ) index = 0; else index++;
private static String toCaseFileVariableString(Property p) { String variableName = getCaseFileVariableName(p); String caseFileVariableName = variableName.substring(CaseFileVariables.CASE_FILE_PREFIX.length()); return Optional.ofNullable(p.getItemSubjectRef()) .map(ItemDefinition::getStructureRef) .map(type -> caseFileVariableName + ":" + type) .orElse(caseFileVariableName); }
private ItemAwareElement getDataOutputAssociationTargetRef(Activity activity, String id) { List<DataOutputAssociation> dataOutputAssociations = activity.getDataOutputAssociations(); if (dataOutputAssociations != null) { for (DataOutputAssociation dataOutputAssociation : dataOutputAssociations) { ItemAwareElement targetRef = dataOutputAssociation.getTargetRef(); if (targetRef != null && id.equals(targetRef.getId()) || id.equals(((Property) targetRef).getName())) { return targetRef; } } } return null; } }
@Override public BusinessProcessFormModel generateProcessFormModel(Definitions source, Path path) { Process process = getProcess(source); if (process != null) { final ClassLoader projectClassLoader = projectClassLoaderHelper.getModuleClassLoader(moduleService.resolveModule(path)); List<ModelProperty> properties = process.getProperties().stream().map(property -> { String varName = property.getId(); String varType = BPMNVariableUtils.getRealTypeForInput(property.getItemSubjectRef().getStructureRef()); Variable variable = new Variable(varName, varType); variable.setInput(true); variable.setOutput(true); return createModelProperty(variable, projectClassLoader); }).filter(modelProperty -> modelProperty != null) .sorted((property1, property2) -> property1.getName().compareToIgnoreCase(property2.getName())).collect(Collectors.toList()); return new BusinessProcessFormModel(process.getId(), process.getName(), properties); } return null; }