Search in sources :

Example 11 with ExtensionAttributeValue

use of org.eclipse.bpmn2.ExtensionAttributeValue in project kie-wb-common by kiegroup.

the class Utils method getMetaDataValue.

public static String getMetaDataValue(List<ExtensionAttributeValue> extensionValues, String metaDataName) {
    if (extensionValues != null && extensionValues.size() > 0) {
        for (ExtensionAttributeValue extattrval : extensionValues) {
            FeatureMap extensionElements = extattrval.getValue();
            List<MetaDataType> metadataExtensions = (List<MetaDataType>) extensionElements.get(DroolsPackage.Literals.DOCUMENT_ROOT__META_DATA, true);
            for (MetaDataType metaType : metadataExtensions) {
                if (metaType.getName() != null && metaType.getName().equals(metaDataName) && metaType.getMetaValue() != null && metaType.getMetaValue().length() > 0) {
                    return metaType.getMetaValue();
                }
            }
        }
    }
    return null;
}
Also used : FeatureMap(org.eclipse.emf.ecore.util.FeatureMap) MetaDataType(org.jboss.drools.MetaDataType) List(java.util.List) ExtensionAttributeValue(org.eclipse.bpmn2.ExtensionAttributeValue)

Example 12 with ExtensionAttributeValue

use of org.eclipse.bpmn2.ExtensionAttributeValue in project kie-wb-common by kiegroup.

the class Scripts method addExtensionValue.

private static void addExtensionValue(FlowElement flowElement, FeatureMap.Entry value) {
    ExtensionAttributeValue eav = bpmn2.createExtensionAttributeValue();
    flowElement.getExtensionValues().add(eav);
    eav.getValue().add(value);
}
Also used : ExtensionAttributeValue(org.eclipse.bpmn2.ExtensionAttributeValue)

Example 13 with ExtensionAttributeValue

use of org.eclipse.bpmn2.ExtensionAttributeValue in project kie-wb-common by kiegroup.

the class Bpmn2JsonMarshaller method getOnExitActions.

public ScriptTypeListValue getOnExitActions(final List<ExtensionAttributeValue> extensionValues) {
    final ScriptTypeListValue onExitActions = new ScriptTypeListValue();
    ScriptTypeValue onExitAction;
    if (extensionValues != null && !extensionValues.isEmpty()) {
        for (ExtensionAttributeValue extattrval : extensionValues) {
            FeatureMap extensionElements = extattrval.getValue();
            @SuppressWarnings("unchecked") List<OnExitScriptType> onExitExtensions = (List<OnExitScriptType>) extensionElements.get(DroolsPackage.Literals.DOCUMENT_ROOT__ON_EXIT_SCRIPT, true);
            for (OnExitScriptType onExitScript : onExitExtensions) {
                onExitAction = getOnExitAction(onExitScript);
                if (onExitAction.getScript() != null && !onExitAction.getScript().isEmpty()) {
                    onExitActions.addValue(onExitAction);
                }
            }
        }
    }
    return onExitActions;
}
Also used : FeatureMap(org.eclipse.emf.ecore.util.FeatureMap) ArrayList(java.util.ArrayList) List(java.util.List) EList(org.eclipse.emf.common.util.EList) ExtensionAttributeValue(org.eclipse.bpmn2.ExtensionAttributeValue) OnExitScriptType(org.jboss.drools.OnExitScriptType) ScriptTypeListValue(org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeListValue) ScriptTypeValue(org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeValue)

Example 14 with ExtensionAttributeValue

use of org.eclipse.bpmn2.ExtensionAttributeValue in project kie-wb-common by kiegroup.

the class Bpmn2JsonMarshaller method getOnEntryActions.

