protected Optional<String> optionalAttribute(String... attributeIds) { if (element.getAnyAttribute().isEmpty()) { return Optional.empty(); } final List<String> attributes = Arrays.asList(attributeIds); return element.getAnyAttribute().stream() .filter(e -> attributes.contains(e.getEStructuralFeature().getName())) .map(e -> e.getValue().toString()) .findFirst(); }
protected FeatureMap getExtensionElements(BaseElement element) { if (element.getExtensionValues() == null || element.getExtensionValues().isEmpty()) { ExtensionAttributeValue eav = Bpmn2Factory.eINSTANCE.createExtensionAttributeValue(); element.getExtensionValues().add(eav); return eav.getValue(); } else { return element.getExtensionValues().get(0).getValue(); } }
public String getId() { return this.baseElement.getId(); }
this.processDocs = properties.get("documentation"); } else { baseElement.getDocumentation().add(createDocumentation(wrapInCDATABlock(properties.get("documentation")))); if (baseElement.getId() == null || baseElement.getId().length() < 1) { baseElement.setId(properties.get("resourceId")); if (!(_elementColors.containsKey(baseElement.getId()))) { List<String> colorsList = new ArrayList<String>(); colorsList.add("bgcolor:" + properties.get("bgcolor")); _elementColors.put(baseElement.getId(), colorsList); } else { _elementColors.get(baseElement.getId()).add("bgcolor:" + properties.get("bgcolor")); SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute, properties.get("isselectable")); baseElement.getAnyAttribute().add(extensionEntry); if (!(_elementColors.containsKey(baseElement.getId()))) { List<String> colorsList = new ArrayList<String>(); colorsList.add("bordercolor:" + properties.get("bordercolor")); _elementColors.put(baseElement.getId(), colorsList); } else { _elementColors.get(baseElement.getId()).add("bordercolor:" + properties.get("bordercolor")); SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute, properties.get("fontsize"));
public void updateEdgeColors(BPMNEdge edge) { List<String> eleColorsForEdge = _elementColors.get(edge.getBpmnElement().getId()); if (eleColorsForEdge != null) { String backgroundColor = ""; SimpleFeatureMapEntry extensionEntryBgColor = new SimpleFeatureMapEntry(extensionAttributeBgColor, backgroundColor); edge.getBpmnElement().getAnyAttribute().add(extensionEntryBgColor); EAttributeImpl extensionAttributeBorderColor = (EAttributeImpl) metadata.demandFeature( "http://www.omg.org/spec/BPMN/non-normative/color", SimpleFeatureMapEntry extensionEntryBorderColor = new SimpleFeatureMapEntry(extensionAttributeBorderColor, borderColor); edge.getBpmnElement().getAnyAttribute().add(extensionEntryBorderColor); EAttributeImpl extensionAttributeColor = (EAttributeImpl) metadata.demandFeature( "http://www.omg.org/spec/BPMN/non-normative/color", SimpleFeatureMapEntry extensionEntryColor = new SimpleFeatureMapEntry(extensionAttributeColor, fontColor); edge.getBpmnElement().getAnyAttribute().add(extensionEntryColor); } else { _logger.debug("Unable to find color information for shape: " + edge.getBpmnElement().getId());
private void putDocumentationProperty(BaseElement baseElement, Map<String, Object> properties) { if (CollectionUtils.isNotEmpty(baseElement.getDocumentation())) { properties.put(DOCUMENTATION, baseElement.getDocumentation().stream().filter(Objects::nonNull).map(Documentation::getText).findFirst().orElse(null)); } } }
public void updateShapeColors(BPMNShape shape) { List<String> eleColorsForShape = _elementColors.get(shape.getBpmnElement().getId()); if (eleColorsForShape != null) { String backgroundColor = ""; SimpleFeatureMapEntry extensionEntryBgColor = new SimpleFeatureMapEntry(extensionAttributeBgColor, backgroundColor); shape.getBpmnElement().getAnyAttribute().add(extensionEntryBgColor); EAttributeImpl extensionAttributeBorderColor = (EAttributeImpl) metadata.demandFeature( "http://www.omg.org/spec/BPMN/non-normative/color", SimpleFeatureMapEntry extensionEntryBorderColor = new SimpleFeatureMapEntry(extensionAttributeBorderColor, borderColor); shape.getBpmnElement().getAnyAttribute().add(extensionEntryBorderColor); EAttributeImpl extensionAttributeColor = (EAttributeImpl) metadata.demandFeature( "http://www.omg.org/spec/BPMN/non-normative/color", SimpleFeatureMapEntry extensionEntryColor = new SimpleFeatureMapEntry(extensionAttributeColor, fontColor); shape.getBpmnElement().getAnyAttribute().add(extensionEntryColor); } else { _logger.debug("Unable to find color information for shape: " + shape.getBpmnElement().getId());
public String getDocumentation() { return element.getDocumentation().stream() .findFirst() .map(org.eclipse.bpmn2.Documentation::getText) .orElse(""); }
public List<Point2D> getControlPoints() { return PropertyReaderUtils.getControlPoints(definitionResolver, element.getId()); } }
protected Optional<java.lang.String> getStringValue(BaseElement element) { return Optional.ofNullable(Utils.getMetaDataValue(element.getExtensionValues(), name)); }
private String getAnyAttributeValue(BaseElement el, String attrName) { if (el == null || attrName == null || attrName.isEmpty()) { return null; } if (el.getAnyAttribute() != null && el.getAnyAttribute().size() > 0) { Iterator<FeatureMap.Entry> iter = el.getAnyAttribute().iterator(); while (iter.hasNext()) { FeatureMap.Entry entry = iter.next(); if (attrName.equals(entry.getEStructuralFeature().getName())) { return entry.getValue().toString(); } } } return null; }
public void setDocumentation(String value) { if (!isEmpty(value)) { Documentation documentation = bpmn2.createDocumentation(); documentation.setText(asCData(value)); baseElement.getDocumentation().add(documentation); } }
public List<Point2D> getControlPoints() { return PropertyReaderUtils.getControlPoints(definitionResolver, element.getId()); } }
public ScriptTypeListValue getOnExitAction() { return Scripts.onExit(element.getExtensionValues()); }
Optional<java.lang.String> getStringValue(BaseElement element) { return element.getAnyAttribute().stream() .filter(e -> this.name().equals(e.getEStructuralFeature().getName())) .map(e -> e.getValue().toString()) .findFirst(); }
public BPMNShape getBPMNShapeForElement(BaseElement be, BPMNPlane plane) { List<DiagramElement> diagramElements = plane.getPlaneElement(); for (DiagramElement dia : diagramElements) { if (dia instanceof BPMNShape) { BPMNShape shape = (BPMNShape) dia; if (shape.getBpmnElement().getId().equals(be.getId())) { return shape; } } } return null; }
public ScriptTypeListValue getOnExitAction() { return Scripts.onExit(element.getExtensionValues()); }
void setStringValue(BaseElement element, String value) { EAttributeImpl extensionAttribute = (EAttributeImpl) metaData.demandFeature( "http://www.jboss.org/drools", name, false, false); EStructuralFeatureImpl.SimpleFeatureMapEntry feature = new EStructuralFeatureImpl.SimpleFeatureMapEntry(extensionAttribute, value); element.getAnyAttribute().add(feature); }
public String getSourceId() { return association.getSourceRef().getId(); }
public ScriptTypeListValue getOnExitAction() { return Scripts.onExit(element.getExtensionValues()); }