Search in sources :

Example 26 with SimpleFeatureMapEntry

use of org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry in project kie-wb-common by kiegroup.

the class Bpmn2JsonUnmarshaller method updateShapeColors.

public void updateShapeColors(BPMNShape shape) {
    List<String> eleColorsForShape = _elementColors.get(shape.getBpmnElement().getId());
    if (eleColorsForShape != null) {
        String backgroundColor = "";
        String borderColor = "";
        String fontColor = "";
        for (String shapeColor : eleColorsForShape) {
            String[] shapeColorParts = shapeColor.split(":");
            if (shapeColorParts[0].equals("bgcolor")) {
                backgroundColor = shapeColorParts[1];
            }
            if (shapeColorParts[0].equals("bordercolor")) {
                borderColor = shapeColorParts[1];
            }
            if (shapeColorParts[0].equals("fontcolor")) {
                fontColor = shapeColorParts[1];
            }
        }
        ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
        EAttributeImpl extensionAttributeBgColor = (EAttributeImpl) metadata.demandFeature("http://www.omg.org/spec/BPMN/non-normative/color", "background-color", false, false);
        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", "border-color", false, false);
        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", "color", false, false);
        SimpleFeatureMapEntry extensionEntryColor = new SimpleFeatureMapEntry(extensionAttributeColor, fontColor);
        shape.getBpmnElement().getAnyAttribute().add(extensionEntryColor);
    } else {
        _logger.debug("Unable to find color information for shape: " + shape.getBpmnElement().getId());
    }
}
Also used : EAttributeImpl(org.eclipse.emf.ecore.impl.EAttributeImpl) SimpleFeatureMapEntry(org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry) ExtendedMetaData(org.eclipse.emf.ecore.util.ExtendedMetaData)

Example 27 with SimpleFeatureMapEntry

use of org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry in project kie-wb-common by kiegroup.

the class Bpmn2JsonUnmarshaller method applyBusinessRuleTaskProperties.

protected void applyBusinessRuleTaskProperties(BusinessRuleTask task, Map<String, String> properties) {
    if (properties.get("ruleflowgroup") != null && properties.get("ruleflowgroup").length() > 0) {
        // add kiegroup-specific attribute "ruleFlowGroup"
        ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
        EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature("http://www.jboss.org/drools", "ruleFlowGroup", false, false);
        SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute, properties.get("ruleflowgroup"));
        task.getAnyAttribute().add(extensionEntry);
    }
    if (properties.get("script_language") != null && properties.get("script_language").length() > 0) {
        String scriptLanguage = getScriptLanguageFormat(properties);
        ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
        EAttributeImpl scriptLanguageElement = (EAttributeImpl) metadata.demandFeature("http://www.jboss.org/drools", "scriptFormat", false, false);
        SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(scriptLanguageElement, scriptLanguage);
        task.getAnyAttribute().add(extensionEntry);
    }
}
Also used : EAttributeImpl(org.eclipse.emf.ecore.impl.EAttributeImpl) SimpleFeatureMapEntry(org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry) ExtendedMetaData(org.eclipse.emf.ecore.util.ExtendedMetaData)

Aggregations

SimpleFeatureMapEntry (org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry)27 EAttributeImpl (org.eclipse.emf.ecore.impl.EAttributeImpl)24 ExtendedMetaData (org.eclipse.emf.ecore.util.ExtendedMetaData)24 ArrayList (java.util.ArrayList)10 EObject (org.eclipse.emf.ecore.EObject)8 Parameter (bpsim.Parameter)6 FloatingParameterType (bpsim.FloatingParameterType)5 TimeParameters (bpsim.TimeParameters)5 DecimalFormat (java.text.DecimalFormat)5 DataInput (org.eclipse.bpmn2.DataInput)5 NormalDistributionType (bpsim.NormalDistributionType)4 PoissonDistributionType (bpsim.PoissonDistributionType)4 UniformDistributionType (bpsim.UniformDistributionType)4 List (java.util.List)4 Assignment (org.eclipse.bpmn2.Assignment)4 DataInputAssociation (org.eclipse.bpmn2.DataInputAssociation)4 DataOutput (org.eclipse.bpmn2.DataOutput)4 ExtensionAttributeValue (org.eclipse.bpmn2.ExtensionAttributeValue)4 FormalExpression (org.eclipse.bpmn2.FormalExpression)4 InputOutputSpecification (org.eclipse.bpmn2.InputOutputSpecification)4