public static String getProcessVariableName(Property p) { String name = p.getName(); // legacy uses ID instead of name return name == null? p.getId() : name; }
private static String getCaseFileVariableName(Property p) { String name = p.getName(); // legacy uses ID instead of name return name == null ? p.getId() : name; }
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(); }
@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"); }
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; }
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; }
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; } }