Search in sources :

Example 1 with Relationship

use of org.eclipse.bpmn2.Relationship in project cxf by apache.

the class VersionTransformer method convert.

// THERE IS NO ReferenceParametersType for 2004/03
/**
 * Convert from 2005/08 RelatesToType to 2004/08 Relationship.
 *
 * @param internal the 2005/08 RelatesToType
 * @return an equivalent 2004/08 Relationship
 */
public static Relationship convert(RelatesToType internal) {
    Relationship exposed = null;
    if (internal != null) {
        exposed = Names200408.WSA_OBJECT_FACTORY.createRelationship();
        exposed.setValue(internal.getValue());
        String internalRelationshipType = internal.getRelationshipType();
        if (internalRelationshipType != null) {
            QName exposedRelationshipType = null;
            if (!Names.WSA_RELATIONSHIP_REPLY.equals(internalRelationshipType)) {
                exposedRelationshipType = new QName(internalRelationshipType);
            }
            exposed.setRelationshipType(exposedRelationshipType);
        }
        putAll(exposed.getOtherAttributes(), internal.getOtherAttributes());
    }
    return exposed;
}
Also used : AttributedQName(org.apache.cxf.ws.addressing.v200408.AttributedQName) QName(javax.xml.namespace.QName) Relationship(org.apache.cxf.ws.addressing.v200408.Relationship)

Example 2 with Relationship

use of org.eclipse.bpmn2.Relationship in project cxf by apache.

the class MAPCodecTest method isReply.

private boolean isReply(boolean exposedAsNative) {
    boolean isReply = false;
    if (exposedAsNative) {
        isReply = Names.WSA_RELATIONSHIP_REPLY.equals(((RelatesToType) expectedValues[4]).getRelationshipType());
    } else {
        QName relationship = expectedValues[4] instanceof Relationship ? ((Relationship) expectedValues[4]).getRelationshipType() : ((org.apache.cxf.ws.addressing.v200403.Relationship) expectedValues[4]).getRelationshipType();
        isReply = relationship == null || Names.WSA_REPLY_NAME.equalsIgnoreCase(relationship.getLocalPart());
    }
    return isReply;
}
Also used : RelatesToType(org.apache.cxf.ws.addressing.RelatesToType) QName(javax.xml.namespace.QName) Relationship(org.apache.cxf.ws.addressing.v200408.Relationship)

Example 3 with Relationship

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

the class Bpmn2JsonMarshaller method marshall.

/**
 * NOTE:
 * This method has been added for Stunner support. Stunner bpmn parser provides a custom JsonGenerator that
 * is used instead of the one used in jbpm-designer-backend.
 */
public void marshall(JsonGenerator generator, Definitions def, String preProcessingData) throws IOException {
    if (def.getRelationships() != null && def.getRelationships().size() > 0) {
        // current support for single relationship
        Relationship relationship = def.getRelationships().get(0);
        for (ExtensionAttributeValue extattrval : relationship.getExtensionValues()) {
            FeatureMap extensionElements = extattrval.getValue();
            @SuppressWarnings("unchecked") List<BPSimDataType> bpsimExtensions = (List<BPSimDataType>) extensionElements.get(BpsimPackage.Literals.DOCUMENT_ROOT__BP_SIM_DATA, true);
            if (bpsimExtensions != null && bpsimExtensions.size() > 0) {
                BPSimDataType processAnalysis = bpsimExtensions.get(0);
                if (processAnalysis.getScenario() != null && processAnalysis.getScenario().size() > 0) {
                    _simulationScenario = processAnalysis.getScenario().get(0);
                }
            }
        }
    }
    if (preProcessingData == null || preProcessingData.length() < 1) {
        preProcessingData = "ReadOnlyService";
    }
    // this is a temp way to determine if
    // coordinate system changes are necessary
    String bpmn2Exporter = def.getExporter();
    String bpmn2ExporterVersion = def.getExporterVersion();
    boolean haveExporter = bpmn2Exporter != null && bpmn2ExporterVersion != null;
    if (_simulationScenario != null && !haveExporter) {
        coordianteManipulation = false;
    }
    marshallDefinitions(def, generator, preProcessingData);
// generator.close(); FIXME: can we remove this from here?
}
Also used : FeatureMap(org.eclipse.emf.ecore.util.FeatureMap) Relationship(org.eclipse.bpmn2.Relationship) ArrayList(java.util.ArrayList) List(java.util.List) EList(org.eclipse.emf.common.util.EList) ExtensionAttributeValue(org.eclipse.bpmn2.ExtensionAttributeValue) BPSimDataType(bpsim.BPSimDataType)

