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")); } } }
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); }
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"); }
public FeatureMap.Entry.Internal getFeatureMapEntryPrototype() { if (prototypeFeatureMapEntry == null) { EReference eOpposite = getEOpposite(); if (eOpposite != null) { prototypeFeatureMapEntry = new InverseUpdatingFeatureMapEntry(this, null); } else if (isContainment()) { // create containment one. prototypeFeatureMapEntry = new ContainmentUpdatingFeatureMapEntry(this, null); } else if (ExtendedMetaData.INSTANCE.getFeatureKind(this) == ExtendedMetaData.SIMPLE_FEATURE) { prototypeFeatureMapEntry = new SimpleContentFeatureMapEntry(this); } else { prototypeFeatureMapEntry = new SimpleFeatureMapEntry(this, null); } } return prototypeFeatureMapEntry; }
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); } } } }
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); } }
public FeatureMap.Entry.Internal getFeatureMapEntryPrototype() { if (prototypeFeatureMapEntry == null) { EReference eOpposite = getEOpposite(); if (eOpposite != null) { prototypeFeatureMapEntry = new InverseUpdatingFeatureMapEntry(this, null); } else if (isContainment()) { // create containment one. prototypeFeatureMapEntry = new ContainmentUpdatingFeatureMapEntry(this, null); } else if (ExtendedMetaData.INSTANCE.getFeatureKind(this) == ExtendedMetaData.SIMPLE_FEATURE) { prototypeFeatureMapEntry = new SimpleContentFeatureMapEntry(this); } else { prototypeFeatureMapEntry = new SimpleFeatureMapEntry(this, null); } } return prototypeFeatureMapEntry; }
public Relationship getRelationship() { Relationship relationship = bpmn2.createRelationship(); relationship.setType(defaultRelationshipType); BPSimDataType simDataType = bpsim.createBPSimDataType(); // currently support single scenario Scenario defaultScenario = bpsim.createScenario(); ScenarioParameters scenarioParameters = bpsim.createScenarioParameters(); defaultScenario.setId("default"); // single scenario suppoert defaultScenario.setName("Simulationscenario"); // single scenario support defaultScenario.setScenarioParameters(scenarioParameters); simDataType.getScenario().add(defaultScenario); ExtensionAttributeValue extensionElement = bpmn2.createExtensionAttributeValue(); relationship.getExtensionValues().add(extensionElement); FeatureMap.Entry extensionElementEntry = new EStructuralFeatureImpl.SimpleFeatureMapEntry( (EStructuralFeature.Internal) BpsimPackage.Literals.DOCUMENT_ROOT__BP_SIM_DATA, simDataType); relationship.getExtensionValues().get(0).getValue().add(extensionElementEntry); defaultScenario.getElementParameters().addAll(simulationParameters); return relationship; } }
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. }
private void setSchemaLocation(Definitions definitions) { 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 " + "http://www.omg.org/spec/DD/20100524/DC DC.xsd " + "http://www.omg.org/spec/DD/20100524/DI DI.xsd "); definitions.getAnyAttribute().add(extensionEntry); }
public static void setMetaDataExtensionValue(BaseElement element, String metaDataName, String metaDataValue) { if (element != null) { MetaDataType eleMetadata = DroolsFactory.eINSTANCE.createMetaDataType(); eleMetadata.setName(metaDataName); eleMetadata.setMetaValue(metaDataValue); 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); } }
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"); }
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); } }
void setStringValue(BaseElement element, String value) { EAttributeImpl extensionAttribute = (EAttributeImpl) metaData.demandFeature( "http://www.jboss.org/drools", name, false, false); EStructuralFeatureImpl.SimpleFeatureMapEntry feature = new EStructuralFeatureImpl.SimpleFeatureMapEntry(extensionAttribute, value); element.getAnyAttribute().add(feature); }
private FeatureMap.Entry extensionOf(EReference eref, MetaDataType eleMetadata) { return new EStructuralFeatureImpl.SimpleFeatureMapEntry( (EStructuralFeature.Internal) eref, eleMetadata); }
@Override public Internal createEntry(Object value) { return new SimpleFeatureMapEntry ((EStructuralFeature.Internal)XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT, eFactory.convertToString(eDataType, value)); }
private static EStructuralFeatureImpl.SimpleFeatureMapEntry entryOf(EReference eref, Object script) { return new EStructuralFeatureImpl.SimpleFeatureMapEntry( (EStructuralFeature.Internal) eref, script); }
@Override public Internal createEntry(Object value) { return new SimpleFeatureMapEntry ((EStructuralFeature.Internal)XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT, eFactory.convertToString(eDataType, value)); }
@Override public Internal createEntry(Object value) { return new SimpleFeatureMapEntry(eStructuralFeature, value); }
@Override public Internal createEntry(Object value) { return new SimpleFeatureMapEntry(eStructuralFeature, value); }