Search in sources :

Example 16 with FeatureMap

use of org.eclipse.emf.ecore.util.FeatureMap in project kie-wb-common by kiegroup.

the class DefinitionResolver method initSimulationParameters.

private Map<String, ElementParameters> initSimulationParameters(Definitions definitions) {
    Map<String, ElementParameters> simulationParameters = new HashMap<>();
    List<Relationship> relationships = definitions.getRelationships();
    if (relationships.isEmpty()) {
        return Collections.emptyMap();
    }
    FeatureMap value = relationships.get(0).getExtensionValues().get(0).getValue();
    Object simData = value.get(BpsimPackage.Literals.DOCUMENT_ROOT__BP_SIM_DATA, true);
    List<BPSimDataType> bpsimExtensions = (List<BPSimDataType>) simData;
    Scenario scenario = bpsimExtensions.get(0).getScenario().get(0);
    for (ElementParameters parameters : scenario.getElementParameters()) {
        simulationParameters.put(parameters.getElementRef(), parameters);
    }
    return simulationParameters;
}
Also used : FeatureMap(org.eclipse.emf.ecore.util.FeatureMap) ElementParameters(bpsim.ElementParameters) HashMap(java.util.HashMap) Relationship(org.eclipse.bpmn2.Relationship) List(java.util.List) BPSimDataType(bpsim.BPSimDataType) Scenario(bpsim.Scenario)

Example 17 with FeatureMap

use of org.eclipse.emf.ecore.util.FeatureMap 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 18 with FeatureMap

use of org.eclipse.emf.ecore.util.FeatureMap 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 19 with FeatureMap

use of org.eclipse.emf.ecore.util.FeatureMap in project statecharts by Yakindu.

the class StatechartEqualityHelper method haveEqualAttribute.

@Override
protected boolean haveEqualAttribute(EObject eObject1, EObject eObject2, EAttribute attribute) {
    Object value1 = eObject1.eGet(attribute);
    Object value2 = eObject2.eGet(attribute);
    // 
    if (value1 == null) {
        return value2 == null;
    }
    // 
    if (value2 == null) {
        return false;
    }
    // 
    if (FeatureMapUtil.isFeatureMap(attribute)) {
        // The feature maps must be equal.
        // 
        FeatureMap featureMap1 = (FeatureMap) value1;
        FeatureMap featureMap2 = (FeatureMap) value2;
        return equalFeatureMaps(featureMap1, featureMap2);
    } else {
        if (value1 instanceof String && value2 instanceof String) {
            String wsFreeValue1 = removeWhitespaces((String) value1);
            String wsFreeValue2 = removeWhitespaces((String) value2);
            return wsFreeValue1.equals(wsFreeValue2);
        }
        return value1.equals(value2);
    }
}
Also used : FeatureMap(org.eclipse.emf.ecore.util.FeatureMap) EObject(org.eclipse.emf.ecore.EObject)

Example 20 with FeatureMap

use of org.eclipse.emf.ecore.util.FeatureMap in project mylyn.docs by eclipse.

the class PublicationProxy method getIdentifier.

@SuppressWarnings("rawtypes")
public String getIdentifier() {
    EList<Identifier> identifiers = publication.getPackage().getMetadata().getIdentifiers();
    if (identifiers.size() > 0) {
        FeatureMap fm = identifiers.get(0).getMixed();
        Object o = fm.get(TEXT, false);
        if (o instanceof FeatureEList) {
            if (((FeatureEList) o).size() > 0) {
                return ((FeatureEList) o).get(0).toString();
            }
        }
    }
    return EMPTY_STRING;
}
Also used : FeatureMap(org.eclipse.emf.ecore.util.FeatureMap) FeatureEList(org.eclipse.emf.ecore.util.FeatureMapUtil.FeatureEList) Identifier(org.eclipse.mylyn.docs.epub.dc.Identifier)

Aggregations

FeatureMap (org.eclipse.emf.ecore.util.FeatureMap)25 FeatureEList (org.eclipse.emf.ecore.util.FeatureMapUtil.FeatureEList)10 List (java.util.List)8 ExtensionAttributeValue (org.eclipse.bpmn2.ExtensionAttributeValue)8 ArrayList (java.util.ArrayList)5 EList (org.eclipse.emf.common.util.EList)5 EObject (org.eclipse.emf.ecore.EObject)5 MetaDataType (org.jboss.drools.MetaDataType)5 EStructuralFeature (org.eclipse.emf.ecore.EStructuralFeature)4 Iterator (java.util.Iterator)3 ListIterator (java.util.ListIterator)3 RandomAccess (java.util.RandomAccess)3 InternalEObject (org.eclipse.emf.ecore.InternalEObject)3 AbstractSequentialInternalEList (org.eclipse.emf.ecore.util.AbstractSequentialInternalEList)3 InternalEList (org.eclipse.emf.ecore.util.InternalEList)3 BPSimDataType (bpsim.BPSimDataType)2 HashMap (java.util.HashMap)2 Entry (java.util.Map.Entry)2 Relationship (org.eclipse.bpmn2.Relationship)2 EStructuralFeatureImpl (org.eclipse.emf.ecore.impl.EStructuralFeatureImpl)2