inResource.getDefaultLoadOptions().put(XMLResource.OPTION_ENCODING, "UTF-8"); inResource.setEncoding("UTF-8"); DocumentRoot documentRoot = DroolsFactory.eINSTANCE.createDocumentRoot(); GlobalType root = DroolsFactory.eINSTANCE.createGlobalType(); root.setIdentifier("identifier"); root.setType("type");
inResource.getDefaultLoadOptions().put(XMLResource.OPTION_ENCODING, "UTF-8"); inResource.setEncoding("UTF-8"); DocumentRoot documentRoot = DroolsFactory.eINSTANCE.createDocumentRoot(); ImportType root = DroolsFactory.eINSTANCE.createImportType(); root.setName("import"); documentRoot.setImport(root);
inResource.getDefaultLoadOptions().put(XMLResource.OPTION_ENCODING, "UTF-8"); inResource.setEncoding("UTF-8"); DocumentRoot documentRoot = DroolsFactory.eINSTANCE.createDocumentRoot(); MetaDataType metadataType = DroolsFactory.eINSTANCE.createMetaDataType(); metadataType.setName("testvalue"); metadataType.setMetaValue("testentry");
inResource.getDefaultLoadOptions().put(XMLResource.OPTION_ENCODING, "UTF-8"); inResource.setEncoding("UTF-8"); DocumentRoot documentRoot = DroolsFactory.eINSTANCE.createDocumentRoot(); OnExitScriptType root = DroolsFactory.eINSTANCE.createOnExitScriptType(); root.setScript("script"); root.setScriptFormat("format");
inResource.getDefaultLoadOptions().put(XMLResource.OPTION_ENCODING, "UTF-8"); inResource.setEncoding("UTF-8"); DocumentRoot documentRoot = DroolsFactory.eINSTANCE.createDocumentRoot(); OnEntryScriptType root = DroolsFactory.eINSTANCE.createOnEntryScriptType(); root.setScript("script"); root.setScriptFormat("format");
ImportType importType = DroolsFactory.eINSTANCE.createImportType(); importType.setName(importParts[0]); if (process.getExtensionValues() == null || process.getExtensionValues().size() < 1) { ImportType importType = DroolsFactory.eINSTANCE.createImportType(); importType.setName(importStr); if (process.getExtensionValues() == null || process.getExtensionValues().size() < 1) { String[] globalParts = globalStr.split(":\\s*"); // identifier:type if (globalParts.length == 2) { GlobalType globalType = DroolsFactory.eINSTANCE.createGlobalType(); globalType.setIdentifier(globalParts[0]); globalType.setType(globalParts[1]); process.getExtensionValues().get(0).getValue().add(extensionElementEntry); } else if (globalParts.length == 1) { GlobalType globalType = DroolsFactory.eINSTANCE.createGlobalType(); globalType.setIdentifier(globalParts[0]); globalType.setType("Object");
private MetaDataType metaDataOf(String value) { MetaDataType eleMetadata = DroolsFactory.eINSTANCE.createMetaDataType(); eleMetadata.setName(name); eleMetadata.setMetaValue(asCData(value)); return eleMetadata; }
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 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); } } } }
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 static void setOnEntryAction(FlowElement flowElement, OnEntryAction onEntryAction) { ScriptTypeListValue value = onEntryAction.getValue(); for (ScriptTypeValue scriptTypeValue : value.getValues()) { String scriptText = scriptTypeValue.getScript(); if (scriptText == null || scriptText.isEmpty()) { continue; } OnEntryScriptType script = droolsFactory.createOnEntryScriptType(); script.setScript(asCData(scriptTypeValue.getScript())); String scriptLanguage = Scripts.scriptLanguageToUri(scriptTypeValue.getLanguage()); script.setScriptFormat(scriptLanguage); addExtensionValue(flowElement, DOCUMENT_ROOT__ON_ENTRY_SCRIPT, script); } }
public static void setOnExitAction(FlowElement flowElement, OnExitAction onExitAction) { ScriptTypeListValue value = onExitAction.getValue(); for (ScriptTypeValue scriptTypeValue : value.getValues()) { String scriptText = scriptTypeValue.getScript(); if (scriptText == null || scriptText.isEmpty()) { continue; } OnExitScriptType script = droolsFactory.createOnExitScriptType(); script.setScript(asCData(scriptText)); String scriptLanguage = Scripts.scriptLanguageToUri(scriptTypeValue.getLanguage()); script.setScriptFormat(scriptLanguage); addExtensionValue(flowElement, DOCUMENT_ROOT__ON_EXIT_SCRIPT, script); } }