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(","); } } }
protected void addSubprocessItemDefs(ItemDefinition itemdef) { _subprocessItemDefs.put(itemdef.getId(), itemdef); } }
private ItemDefinition typedefInput(String name, String type) { ItemDefinition typeDef = bpmn2.createItemDefinition(); typeDef.setId(Ids.dataInputItem(element.getId(), name)); typeDef.setStructureRef(type); return typeDef; } }
public void revisitItemDefinitions(Definitions def) { List<String> itemIds = new ArrayList<String>(); for (RootElement root : def.getRootElements()) { if (root instanceof ItemDefinition) { if (!itemIds.contains(root.getId())) { itemIds.add(root.getId()); } else { ItemDefinition idef = (ItemDefinition) root; Random rand = new Random(); int randomNum = rand.nextInt((1000 - 10) + 1) + 10; idef.setId(idef.getId() + randomNum); } } } }
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)); }
DataObject da = (DataObject) fe; ItemDefinition itemdef = Bpmn2Factory.eINSTANCE.createItemDefinition(); itemdef.setId("_" + da.getId() + "Item"); Iterator<FeatureMap.Entry> iter = da.getAnyAttribute().iterator(); while (iter.hasNext()) { String typeValue = (String) entry.getValue(); if (typeValue != null && !typeValue.equals("None")) { itemdef.setStructureRef((String) entry.getValue()); if (ele instanceof ItemDefinition) { ItemDefinition idef = (ItemDefinition) ele; if (idef.getId().equals(itemDef.getId())) { foundItemDef = true; break;
if (idef == null) { idef = Bpmn2Factory.eINSTANCE.createItemDefinition(); idef.setId(idefId); _itemDefinitions.put(idefId, idef);
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)); }
/** * Revisit message to set their item ref to a item definition * @param def Definitions */ private void revisitMessages(Definitions def) { List<RootElement> rootElements = def.getRootElements(); List<ItemDefinition> toAddDefinitions = new ArrayList<ItemDefinition>(); for (RootElement root : rootElements) { if (root instanceof Message) { if (!existsMessageItemDefinition(rootElements, root.getId())) { ItemDefinition itemdef = Bpmn2Factory.eINSTANCE.createItemDefinition(); itemdef.setId(root.getId() + "Type"); toAddDefinitions.add(itemdef); ((Message) root).setItemRef(itemdef); } } } for (ItemDefinition id : toAddDefinitions) { def.getRootElements().add(id); } }
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; }
@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()); }
public InitializedVariable(String parentId, VariableDeclaration varDecl) { this.identifier = varDecl.getIdentifier(); this.type = varDecl.getType(); this.itemDefinition = bpmn2.createItemDefinition(); itemDefinition.setId(Ids.item(parentId)); itemDefinition.setStructureRef(getType()); }
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; }
public InitializedInputVariable(String parentId, VariableDeclaration varDecl) { super(parentId, varDecl); getItemDefinition().setId(Ids.dataInputItem(parentId, varDecl.getIdentifier())); this.dataInput = dataInputOf( parentId, varDecl.getIdentifier(), getItemDefinition()); }
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; }
break; if (din.getItemSubjectRef() != null && din.getItemSubjectRef().getId().equals(taskmi.getInputDataItem().getItemSubjectRef().getId())) { properties.put(MULTIPLEINSTANCEDATAINPUT, din.getName()); break; if (dout.getItemSubjectRef() != null && dout.getItemSubjectRef().getId().equals(taskmi.getOutputDataItem().getItemSubjectRef().getId())) { properties.put(MULTIPLEINSTANCEDATAOUTPUT, dout.getName()); propVal += p.getId(); if (p.getItemSubjectRef() != null && p.getItemSubjectRef().getStructureRef() != null) { propVal += ":" + p.getItemSubjectRef().getStructureRef();
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); }
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; }
public InitializedOutputVariable(String parentId, VariableDeclaration varDecl) { super(parentId, varDecl); getItemDefinition().setId(Ids.dataOutputItem(parentId, varDecl.getIdentifier())); this.dataOutput = dataOutputOf( parentId, varDecl.getIdentifier(), getItemDefinition()); }
String holderClass = StringUtils.defaultIfEmpty( prop.getItemSubjectRef().getStructureRef(), "java.lang.Object" ); DataHolderBuildConfig config = new DataHolderBuildConfig( prop.getId(),