Example 4 with Relationship

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

the class Bpmn2JsonUnmarshaller method addSimulation.

public void addSimulation(Definitions def) {
    Relationship relationship = Bpmn2Factory.eINSTANCE.createRelationship();
    relationship.getSources().add(def);
    relationship.getTargets().add(def);
    relationship.setType(defaultRelationshipType);
    BPSimDataType simDataType = BpsimFactory.eINSTANCE.createBPSimDataType();
    // currently support single scenario
    Scenario defaultScenario = BpsimFactory.eINSTANCE.createScenario();
    // single scenario suppoert
    defaultScenario.setId("default");
    // single scenario support
    defaultScenario.setName("Simulationscenario");
    defaultScenario.setScenarioParameters(_simulationScenarioParameters);
    if (_simulationElementParameters.size() > 0) {
        Iterator<String> iter = _simulationElementParameters.keySet().iterator();
        while (iter.hasNext()) {
            String key = iter.next();
            ElementParameters etype = BpsimFactory.eINSTANCE.createElementParameters();
            etype.setElementRef(key);
            List<EObject> params = _simulationElementParameters.get(key);
            for (EObject np : params) {
                if (np instanceof ControlParameters) {
                    etype.setControlParameters((ControlParameters) np);
                } else if (np instanceof CostParameters) {
                    etype.setCostParameters((CostParameters) np);
                } else if (np instanceof PriorityParameters) {
                    etype.setPriorityParameters((PriorityParameters) np);
                } else if (np instanceof ResourceParameters) {
                    etype.setResourceParameters((ResourceParameters) np);
                } else if (np instanceof TimeParameters) {
                    etype.setTimeParameters((TimeParameters) np);
                }
            }
            defaultScenario.getElementParameters().add(etype);
        }
    }
    simDataType.getScenario().add(defaultScenario);
    ExtensionAttributeValue extensionElement = Bpmn2Factory.eINSTANCE.createExtensionAttributeValue();
    relationship.getExtensionValues().add(extensionElement);
    FeatureMap.Entry extensionElementEntry = new SimpleFeatureMapEntry((Internal) BpsimPackage.Literals.DOCUMENT_ROOT__BP_SIM_DATA, simDataType);
    relationship.getExtensionValues().get(0).getValue().add(extensionElementEntry);
    def.getRelationships().add(relationship);
}
Also used : CostParameters(bpsim.CostParameters) ElementParameters(bpsim.ElementParameters) ExtensionAttributeValue(org.eclipse.bpmn2.ExtensionAttributeValue) ResourceParameters(bpsim.ResourceParameters) Scenario(bpsim.Scenario) FeatureMap(org.eclipse.emf.ecore.util.FeatureMap) Relationship(org.eclipse.bpmn2.Relationship) EObject(org.eclipse.emf.ecore.EObject) ControlParameters(bpsim.ControlParameters) SimpleFeatureMapEntry(org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry) PriorityParameters(bpsim.PriorityParameters) BPSimDataType(bpsim.BPSimDataType) TimeParameters(bpsim.TimeParameters)

Example 5 with Relationship

use of org.eclipse.bpmn2.Relationship 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)

Aggregations

BPSimDataType (bpsim.BPSimDataType)4 Relationship (org.eclipse.bpmn2.Relationship)4 FeatureMap (org.eclipse.emf.ecore.util.FeatureMap)4 Scenario (bpsim.Scenario)3 ExtensionAttributeValue (org.eclipse.bpmn2.ExtensionAttributeValue)3 ElementParameters (bpsim.ElementParameters)2 List (java.util.List)2 QName (javax.xml.namespace.QName)2 Relationship (org.apache.cxf.ws.addressing.v200408.Relationship)2 ControlParameters (bpsim.ControlParameters)1 CostParameters (bpsim.CostParameters)1 PriorityParameters (bpsim.PriorityParameters)1 ResourceParameters (bpsim.ResourceParameters)1 ScenarioParameters (bpsim.ScenarioParameters)1 TimeParameters (bpsim.TimeParameters)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 RelatesToType (org.apache.cxf.ws.addressing.RelatesToType)1 AttributedQName (org.apache.cxf.ws.addressing.v200408.AttributedQName)1 EList (org.eclipse.emf.common.util.EList)1