private void marshallItemAwareElements(Activity activity, List<? extends ItemAwareElement> elements, StringBuilder buffer, List<String> disallowedNames) { for (ItemAwareElement element : elements) { String name = null; if (element instanceof DataInput) { name = ((DataInput) element).getName(); } if (element instanceof DataOutput) { name = ((DataOutput) element).getName(); } if (name != null && !name.isEmpty() && !disallowedNames.contains(name)) { buffer.append(name); if (element.getItemSubjectRef() != null && element.getItemSubjectRef().getStructureRef() != null && !element.getItemSubjectRef().getStructureRef().isEmpty()) { buffer.append(":").append(element.getItemSubjectRef().getStructureRef()); } else if (activity.eContainer() instanceof SubProcess) { // BZ1247105: for Outputs on Tasks inside sub-processes String dtype = getAnyAttributeValue(element, "dtype"); if (dtype != null && !dtype.isEmpty()) { buffer.append(":").append(dtype); } } buffer.append(","); } } }
private ItemDefinition getItemDefinition(List<RootElement> rootElements, String id, String structureRef) { for (RootElement rootElement : rootElements) { if (id.equals(rootElement.getId()) && rootElement instanceof ItemDefinition) { ItemDefinition itemDefinition = (ItemDefinition) rootElement; if (structureRef.equals(itemDefinition.getStructureRef())) { return itemDefinition; } else { return null; } } } return null; }
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; }
String holderClass = StringUtils.defaultIfEmpty( prop.getItemSubjectRef().getStructureRef(), "java.lang.Object" ); DataHolderBuildConfig config = new DataHolderBuildConfig( prop.getId(),
@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"); }
elementName); if (dataObject.getItemSubjectRef().getStructureRef() != null && dataObject.getItemSubjectRef().getStructureRef().length() > 0) { if (defaultTypesList.contains(dataObject.getItemSubjectRef().getStructureRef())) { properties.put(STANDARDTYPE, dataObject.getItemSubjectRef().getStructureRef()); } else { properties.put(CUSTOMTYPE, dataObject.getItemSubjectRef().getStructureRef());
private void assertItemExists(List<RootElement> rootElements, String id, String structureRef) { for (RootElement rootElement : rootElements) { if (id.equals(rootElement.getId()) && rootElement instanceof ItemDefinition) { ItemDefinition itemDefinition = (ItemDefinition) rootElement; if (structureRef.equals(itemDefinition.getStructureRef())) { // pass; return; } else { fail("Found mismatching item with id = " + id + " " + itemDefinition); } } } fail("Could not find item id = " + id); }
@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; }
private static DataOutput dataOutputOf(String parentId, String identifier, ItemDefinition itemDefinition) { DataOutput dataOutput = bpmn2.createDataOutput(); dataOutput.setId(Ids.dataOutput(parentId, identifier)); dataOutput.setName(identifier); dataOutput.setItemSubjectRef(itemDefinition); CustomAttribute.dtype.of(dataOutput).set(itemDefinition.getStructureRef()); return dataOutput; }
private static DataInput dataInputOf(String parentId, String identifier, ItemDefinition itemDefinition) { DataInput dataInput = bpmn2.createDataInput(); dataInput.setId(Ids.dataInput(parentId, identifier)); dataInput.setName(identifier); dataInput.setItemSubjectRef(itemDefinition); CustomAttribute.dtype.of(dataInput).set(itemDefinition.getStructureRef()); return dataInput; }
private DataInput readInputFrom(String targetName, ItemDefinition typeDef) { DataInput dataInput = bpmn2.createDataInput(); dataInput.setName(targetName); // the id is an encoding of the node id + the name of the input dataInput.setId(Ids.dataInput(element.getId(), targetName)); dataInput.setItemSubjectRef(typeDef); CustomAttribute.dtype.of(dataInput).set(typeDef.getStructureRef()); return dataInput; }
propVal += p.getId(); if (p.getItemSubjectRef() != null && p.getItemSubjectRef().getStructureRef() != null) { propVal += ":" + p.getItemSubjectRef().getStructureRef();
private void validateDataInputOrOutput(ItemAwareElement itemAwareElement, String idSuffix, String dataType, String itemSubjectRefSuffix) { assertNotNull(itemAwareElement); assertTrue(itemAwareElement.getId().endsWith(idSuffix)); ItemDefinition itemDefinition = itemAwareElement.getItemSubjectRef(); assertNotNull(itemDefinition); assertTrue(itemDefinition.getStructureRef().equals(dataType)); assertTrue(itemDefinition.getId().endsWith(itemSubjectRefSuffix)); }
@Test public void marshallUnassignedDeclaration() throws Exception { String id = "PARENT"; String decl = "||Foo:String||"; StartEvent startEvent = bpmn2.createStartEvent(); startEvent.setId(id); CatchEventPropertyWriter p = new CatchEventPropertyWriter(startEvent, new FlatVariableScope()); p.setAssignmentsInfo(new AssignmentsInfo(decl)); assertEquals(1, p.getItemDefinitions().size()); assertEquals(Ids.dataOutputItem(id, "Foo"), p.getItemDefinitions().get(0).getId()); assertEquals("String", p.getItemDefinitions().get(0).getStructureRef()); assertEquals(1, startEvent.getDataOutputs().size()); assertEquals("Foo", startEvent.getDataOutputs().get(0).getName()); assertEquals(0, startEvent.getDataOutputAssociation().size()); }
private void validateDataInputOrOutput(ItemAwareElement itemAwareElement, String idSuffix, String dataType, String itemSubjectRefSuffix) { assertNotNull(itemAwareElement); assertTrue(itemAwareElement.getId().endsWith(idSuffix)); ItemDefinition itemDefinition = itemAwareElement.getItemSubjectRef(); assertNotNull(itemDefinition); assertEquals(itemDefinition.getStructureRef(), (dataType)); assertTrue(itemDefinition.getId().endsWith(itemSubjectRefSuffix)); }
propVal += p.getId(); if (p.getItemSubjectRef() != null && p.getItemSubjectRef().getStructureRef() != null) { propVal += ":" + p.getItemSubjectRef().getStructureRef();