public ScriptTypeListValue getOnEntryActions(final List<ExtensionAttributeValue> extensionValues) {
    final ScriptTypeListValue onEntryActions = new ScriptTypeListValue();
    ScriptTypeValue onEntryAction;
    if (extensionValues != null && !extensionValues.isEmpty()) {
        for (ExtensionAttributeValue extattrval : extensionValues) {
            FeatureMap extensionElements = extattrval.getValue();
            @SuppressWarnings("unchecked") List<OnEntryScriptType> onEntryExtensions = (List<OnEntryScriptType>) extensionElements.get(DroolsPackage.Literals.DOCUMENT_ROOT__ON_ENTRY_SCRIPT, true);
            for (OnEntryScriptType onEntryScript : onEntryExtensions) {
                onEntryAction = getOnEntryAction(onEntryScript);
                if (onEntryAction.getScript() != null && !onEntryAction.getScript().isEmpty()) {
                    onEntryActions.addValue(onEntryAction);
                }
            }
        }
    }
    return onEntryActions;
}
Also used : FeatureMap(org.eclipse.emf.ecore.util.FeatureMap) OnEntryScriptType(org.jboss.drools.OnEntryScriptType) ArrayList(java.util.ArrayList) List(java.util.List) EList(org.eclipse.emf.common.util.EList) ExtensionAttributeValue(org.eclipse.bpmn2.ExtensionAttributeValue) ScriptTypeListValue(org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeListValue) ScriptTypeValue(org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeValue)

Example 15 with ExtensionAttributeValue

use of org.eclipse.bpmn2.ExtensionAttributeValue in project kie-wb-common by kiegroup.

the class StringElement method setStringValue.

void setStringValue(BaseElement element, String value) {
    if (element != null) {
        MetaDataType eleMetadata = DroolsFactory.eINSTANCE.createMetaDataType();
        eleMetadata.setName(name);
        eleMetadata.setMetaValue(asCData(value));
        if (element.getExtensionValues() == null || element.getExtensionValues().isEmpty()) {
            ExtensionAttributeValue extensionElement = Bpmn2Factory.eINSTANCE.createExtensionAttributeValue();
            element.getExtensionValues().add(extensionElement);
        }
        FeatureMap.Entry eleExtensionElementEntry = new EStructuralFeatureImpl.SimpleFeatureMapEntry((EStructuralFeature.Internal) DroolsPackage.Literals.DOCUMENT_ROOT__META_DATA, eleMetadata);
        element.getExtensionValues().get(0).getValue().add(eleExtensionElementEntry);
    }
}
Also used : FeatureMap(org.eclipse.emf.ecore.util.FeatureMap) MetaDataType(org.jboss.drools.MetaDataType) EStructuralFeature(org.eclipse.emf.ecore.EStructuralFeature) ExtensionAttributeValue(org.eclipse.bpmn2.ExtensionAttributeValue)

Aggregations

ExtensionAttributeValue (org.eclipse.bpmn2.ExtensionAttributeValue)16 FeatureMap (org.eclipse.emf.ecore.util.FeatureMap)15 MetaDataType (org.jboss.drools.MetaDataType)7 List (java.util.List)6 ArrayList (java.util.ArrayList)5 EList (org.eclipse.emf.common.util.EList)4 SimpleFeatureMapEntry (org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry)4 ScriptTypeListValue (org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeListValue)4 ScriptTypeValue (org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeValue)4 BPSimDataType (bpsim.BPSimDataType)3 Relationship (org.eclipse.bpmn2.Relationship)3 EStructuralFeature (org.eclipse.emf.ecore.EStructuralFeature)3 Scenario (bpsim.Scenario)2 Entry (java.util.Map.Entry)2 EStructuralFeatureImpl (org.eclipse.emf.ecore.impl.EStructuralFeatureImpl)2 GlobalType (org.jboss.drools.GlobalType)2 ImportType (org.jboss.drools.ImportType)2 OnEntryScriptType (org.jboss.drools.OnEntryScriptType)2 OnExitScriptType (org.jboss.drools.OnExitScriptType)2 ScriptTypeListTypeSerializer (org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.ScriptTypeListTypeSerializer)2