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(); }
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; }
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(); }
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); }
SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute, properties.get("isselectable")); baseElement.getAnyAttribute().add(extensionEntry); SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute, properties.get("fontsize")); baseElement.getAnyAttribute().add(extensionEntry);
String idefId = null; String msgName = null; Iterator<FeatureMap.Entry> iter = element.getAnyAttribute().iterator(); while (iter.hasNext()) { FeatureMap.Entry entry = iter.next();
@Before public void setup() { FeatureMap featureMap = mock(FeatureMap.class); when(featureMap.isEmpty()).thenReturn(true); when(element.getAnyAttribute()).thenReturn(featureMap); org.eclipse.dd.dc.Bounds shapeBounds = mock(org.eclipse.dd.dc.Bounds.class); when(shapeBounds.getX()).thenReturn(1.1f); when(shapeBounds.getY()).thenReturn(2.2f); when(shapeBounds.getWidth()).thenReturn(100f); when(shapeBounds.getHeight()).thenReturn(545.34f); when(shape.getBounds()).thenReturn(shapeBounds); tested = new BasePropertyReader(element, diagram, shape, RESOLUTION_FACTOR); }
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());
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());