Java 类org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry 实例源码

项目:caml2tosca    文件:ToscaUtil.java   
public static FeatureMap.Entry createContainmentFeatureMapEntry(String nsPrefix, String nsURI, String name, Element base, Stereotype refinement) {
    AnyType anyType = XMLTypeFactory.eINSTANCE.createAnyType();

    // create for each property of the refinement an EReference and the SimpleFeatureMapEntry
    for(Property property : refinement.getAllAttributes()) {
        if(!property.getName().startsWith("base_")) {
            AnyType anyTypeForProperty = XMLTypeFactory.eINSTANCE.createAnyType();
            SimpleFeatureMapEntry simpleFeatureMapEntry = new SimpleFeatureMapEntry((EStructuralFeature.Internal) Text_Attribute, getStringRepresentation(base.getValue(refinement, property.getName())));
            anyTypeForProperty.getMixed().add(simpleFeatureMapEntry);

            EStructuralFeatureImpl.ContainmentUpdatingFeatureMapEntry containmentFeatureMapEntry = 
                    new EStructuralFeatureImpl.ContainmentUpdatingFeatureMapEntry((EStructuralFeature.Internal) createTEReference(nsPrefix, nsURI, property.getName()), (InternalEObject) anyTypeForProperty);

            anyType.getMixed().add(containmentFeatureMapEntry);
        }
    }

    return new EStructuralFeatureImpl.ContainmentUpdatingFeatureMapEntry((EStructuralFeature.Internal) createTEReference(nsPrefix, nsURI, name), 
            (InternalEObject) anyType);         
}
项目:caml2tosca    文件:ToscaUtil.java   
public static FeatureMap.Entry createFeatureMapEntryForSlots(String nsPrefix, String nsURI, String name, Collection<Slot> slots) {
    AnyType anyType = XMLTypeFactory.eINSTANCE.createAnyType();

    // create for each property of the refinement an EReference and the SimpleFeatureMapEntry
    for(Slot slot : slots) {
        AnyType anyTypeForProperty = XMLTypeFactory.eINSTANCE.createAnyType();
        // TODO: What about list of values! -> currently we take the first value only
        SimpleFeatureMapEntry simpleFeatureMapEntry = new SimpleFeatureMapEntry((EStructuralFeature.Internal) Text_Attribute, getStringRepresentation(slot.getValues().get(0)));
        anyTypeForProperty.getMixed().add(simpleFeatureMapEntry);

        EStructuralFeatureImpl.ContainmentUpdatingFeatureMapEntry containmentFeatureMapEntry = 
                new EStructuralFeatureImpl.ContainmentUpdatingFeatureMapEntry((EStructuralFeature.Internal) createTEReference(nsPrefix, nsURI, slot.getDefiningFeature().getName()), (InternalEObject) anyTypeForProperty);

        anyType.getMixed().add(containmentFeatureMapEntry);
    }

    return new EStructuralFeatureImpl.ContainmentUpdatingFeatureMapEntry((EStructuralFeature.Internal) createTEReference(nsPrefix, nsURI, name), 
            (InternalEObject) anyType);         
}
项目:kie-wb-common    文件:Bpmn2JsonUnmarshaller.java   
private void createDockersForBoundaryEvent(BoundaryEvent boundaryEvent) {
    List<Point> dockers = _dockers.get(boundaryEvent.getId());
    StringBuffer dockerBuff = new StringBuffer();
    for (int i = 0; i < dockers.size(); i++) {
        dockerBuff.append(dockers.get(i).getX());
        dockerBuff.append("^");
        dockerBuff.append(dockers.get(i).getY());
        dockerBuff.append("|");
    }
    ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
    EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature(
            "http://www.jboss.org/drools",
            "dockerinfo",
            false,
            false);
    SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute,
                                                                     dockerBuff.toString());
    boundaryEvent.getAnyAttribute().add(extensionEntry);
}
项目:kie-wb-common    文件:Bpmn2JsonUnmarshaller.java   
protected void applyAssociationProperties(Association association,
                                          Map<String, String> properties) {
    if (properties.get("type") != null) {
        ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
        EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature(
                "http://www.jboss.org/drools",
                "type",
                false,
                false);
        SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute,
                                                                         properties.get("type"));
        association.getAnyAttribute().add(extensionEntry);
    }
    if (properties.get("bordercolor") != null && properties.get("bordercolor").length() > 0) {
        if (!(_elementColors.containsKey(association.getId()))) {
            List<String> colorsList = new ArrayList<String>();
            colorsList.add("bordercolor:" + properties.get("bordercolor"));
            _elementColors.put(association.getId(),
                               colorsList);
        } else {
            _elementColors.get(association.getId()).add("bordercolor:" + properties.get("bordercolor"));
        }
    }
}
项目:kie-wb-common    文件:Bpmn2JsonUnmarshaller.java   
protected void applyDefinitionProperties(Definitions def,
                                         Map<String, String> properties) {
    def.setTypeLanguage(properties.get("typelanguage"));
    //def.setTargetNamespace(properties.get("targetnamespace"));
    def.setTargetNamespace("http://www.omg.org/bpmn20");
    def.setExpressionLanguage(properties.get("expressionlanguage"));
    ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
    EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature(
            "xsi",
            "schemaLocation",
            false,
            false);
    SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute,
                                                                     "http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd http://www.jboss.org/drools drools.xsd http://www.bpsim.org/schemas/1.0 bpsim.xsd");
    def.getAnyAttribute().add(extensionEntry);
    //_currentResource.getContents().add(def);// hook the definitions object to the resource early.
}
项目:kie-wb-common    文件:Bpmn2JsonUnmarshaller.java   
protected void applyGatewayProperties(Gateway gateway,
                                      Map<String, String> properties) {
    if (properties.get("name") != null && properties.get("name").length() > 0) {
        gateway.setName(StringEscapeUtils.escapeXml(properties.get("name")).replaceAll("\\r\\n|\\r|\\n",
                                                                                       " "));
        // add unescaped and untouched name value as extension element as well
        Utils.setMetaDataExtensionValue(gateway,
                                        "elementname",
                                        wrapInCDATABlock(properties.get("name").replaceAll("\\\\n",
                                                                                           "\n")));
    } else {
        gateway.setName("");
    }
    if (properties.get("defaultgate") != null && (gateway instanceof InclusiveGateway || gateway instanceof ExclusiveGateway)) {
        ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
        EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature(
                "http://www.jboss.org/drools",
                "dg",
                false,
                false);
        SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute,
                                                                         properties.get("defaultgate"));
        gateway.getAnyAttribute().add(extensionEntry);
    }
}
项目:fixflow    文件:BpmnModelUtil.java   
/**
 * 增加扩展元素
 * @param baseElement
 * @param eReference
 * @param o
 * @return
 */
public static boolean addExtensionElement(BaseElement baseElement,EReference eReference,Object o){
    final FeatureMap.Entry extensionElementEntry = new SimpleFeatureMapEntry((org.eclipse.emf.ecore.EStructuralFeature.Internal) eReference, o);
        if(baseElement.getExtensionValues().size() > 0){
            baseElement.getExtensionValues().get(0).getValue().add(extensionElementEntry);
        }else{
            ExtensionAttributeValue extensionElement = Bpmn2Factory.eINSTANCE.createExtensionAttributeValue();
            extensionElement.getValue().add(extensionElementEntry);
            baseElement.getExtensionValues().add(extensionElement);
        } 
    return false;
}
项目:kie-wb-common    文件:Bpmn2JsonUnmarshaller.java   
protected void applyOnEntryActions(BaseElement element,
                                   Map<String, String> properties) {
    if (properties.get("onentryactions") != null && properties.get("onentryactions").length() > 0) {
        ScriptTypeListValue onEntryActions = new ScriptTypeListTypeSerializer().parse(properties.get("onentryactions"));
        if (!onEntryActions.isEmpty()) {
            ScriptTypeValue onEntryAction = onEntryActions.getValues().get(0);
            if (onEntryAction.getScript() != null && !onEntryAction.getScript().isEmpty()) {
                OnEntryScriptType onEntryScript = DroolsFactory.eINSTANCE.createOnEntryScriptType();
                onEntryScript.setScript(wrapInCDATABlock(onEntryAction.getScript()));
                String scriptLanguage = Utils.getScriptLanguageFormat(onEntryAction.getLanguage());
                if (scriptLanguage == null) {
                    //default to java
                    scriptLanguage = "http://www.java.com/java";
                }
                onEntryScript.setScriptFormat(scriptLanguage);
                if (element.getExtensionValues() == null || element.getExtensionValues().size() < 1) {
                    ExtensionAttributeValue extensionElement = Bpmn2Factory.eINSTANCE.createExtensionAttributeValue();
                    element.getExtensionValues().add(extensionElement);
                }
                FeatureMap.Entry extensionElementEntry = new SimpleFeatureMapEntry(
                        (Internal) DroolsPackage.Literals.DOCUMENT_ROOT__ON_ENTRY_SCRIPT,
                        onEntryScript);
                element.getExtensionValues().get(0).getValue().add(extensionElementEntry);
            }
        }
    }
}
项目:kie-wb-common    文件:Bpmn2JsonUnmarshaller.java   
protected void applyOnExitActions(BaseElement element,
                                  Map<String, String> properties) {
    if (properties.get("onexitactions") != null && properties.get("onexitactions").length() > 0) {
        ScriptTypeListValue onExitActions = new ScriptTypeListTypeSerializer().parse(properties.get("onexitactions"));
        if (!onExitActions.isEmpty()) {
            ScriptTypeValue onExitAction = onExitActions.getValues().get(0);
            if (onExitAction.getScript() != null && !onExitAction.getScript().isEmpty()) {
                OnExitScriptType onExitScript = DroolsFactory.eINSTANCE.createOnExitScriptType();
                onExitScript.setScript(wrapInCDATABlock(onExitAction.getScript()));
                String scriptLanguage = Utils.getScriptLanguageFormat(onExitAction.getLanguage());
                if (scriptLanguage == null) {
                    //default to java
                    scriptLanguage = "http://www.java.com/java";
                }
                onExitScript.setScriptFormat(scriptLanguage);
                if (element.getExtensionValues() == null || element.getExtensionValues().size() < 1) {
                    ExtensionAttributeValue extensionElement = Bpmn2Factory.eINSTANCE.createExtensionAttributeValue();
                    element.getExtensionValues().add(extensionElement);
                }
                FeatureMap.Entry extensionElementEntry = new SimpleFeatureMapEntry(
                        (Internal) DroolsPackage.Literals.DOCUMENT_ROOT__ON_EXIT_SCRIPT,
                        onExitScript);
                element.getExtensionValues().get(0).getValue().add(extensionElementEntry);
            }
        }
    }
}
项目:kie-wb-common    文件:Bpmn2JsonUnmarshaller.java   
protected void applyGroupProperties(Group group,
                                    Map<String, String> properties) {
    if (properties.get("name") != null) {
        ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
        EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature(
                "http://www.jboss.org/drools",
                "categoryval",
                false,
                false);
        SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute,
                                                                         properties.get("name"));
        group.getAnyAttribute().add(extensionEntry);
    }
}
项目:kie-wb-common    文件:Bpmn2JsonUnmarshaller.java   
public void applyReceiveTaskProperties(ReceiveTask receiveTask,
                                       Map<String, String> properties) {
    if (properties.get("messageref") != null && properties.get("messageref").length() > 0) {
        ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
        EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature(
                "http://www.jboss.org/drools",
                "msgref",
                false,
                false);
        SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute,
                                                                         properties.get("messageref"));
        receiveTask.getAnyAttribute().add(extensionEntry);
    }
    receiveTask.setImplementation("Other");
}
项目:kie-wb-common    文件:Bpmn2JsonUnmarshaller.java   
public void applySendTaskProperties(SendTask sendTask,
                                    Map<String, String> properties) {
    if (properties.get("messageref") != null && properties.get("messageref").length() > 0) {
        ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
        EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature(
                "http://www.jboss.org/drools",
                "msgref",
                false,
                false);
        SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute,
                                                                         properties.get("messageref"));
        sendTask.getAnyAttribute().add(extensionEntry);
    }
    sendTask.setImplementation("Other");
}
项目:kie-wb-common    文件:Bpmn2JsonUnmarshaller.java   
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());
    }
}
项目:kie-wb-common    文件:Bpmn2JsonUnmarshaller.java   
public void updateEdgeColors(BPMNEdge edge) {
    List<String> eleColorsForEdge = _elementColors.get(edge.getBpmnElement().getId());
    if (eleColorsForEdge != null) {
        String backgroundColor = "";
        String borderColor = "";
        String fontColor = "";
        for (String edgeColor : eleColorsForEdge) {
            String[] shapeColorParts = edgeColor.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);
        edge.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);
        edge.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);
        edge.getBpmnElement().getAnyAttribute().add(extensionEntryColor);
    } else {
        _logger.debug("Unable to find color information for shape: " + edge.getBpmnElement().getId());
    }
}
项目:kie-wb-common    文件:Bpmn2JsonUnmarshaller.java   
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();
    defaultScenario.setId("default"); // single scenario suppoert
    defaultScenario.setName("Simulationscenario"); // single scenario support
    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);
}
项目:fixflow    文件:BpmnModelUtil.java   
/**
 * 增加擴展屬性
 * @param baseElement
 * @param eReference
 * @param o
 * @return
 */
public static boolean addExtensionAttribute(BaseElement baseElement,EAttribute eAttribute,Object o){
    final FeatureMap.Entry extensionElementEntry = new SimpleFeatureMapEntry((org.eclipse.emf.ecore.EStructuralFeature.Internal) eAttribute, o);
    baseElement.getAnyAttribute().add(extensionElementEntry);
    return false;
}