From 5f0ec1c2d95c377fbec428f11464e93fe442b5ef Mon Sep 17 00:00:00 2001 From: "a.sreekumar" Date: Tue, 29 Jun 2021 13:57:14 +0100 Subject: Cleanup input & outputFields from Task definition 1) Remove the usage of inputField and outputField from Task definition. 2) Fix issues around populating events to task in case of State Finalizer Logic. Change-Id: Ief17f400729410b83c6b7c665980d443e0cf6f28 Issue-ID: POLICY-3336 Signed-off-by: a.sreekumar --- .../clicodegen/CodeGeneratorCliEditorTest.java | 52 +- .../src/main/resources/etc/editor/Commands.json | 4850 ++++++++++---------- .../CommandLineEditorEventsContextTest.java | 9 +- .../clieditor/tosca/ApexCliToscaEditorTest.java | 5 +- .../apex/auth/clieditor/utils/CliUtilsTest.java | 3 +- .../src/test/resources/tosca/PolicyModel.json | 206 - .../resources/tosca/ToscaPolicyOutput_compare.json | 2 +- .../core/engine/engine/impl/ApexEngineImpl.java | 45 +- .../core/engine/executor/TaskExecutorTest.java | 2 - .../engine/executor/context/AxTaskFacadeTest.java | 3 - .../aadm/model/AadmDomainModelFactory.java | 39 +- .../adaptive/model/AdaptiveDomainModelFactory.java | 33 +- .../policy/apex/model/modelapi/ApexEditorApi.java | 61 +- .../apex/model/modelapi/impl/ApexModelImpl.java | 48 +- .../apex/model/modelapi/impl/PolicyFacade.java | 17 +- .../apex/model/modelapi/impl/TaskFacade.java | 276 +- .../apex/model/modelapi/ApexEditorApiTaskTest.java | 122 +- .../src/test/resources/models/PolicyModel.xml | 64 - .../model/policymodel/concepts/AxPolicyModel.java | 39 - .../apex/model/policymodel/concepts/AxTask.java | 165 +- .../model/policymodel/handling/PolicyAnalyser.java | 10 - .../policymodel/concepts/PolicyModelTest.java | 38 - .../apex/model/policymodel/concepts/TasksTest.java | 61 +- .../policymodel/handling/ApexPolicyModelTest.java | 15 +- .../policymodel/handling/PolicyAnalyserTest.java | 5 +- .../handling/SupportApexPolicyModelCreator.java | 58 - ...PolicyModelComparisonDifferentVerboseValues.txt | 2 +- ...PolicyModelComparisonIdenticalVerboseValues.txt | 3 +- .../javascript/JavascriptTaskExecutorTest.java | 7 +- .../common/model/EvalDomainModelFactory.java | 15 +- .../common/model/SampleDomainModelFactory.java | 37 +- .../tools/model/generator/model2cli/Model2Cli.java | 49 +- 32 files changed, 2540 insertions(+), 3801 deletions(-) diff --git a/auth/cli-codegen/src/test/java/org/onap/policy/apex/auth/clicodegen/CodeGeneratorCliEditorTest.java b/auth/cli-codegen/src/test/java/org/onap/policy/apex/auth/clicodegen/CodeGeneratorCliEditorTest.java index cec261c2a..d6cf1686b 100644 --- a/auth/cli-codegen/src/test/java/org/onap/policy/apex/auth/clicodegen/CodeGeneratorCliEditorTest.java +++ b/auth/cli-codegen/src/test/java/org/onap/policy/apex/auth/clicodegen/CodeGeneratorCliEditorTest.java @@ -107,17 +107,13 @@ public class CodeGeneratorCliEditorTest { // 2: tasks for (final AxTask t : policyModel.getTasks().getTaskMap().values()) { final AxArtifactKey key = t.getKey(); - final List infields = getInfieldsForTask(codeGen, t); - final List outfields = getOutfieldsForTask(codeGen, t); final ST logic = getLogicForTask(codeGen, t); final List parameters = getParametersForTask(codeGen, t); final List contextRefs = getCtxtRefsForTask(codeGen, t); - codeGen.addTaskDeclaration( - new TaskDeclarationBuilder().setName(kig.getName(key)).setVersion(kig.getVersion(key)) - .setUuid(kig.getUuid(key)).setDescription(kig.getDesc(key)).setInfields(infields) - .setOutfields(outfields).setLogic(logic).setParameters(parameters) - .setContextRefs(contextRefs)); + codeGen.addTaskDeclaration(new TaskDeclarationBuilder().setName(kig.getName(key)) + .setVersion(kig.getVersion(key)).setUuid(kig.getUuid(key)).setDescription(kig.getDesc(key)) + .setLogic(logic).setParameters(parameters).setContextRefs(contextRefs)); } // 3: events @@ -247,48 +243,6 @@ public class CodeGeneratorCliEditorTest { return cg.createTaskDefLogic(kig.getName(tkey), kig.getVersion(tkey), tl.getLogicFlavour(), tl.getLogic()); } - /** - * Gets the output fields for task. - * - * @param cg the code generator - * @param task the task - * @return the output fields for task - */ - private List getOutfieldsForTask(final CodeGeneratorCliEditor cg, final AxTask task) { - final Collection fields = task.getOutputFields().values(); - final List ret = new ArrayList<>(fields.size()); - for (final AxField f : fields) { - final AxReferenceKey fkey = f.getKey(); - - final ST val = cg.createTaskDefinitionOutfields(kig.getPName(fkey), kig.getPVersion(fkey), - kig.getLName(fkey), kig.getName(f.getSchema()), kig.getVersion(f.getSchema())); - - ret.add(val); - } - return ret; - } - - /** - * Gets the input fields for task. - * - * @param cg the code generator - * @param task the task - * @return the input fields for task - */ - private List getInfieldsForTask(final CodeGeneratorCliEditor cg, final AxTask task) { - final Collection fields = task.getInputFields().values(); - final List ret = new ArrayList<>(fields.size()); - for (final AxField f : fields) { - final AxReferenceKey fkey = f.getKey(); - - final ST val = cg.createTaskDefinitionInfields(kig.getPName(fkey), kig.getPVersion(fkey), - kig.getLName(fkey), kig.getName(f.getSchema()), kig.getVersion(f.getSchema())); - - ret.add(val); - } - return ret; - } - /** * Gets the states for policy. * diff --git a/auth/cli-editor/src/main/resources/etc/editor/Commands.json b/auth/cli-editor/src/main/resources/etc/editor/Commands.json index fd5a77557..7136922a8 100644 --- a/auth/cli-editor/src/main/resources/etc/editor/Commands.json +++ b/auth/cli-editor/src/main/resources/etc/editor/Commands.json @@ -1,2427 +1,2427 @@ { - "commandList": [ - { - "name": "quit", - "keywordlist": [ - "quit" - ], - "argumentList": [], - "systemCommand": "true", - "description": "quit execution of command handling, this command quits immediately without saving the model" - }, - { - "name": "back", - "keywordlist": [ - "back" - ], - "argumentList": [], - "systemCommand": "true", - "description": "go back one level in editor context hierarchy" - }, - { - "name": "help", - "keywordlist": [ - "help" - ], - "argumentList": [], - "systemCommand": "true", - "description": "output help information appropriate to this point in the editor context hierarchy" - }, - { - "name": "load", - "keywordlist": [ - "load" - ], - "argumentList": [ - { - "argumentName": "fileName", - "nullable": false, - "description": "Name of a file containing an Apex model in JSON or XML format" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexModel.loadFromFile", - "description": "Load an Apex model from a file" - }, - { - "name": "save", - "keywordlist": [ - "save" - ], - "argumentList": [ - { - "argumentName": "fileName", - "nullable": true, - "description": "Name of the file to save the model to" - }, - { - "argumentName": "xmlFlag", - "nullable": true, - "description": "Flag indicating that the model should be saved in XML format, model saved in JSON format if flag is false or is not specified" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexModel.saveToFile", - "description": "Save an Apex model to a file" - }, - { - "name": "analyse", - "keywordlist": [ - "analyse" - ], - "argumentList": [], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexModel.analyse", - "description": "Analyse an Apex model to show concept usage" - }, - { - "name": "validate", - "keywordlist": [ - "validate" - ], - "argumentList": [], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexModel.validate", - "description": "Validate the entire Apex model to ensure it is consistent" - }, - { - "name": "compare", - "keywordlist": [ - "compare" - ], - "argumentList": [ - { - "argumentName": "otherModelFileName", - "nullable": false, - "description": "The file name of the other model" - }, - { - "argumentName": "diffsOnly", - "nullable": true, - "description": "Flag indicating that only differences between the model are returned when set" - }, - { - "argumentName": "keysOnly", - "nullable": true, - "description": "Flag indicating that only keys are printed when set, more terse output" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexModel.compare", - "description": "Compare an Apex model with another Apex model" - }, - { - "name": "split", - "keywordlist": [ - "split" - ], - "argumentList": [ - { - "argumentName": "targetModelName", - "nullable": false, - "description": "the file name of the target model in which to store the model split out from the original model" - }, - { - "argumentName": "splitOutPolicies", - "nullable": "false", - "description": "the policies form the original model to include in the split out model, specified as a comma delimited list of policy names" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexModel.split", - "description": "Split an Apex model into a separate Apex model with only the specified policies" - }, - { - "name": "merge", - "keywordlist": [ - "merge" - ], - "argumentList": [ - { - "argumentName": "mergeInModelName", - "nullable": false, - "description": "the file name of the model to merge into the current model" - }, - { - "argumentName": "keepOriginal", - "nullable": "true", - "description": "if true, if a concept exists in both models, the original model copy of that concept is kept, if false, the mreged model overwrites" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexModel.merge", - "description": "Merge another Apex model into this model" - }, - { - "name": "createModel", - "keywordlist": [ - "model", - "create" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the model" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the model, omit to use the default version" - }, - { - "argumentName": "uuid", - "nullable": true, - "description": "model UUID, omit to generate a UUID" - }, - { - "argumentName": "description", - "nullable": true, - "description": "model description, omit to generate a description" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createModel", - "description": "Create an Apex model." - }, - { - "name": "listModel", - "keywordlist": [ - "model", - "list" - ], - "argumentList": [], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listModel", - "description": "List an Apex model, list all the concepts in the model" - }, - { - "name": "deleteModel", - "keywordlist": [ - "model", - "delete" - ], - "argumentList": [], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteModel", - "description": "Delete an Apex model, clear all the concepts in the model" - }, - { - "name": "createKeyInformation", - "keywordlist": [ - "keyinfo", - "create" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the concept for the key information" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the concept for the key information, omit to use the default version" - }, - { - "argumentName": "uuid", - "nullable": true, - "description": "key information UUID, set to null to generate a UUID" - }, - { - "argumentName": "description", - "nullable": true, - "description": "concept description, omit to generate a description" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createKeyInformation", - "description": "Create key information" - }, - { - "name": "updateKeyInformation", - "keywordlist": [ - "keyinfo", - "update" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the concept for the key information" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the concept for the key information, omit to update the latest version" - }, - { - "argumentName": "uuid", - "nullable": true, - "description": "key information UUID, omit to not update" - }, - { - "argumentName": "description", - "nullable": true, - "description": "concept description, omit to not update" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.updateKeyInformation", - "description": "Update key information" - }, - { - "name": "listKeyInformation", - "keywordlist": [ - "keyinfo", - "list" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": true, - "description": "name of the concept for the key information, omit to list all" - }, - { - "argumentName": "version", - "nullable": true, - "description": "starting version of the concept for the key information, omit to list all versions" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.ListKeyInformation", - "description": "List key information" - }, - { - "name": "deleteKeyInformation", - "keywordlist": [ - "keyinfo", - "delete" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": true, - "description": "name of the concept for the key information" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the concept for the key information, omit to delete all versions" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteKeyInformation", - "description": "Delete key information" - }, - { - "name": "validateKeyInformation", - "keywordlist": [ - "keyinfo", - "validate" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": true, - "description": "name of the concept for the key information" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the concept for the key information, omit to validate all versions" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.validateKeyInformation", - "description": "Validate key information" - }, - { - "name": "createSchema", - "keywordlist": [ - "schema", - "create" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the schema" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the schema, omit to use the default version" - }, - { - "argumentName": "flavour", - "nullable": true, - "description": "the flavour of the technology for this schema, defaults to \"Java\"" - }, - { - "argumentName": "schema", - "nullable": false, - "description": "the schema text that describes the item represented by the schema" - }, - { - "argumentName": "uuid", - "nullable": true, - "description": "schema UUID, omit to generate a UUID" - }, - { - "argumentName": "description", - "nullable": true, - "description": "schema description, omit to generate a description" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createContextSchema", - "description": "Create a schema." - }, - { - "name": "updateSchema", - "keywordlist": [ - "schema", - "update" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the schema" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the schema, omit to use the default version" - }, - { - "argumentName": "flavour", - "nullable": true, - "description": "the flavour of the technology for this schema, defaults to \"Java\"" - }, - { - "argumentName": "schema", - "nullable": false, - "description": "the schema text that describes the item represented by the schema" - }, - { - "argumentName": "uuid", - "nullable": true, - "description": "schema UUID, omit to generate a UUID" - }, - { - "argumentName": "description", - "nullable": true, - "description": "schema description, omit to generate a description" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.updateContextSchema", - "description": "Update a schema." - }, - { - "name": "listSchemas", - "keywordlist": [ - "schema", - "list" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": true, - "description": "name of the schema, omit to list all" - }, - { - "argumentName": "version", - "nullable": true, - "description": "starting version of the schema, omit to list all versions" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listContextSchemas", - "description": "List schemas." - }, - { - "name": "deleteSchema", - "keywordlist": [ - "schema", - "delete" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": true, - "description": "name of the schema" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the schema, omit to delete all versions" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteContextSchema", - "description": "Delete a schema." - }, - { - "name": "validateSchemas", - "keywordlist": [ - "schema", - "validate" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": true, - "description": "name of the schema, omit to list all" - }, - { - "argumentName": "version", - "nullable": true, - "description": "starting version of the schema, omit to list all versions" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.validateContextSchemas", - "description": "Validate context schemas." - }, - { - "name": "createEvent", - "keywordlist": [ - "event", - "create" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the event" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the event, omit to use the default version" - }, - { - "argumentName": "nameSpace", - "nullable": true, - "description": "of the event, omit to use the default value" - }, - { - "argumentName": "source", - "nullable": true, - "description": "of the event, omit to use the default value" - }, - { - "argumentName": "target", - "nullable": true, - "description": "of the event, omit to use the default value" - }, - { - "argumentName": "uuid", - "nullable": true, - "description": "event UUID, omit to generate a UUID" - }, - { - "argumentName": "description", - "nullable": true, - "description": "event description, omit to generate a description" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createEvent", - "description": "Create an event." - }, - { - "name": "updateEvent", - "keywordlist": [ - "event", - "update" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the event" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the event, omit to use the latest version" - }, - { - "argumentName": "nameSpace", - "nullable": true, - "description": "of the event, omit to not update" - }, - { - "argumentName": "source", - "nullable": true, - "description": "of the event, omit to not update" - }, - { - "argumentName": "target", - "nullable": true, - "description": "of the event, omit to not update" - }, - { - "argumentName": "uuid", - "nullable": true, - "description": "event UUID, omit to not update" - }, - { - "argumentName": "description", - "nullable": true, - "description": "event description, omit to not update" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.updateEvent", - "description": "Update an event." - }, - { - "name": "listEvent", - "keywordlist": [ - "event", - "list" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": true, - "description": "name of the event, omit to list all" - }, - { - "argumentName": "version", - "nullable": true, - "description": "starting version of the event, omit to list all versions" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listEvent", - "description": "List events." - }, - { - "name": "deleteEvent", - "keywordlist": [ - "event", - "delete" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the event" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the event, omit to delete all versions" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteEvent", - "description": "Delete an event." - }, - { - "name": "validateEvent", - "keywordlist": [ - "event", - "validate" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": true, - "description": "name of the event, omit to list all" - }, - { - "argumentName": "version", - "nullable": true, - "description": "starting version of the event, omit to list all versions" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.validateEvent", - "description": "Validate events." - }, - { - "name": "createEventPar", - "keywordlist": [ - "event", - "parameter", - "create" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the event" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the event, omit to use the latest version" - }, - { - "argumentName": "parName", - "nullable": false, - "description": "of the parameter" - }, - { - "argumentName": "schemaName", - "nullable": false, - "description": "name of the parameter schema" - }, - { - "argumentName": "schemaVersion", - "nullable": true, - "description": "version of the parameter schema, omit to use the latest version" - }, - { - "argumentName": "optional", - "nullable": true, - "description": "indicates if the parameter is optional, if omitted, the parameter is mandatory" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createEventPar", - "description": "Create an event parameter." - }, - { - "name": "listEventPar", - "keywordlist": [ - "event", - "parameter", - "list" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the event" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the event, omit to list latest version" - }, - { - "argumentName": "parName", - "nullable": true, - "description": "name of the parameter, omit to list all parameters of the event" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listEventPar", - "description": "List event parameters." - }, - { - "name": "deleteEventPar", - "keywordlist": [ - "event", - "parameter", - "delete" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the event" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the event, omit to use the latest version" - }, - { - "argumentName": "parName", - "nullable": true, - "description": "of the parameter, omit to delete all parameters" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteEventPar", - "description": "Delete an event parameter." - }, - { - "name": "createAlbum", - "keywordlist": [ - "album", - "create" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the context album" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the context album, omit to use the default version" - }, - { - "argumentName": "scope", - "nullable": false, - "description": "scope of application of the context album" - }, - { - "argumentName": "writable", - "nullable": false, - "description": "true if the album is writable, false otherwise, album defaults to writable if omitted" - }, - { - "argumentName": "schemaName", - "nullable": false, - "description": "name of the album schema" - }, - { - "argumentName": "schemaVersion", - "nullable": true, - "description": "version of the album schema, omit to use the latest version" - }, - { - "argumentName": "uuid", - "nullable": true, - "description": "context album UUID, omit to generate a UUID" - }, - { - "argumentName": "description", - "nullable": true, - "description": "album description, omit to generate a description" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createContextAlbum", - "description": "Create a context album." - }, - { - "name": "updateAlbum", - "keywordlist": [ - "album", - "update" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the context album" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the context album, omit to use the latest version" - }, - { - "argumentName": "scope", - "nullable": false, - "description": "scope of application of the context album" - }, - { - "argumentName": "writable", - "nullable": false, - "description": "true if the album is writable, false otherwise, album defaults to writable if omitted" - }, - { - "argumentName": "schemaName", - "nullable": false, - "description": "name of the album schema" - }, - { - "argumentName": "schemaVersion", - "nullable": true, - "description": "version of the album schema, omit to use the latest version" - }, - { - "argumentName": "uuid", - "nullable": true, - "description": "context album UUID, omit to not update" - }, - { - "argumentName": "description", - "nullable": true, - "description": "album description, omit to not update" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.updateContextAlbum", - "description": "Update a context album." - }, - { - "name": "listAlbum", - "keywordlist": [ - "album", - "list" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": true, - "description": "name of the context album, omit to list all" - }, - { - "argumentName": "version", - "nullable": true, - "description": "starting version of the context album, omit to list all versions" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listContextAlbum", - "description": "List context albums." - }, - { - "name": "deleteAlbum", - "keywordlist": [ - "album", - "delete" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the context album" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the context album, omit to delete versions" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteContextAlbum", - "description": "Delete a context album." - }, - { - "name": "validateAlbum", - "keywordlist": [ - "album", - "validate" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": true, - "description": "name of the context album, omit to list all" - }, - { - "argumentName": "version", - "nullable": true, - "description": "starting version of the context album, omit to list all versions" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.validateContextAlbum", - "description": "Validate context albums." - }, - { - "name": "createTask", - "keywordlist": [ - "task", - "create" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the task" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the task, omit to use the default version" - }, - { - "argumentName": "uuid", - "nullable": true, - "description": "task UUID, omit to generate a UUID" - }, - { - "argumentName": "description", - "nullable": true, - "description": "task description, omit to generate a description" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createTask", - "description": "Create a task." - }, - { - "name": "updateTask", - "keywordlist": [ - "task", - "update" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the task" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the task, omit to use the latest version" - }, - { - "argumentName": "uuid", - "nullable": true, - "description": "task UUID, omit to not update" - }, - { - "argumentName": "description", - "nullable": true, - "description": "task description, omit to not update" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.updateTask", - "description": "Update a task." - }, - { - "name": "listTask", - "keywordlist": [ - "task", - "list" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": true, - "description": "name of the task, omit to list all" - }, - { - "argumentName": "version", - "nullable": true, - "description": "starting version of the task, omit to list all versions" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listTask", - "description": "List tasks." - }, - { - "name": "deleteTask", - "keywordlist": [ - "task", - "delete" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the task" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the task, omit to use the latest version" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteTask", - "description": "Delete a task." - }, - { - "name": "validateTask", - "keywordlist": [ - "task", - "validate" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": true, - "description": "name of the task, omit to list all" - }, - { - "argumentName": "version", - "nullable": true, - "description": "starting version of the task, omit to list all versions" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.validateTask", - "description": "Validate tasks." - }, - { - "name": "createTaskLogic", - "keywordlist": [ - "task", - "logic", - "create" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the task" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the task, omit to use the latest version" - }, - { - "argumentName": "logicFlavour", - "nullable": true, - "description": "the task logic flavour for the task, omit to use the default task logic flavour" - }, - { - "argumentName": "logic", - "nullable": false, - "description": "the source code for the logic of the task" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createTaskLogic", - "description": "Create logic for a task." - }, - { - "name": "updateTaskLogic", - "keywordlist": [ - "task", - "logic", - "update" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the task" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the task, omit to use the latest version" - }, - { - "argumentName": "logicFlavour", - "nullable": true, - "description": "the task logic flavour for the task, omit to not update" - }, - { - "argumentName": "logic", - "nullable": true, - "description": "the source code for the logic of the task, omit to not update" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.updateTaskLogic", - "description": "Update logic for a task." - }, - { - "name": "listTaskLogic", - "keywordlist": [ - "task", - "logic", - "list" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the task" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the task, omit to list the latest version" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listTaskLogic", - "description": "List task logic." - }, - { - "name": "deleteTaskLogic", - "keywordlist": [ - "task", - "logic", - "delete" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the task" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the task, omit to use the latest version" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteTaskLogic", - "description": "Delete logic for a task." - }, - { - "name": "createTaskInputField", - "keywordlist": [ - "task", - "inputfield", - "create" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the task" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the task, omit to use the latest version" - }, - { - "argumentName": "fieldName", - "nullable": false, - "description": "of the input field" - }, - { - "argumentName": "schemaName", - "nullable": false, - "description": "name of the input field schema" - }, - { - "argumentName": "schemaVersion", - "nullable": true, - "description": "version of the input field schema, omit to use the latest version" - }, - { - "argumentName": "optional", - "nullable": true, - "description": "indicates if the field is optional, if omitted, the field is mandatory" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createTaskInputField", - "description": "Create a task input field." - }, - { - "name": "listTaskInputField", - "keywordlist": [ - "task", - "inputfield", - "list" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the task" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the task, omit to use the latest version" - }, - { - "argumentName": "fieldName", - "nullable": true, - "description": "field name of the input field, omit to list all input fields of the task" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listTaskInputField", - "description": "List task input fields." - }, - { - "name": "deleteTaskInputField", - "keywordlist": [ - "task", - "inputfield", - "delete" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the task" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the task, omit to use the latest version" - }, - { - "argumentName": "fieldName", - "nullable": true, - "description": "of the input field, omit to delete all input fields" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteTaskInputField", - "description": "Delete a task input field." - }, - { - "name": "createTaskOutputField", - "keywordlist": [ - "task", - "outputfield", - "create" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the task" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the task, omit to use the latest version" - }, - { - "argumentName": "fieldName", - "nullable": false, - "description": "of the output field" - }, - { - "argumentName": "schemaName", - "nullable": false, - "description": "name of the output field schema" - }, - { - "argumentName": "schemaVersion", - "nullable": true, - "description": "version of the output field schema, omit to use the latest version" - }, - { - "argumentName": "optional", - "nullable": true, - "description": "indicates if the field is optional, if omitted, the field is mandatory" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createTaskOutputField", - "description": "Create a task output field." - }, - { - "name": "listTaskOutputField", - "keywordlist": [ - "task", - "outputfield", - "list" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the task" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the task, omit to use the latest version" - }, - { - "argumentName": "fieldName", - "nullable": true, - "description": "field name of the output field, omit to list all output fields of the task" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listTaskOutputField", - "description": "List task output fields." - }, - { - "name": "deleteTaskOutputField", - "keywordlist": [ - "task", - "outputfield", - "delete" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the task" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the task, omit to use the latest version" - }, - { - "argumentName": "fieldName", - "nullable": true, - "description": "of the output field, omit to delete all output fields" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteTaskOutputField", - "description": "Delete a task output field." - }, - { - "name": "createTaskParameter", - "keywordlist": [ - "task", - "parameter", - "create" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the task" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the task, omit to use the latest version" - }, - { - "argumentName": "parName", - "nullable": false, - "description": "of the parameter" - }, - { - "argumentName": "defaultValue", - "nullable": false, - "description": "of the parameter" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createTaskParameter", - "description": "Create a task parameter." - }, - { - "name": "listTaskParameter", - "keywordlist": [ - "task", - "parameter", - "list" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the task" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the task, omit to use the latest version" - }, - { - "argumentName": "parName", - "nullable": true, - "description": "name of the parameter, omit to list all parameters of the task" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listTaskParameter", - "description": "List task parameters." - }, - { - "name": "deleteTaskParameter", - "keywordlist": [ - "task", - "parameter", - "delete" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the task" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the task, omit to use the latest version" - }, - { - "argumentName": "parName", - "nullable": true, - "description": "of the parameter, omit to delete all task parameters" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteTaskParameter", - "description": "Delete a task parameter." - }, - { - "name": "createTaskContextRef", - "keywordlist": [ - "task", - "contextref", - "create" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the task" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the task, omit to use the latest version" - }, - { - "argumentName": "albumName", - "nullable": false, - "description": "name of the context album for the context reference" - }, - { - "argumentName": "albumVersion", - "nullable": true, - "description": "version of the context album for the context reference, omit to use the latest version" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createTaskContextRef", - "description": "Create a task context reference." - }, - { - "name": "listTaskContextRef", - "keywordlist": [ - "task", - "contextref", - "list" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the task" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the task, omit to use the latest version" - }, - { - "argumentName": "albumName", - "nullable": true, - "description": "name of the context album for the context reference, omit to list all task context references" - }, - { - "argumentName": "albumVersion", - "nullable": true, - "description": "version of the context album for the context reference, omit to use the latest version" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listTaskContextRef", - "description": "List task context references." - }, - { - "name": "deleteTaskContextRef", - "keywordlist": [ - "task", - "contextref", - "delete" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the task" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the task, omit to use the latest version" - }, - { - "argumentName": "albumName", - "nullable": true, - "description": "name of the context album for the context reference, omit to delete all task context references" - }, - { - "argumentName": "albumVersion", - "nullable": true, - "description": "version of the context album for the context reference, omit to use the latest version" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteTaskContextRef", - "description": "Delete a task context reference." - }, - { - "name": "createPolicy", - "keywordlist": [ - "policy", - "create" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the policy" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the policy, omit to use the default version" - }, - { - "argumentName": "template", - "nullable": true, - "description": "template used to create the policy, omit to use the default template" - }, - { - "argumentName": "firstState", - "nullable": false, - "description": "the first state of the policy" - }, - { - "argumentName": "uuid", - "nullable": true, - "description": "policy UUID, omit to generate a UUID" - }, - { - "argumentName": "description", - "nullable": true, - "description": "policy description, omit to generate a description" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createPolicy", - "description": "Create a policy." - }, - { - "name": "updatePolicy", - "keywordlist": [ - "policy", - "update" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the policy" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the policy, omit to use the latest version" - }, - { - "argumentName": "template", - "nullable": true, - "description": "template used to create the policy, omit to not update" - }, - { - "argumentName": "firstState", - "nullable": false, - "description": "the first state of the policy" - }, - { - "argumentName": "uuid", - "nullable": true, - "description": "policy UUID, omit to not update" - }, - { - "argumentName": "description", - "nullable": true, - "description": "policy description, omit to not update" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.updatePolicy", - "description": "Update a policy." - }, - { - "name": "listPolicy", - "keywordlist": [ - "policy", - "list" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": true, - "description": "name of the policy, omit to list all" - }, - { - "argumentName": "version", - "nullable": true, - "description": "starting version of the policy, omit to list all versions" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listPolicy", - "description": "List policies." - }, - { - "name": "deletePolicy", - "keywordlist": [ - "policy", - "delete" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the policy" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the policy, omit to use the latest version" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deletePolicy", - "description": "Delete a policy." - }, - { - "name": "validatePolicy", - "keywordlist": [ - "policy", - "validate" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": true, - "description": "name of the policy, omit to list all" - }, - { - "argumentName": "version", - "nullable": true, - "description": "starting version of the policy, omit to list all versions" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.validatePolicy", - "description": "Validate policies." - }, - { - "name": "createPolicyState", - "keywordlist": [ - "policy", - "state", - "create" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the policy" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the policy, omit to use the latest version" - }, - { - "argumentName": "stateName", - "nullable": false, - "description": "of the state" - }, - { - "argumentName": "triggerName", - "nullable": false, - "description": "name of the trigger event for this state" - }, - { - "argumentName": "triggerVersion", - "nullable": true, - "description": "version of the trigger event for this state, omit to use the latest version" - }, - { - "argumentName": "defaultTaskName", - "nullable": false, - "description": "the default task name" - }, - { - "argumentName": "defaultTaskVersion", - "nullable": true, - "description": "the default task version, omit to use the latest version" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createPolicyState", - "description": "Create a policy state." - }, - { - "name": "updatePolicyState", - "keywordlist": [ - "policy", - "state", - "update" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the policy" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the policy, omit to use the latest version" - }, - { - "argumentName": "stateName", - "nullable": false, - "description": "of the state" - }, - { - "argumentName": "triggerName", - "nullable": true, - "description": "name of the trigger event for this state, omit to not update" - }, - { - "argumentName": "triggerVersion", - "nullable": false, - "description": "version of the trigger event for this state, set to use latest version of trigger event" - }, - { - "argumentName": "defaultTaskName", - "nullable": true, - "description": "the default task name, omit to not update" - }, - { - "argumentName": "defaultTaskVersion", - "nullable": false, - "description": "the default task version, set to use latest version of default task" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.updatePolicyState", - "description": "Update a policy state." - }, - { - "name": "listPolicyState", - "keywordlist": [ - "policy", - "state", - "list" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the policy" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the policy, omit to use the latest version" - }, - { - "argumentName": "stateName", - "nullable": true, - "description": "of the state, omit to list all states of the policy" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listPolicyState", - "description": "List policy states." - }, - { - "name": "deletePolicyState", - "keywordlist": [ - "policy", - "state", - "delete" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the policy" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the policy, omit to use the latest version" - }, - { - "argumentName": "stateName", - "nullable": true, - "description": "of the state, omit to delete all states" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deletePolicyState", - "description": "Delete a policy state." - }, - { - "name": "createPolicyStateTaskSelectionLogic", - "keywordlist": [ - "policy", - "state", - "selecttasklogic", - "create" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the policy" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the policy, omit to use the latest version" - }, - { - "argumentName": "stateName", - "nullable": false, - "description": "of the state" - }, - { - "argumentName": "logicFlavour", - "nullable": true, - "description": "the task selection logic flavour for the state, omit to use the default task logic flavour" - }, - { - "argumentName": "logic", - "nullable": false, - "description": "the source code for the logic of the state" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createPolicyStateTaskSelectionLogic", - "description": "Create task selection logic for a state." - }, - { - "name": "updatePolicyStateTaskSelectionLogic", - "keywordlist": [ - "policy", - "state", - "selecttasklogic", - "update" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the policy" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the policy, omit to use the latest version" - }, - { - "argumentName": "stateName", - "nullable": false, - "description": "of the state" - }, - { - "argumentName": "logicFlavour", - "nullable": true, - "description": "the task selection logic flavour for the state, omit to not update" - }, - { - "argumentName": "logic", - "nullable": true, - "description": "the source code for the logic of the state, omit to not update" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.updatePolicyStateTaskSelectionLogic", - "description": "Update task selection logic for a state." - }, - { - "name": "listPolicyStateTaskSelectionLogic", - "keywordlist": [ - "policy", - "state", - "selecttasklogic", - "list" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the policy" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the policy, omit to use the latest version" - }, - { - "argumentName": "stateName", - "nullable": false, - "description": "of the state" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listPolicyStateTaskSelectionLogic", - "description": "List task selection logic for a state." - }, - { - "name": "deletePolicyStateTaskSelectionLogic", - "keywordlist": [ - "policy", - "state", - "selecttasklogic", - "delete" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the policy" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the policy, omit to use the latest version" - }, - { - "argumentName": "stateName", - "nullable": false, - "description": "of the state" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deletePolicyStateTaskSelectionLogic", - "description": "Delete task selection logic for a state." - }, - { - "name": "createPolicyStateOutput", - "keywordlist": [ - "policy", - "state", - "output", - "create" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the policy" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the policy, omit to use the latest version" - }, - { - "argumentName": "stateName", - "nullable": false, - "description": "of the state" - }, - { - "argumentName": "outputName", - "nullable": false, - "description": "of the state output" - }, - { - "argumentName": "eventName", - "nullable": false, - "description": "name of the output event for this state output" - }, - { - "argumentName": "eventVersion", - "nullable": true, - "description": "version of the output event for this state output, omit to use the latest version" - }, - { - "argumentName": "nextState", - "nullable": true, - "description": "for this state to transition to, omit if this is the last state that the policy transitions to on this branch" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createPolicyStateOutput", - "description": "Create a policy state output." - }, - { - "name": "listPolicyStateOutput", - "keywordlist": [ - "policy", - "state", - "output", - "list" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the policy" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the policy, omit to use the latest version" - }, - { - "argumentName": "stateName", - "nullable": false, - "description": "of the state" - }, - { - "argumentName": "outputName", - "nullable": true, - "description": "of the state output, omit to list all outputs of the state" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listPolicyStateOutput", - "description": "List policy state outputs." - }, - { - "name": "deletePolicyStateOutput", - "keywordlist": [ - "policy", - "state", - "output", - "delete" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the policy" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the policy, omit to use the latest version" - }, - { - "argumentName": "stateName", - "nullable": false, - "description": "of the state" - }, - { - "argumentName": "outputName", - "nullable": true, - "description": "of the state output, omit to delete all state outputs" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deletePolicyStateOutput", - "description": "Delete a policy state output." - }, - { - "name": "createPolicyStateFinalizerLogic", - "keywordlist": [ - "policy", - "state", - "finalizerlogic", - "create" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the policy" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the policy, omit to use the latest version" - }, - { - "argumentName": "stateName", - "nullable": false, - "description": "of the state" - }, - { - "argumentName": "finalizerLogicName", - "nullable": false, - "description": "name of the state finalizer logic" - }, - { - "argumentName": "logicFlavour", - "nullable": true, - "description": "the policy finalizer logic flavour for the state, omit to use the default task logic flavour" - }, - { - "argumentName": "logic", - "nullable": false, - "description": "the source code for the logic of the state" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createPolicyStateFinalizerLogic", - "description": "Create policy finalizer logic for a state." - }, - { - "name": "updatePolicyStateFinalizerLogic", - "keywordlist": [ - "policy", - "state", - "finalizerlogic", - "update" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the policy" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the policy, omit to use the latest version" - }, - { - "argumentName": "stateName", - "nullable": false, - "description": "of the state" - }, - { - "argumentName": "finalizerLogicName", - "nullable": false, - "description": "name of the state finalizer logic" - }, - { - "argumentName": "logicFlavour", - "nullable": true, - "description": "the policy finalizer logic flavour for the state, omit to not update" - }, - { - "argumentName": "logic", - "nullable": true, - "description": "the source code for the logic of the state, omit to not update" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.updatePolicyStateFinalizerLogic", - "description": "Update policy finalizer logic for a state." - }, - { - "name": "listPolicyStateFinalizerLogic", - "keywordlist": [ - "policy", - "state", - "finalizerlogic", - "list" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the policy" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the policy, omit to use the latest version" - }, - { - "argumentName": "stateName", - "nullable": false, - "description": "of the state" - }, - { - "argumentName": "finalizerLogicName", - "nullable": false, - "description": "name of the state finalizer logic" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listPolicyStateFinalizerLogic", - "description": "List policy finalizer logic for a state." - }, - { - "name": "deletePolicyStateFinalizerLogic", - "keywordlist": [ - "policy", - "state", - "finalizerlogic", - "delete" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the policy" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the policy, omit to use the latest version" - }, - { - "argumentName": "stateName", - "nullable": false, - "description": "of the state" - }, - { - "argumentName": "finalizerLogicName", - "nullable": false, - "description": "name of the state finalizer logic" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deletePolicyStateFinalizerLogic", - "description": "Delete policy finalizer logic for a state." - }, - { - "name": "createPolicyStateTaskRef", - "keywordlist": [ - "policy", - "state", - "taskref", - "create" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the policy" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the policy, omit to use the latest version" - }, - { - "argumentName": "stateName", - "nullable": false, - "description": "of the state" - }, - { - "argumentName": "taskLocalName", - "nullable": true, - "description": "local name of the task in the state, omit to use the task name" - }, - { - "argumentName": "taskName", - "nullable": false, - "description": "name of the task" - }, - { - "argumentName": "taskVersion", - "nullable": true, - "description": "version of the task, omit to use the latest version" - }, - { - "argumentName": "outputType", - "nullable": false, - "description": "Type of output for the task, must be DIRECT for direct output to a state output or LOGIC for output to state finalizer logic" - }, - { - "argumentName": "outputName", - "nullable": false, - "description": "the name of the state output or state state finalizer logic to handle the task output" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createPolicyStateTaskRef", - "description": "Create a policy state task reference." - }, - { - "name": "listPolicyStateTaskRef", - "keywordlist": [ - "policy", - "state", - "taskref", - "list" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the policy" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the policy, omit to use the latest version" - }, - { - "argumentName": "stateName", - "nullable": false, - "description": "of the state" - }, - { - "argumentName": "taskName", - "nullable": true, - "description": "name of the task, omit to list all task references" - }, - { - "argumentName": "taskVersion", - "nullable": true, - "description": "version of the task, omit to use the latest version" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listPolicyStateTaskRef", - "description": "List policy state task references." - }, - { - "name": "deletePolicyStateTaskRef", - "keywordlist": [ - "policy", - "state", - "taskref", - "delete" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the policy" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the policy, omit to use the latest version" - }, - { - "argumentName": "stateName", - "nullable": false, - "description": "of the state" - }, - { - "argumentName": "taskName", - "nullable": true, - "description": "name of the task, omit to delete all task references" - }, - { - "argumentName": "taskVersion", - "nullable": true, - "description": "version of the task, omit to use the latest version" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deletePolicyStateTaskRef", - "description": "Delete a policy state task reference." - }, - { - "name": "createPolicyStateContextRef", - "keywordlist": [ - "policy", - "state", - "contextref", - "create" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the policy" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the policy, omit to use the latest version" - }, - { - "argumentName": "stateName", - "nullable": false, - "description": "of the state" - }, - { - "argumentName": "albumName", - "nullable": false, - "description": "name of the context album for the context reference" - }, - { - "argumentName": "albumVersion", - "nullable": true, - "description": "version of the context album for the context reference, omit to use the latest version" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createPolicyStateContextRef", - "description": "Create a policy state context reference." - }, - { - "name": "listPolicyStateContextRef", - "keywordlist": [ - "policy", - "state", - "contextref", - "list" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the policy" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the policy, omit to use the latest version" - }, - { - "argumentName": "stateName", - "nullable": false, - "description": "of the state" - }, - { - "argumentName": "albumName", - "nullable": true, - "description": "name of the context album for the context reference, omit to list all task context references" - }, - { - "argumentName": "albumVersion", - "nullable": true, - "description": "version of the context album for the context reference, omit to use the latest version" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listPolicyStateContextRef", - "description": "List policy state context references." - }, - { - "name": "deletePolicyStateContextRef", - "keywordlist": [ - "policy", - "state", - "contextref", - "delete" - ], - "argumentList": [ - { - "argumentName": "name", - "nullable": false, - "description": "name of the policy" - }, - { - "argumentName": "version", - "nullable": true, - "description": "version of the policy, omit to use the default version" - }, - { - "argumentName": "stateName", - "nullable": false, - "description": "of the state" - }, - { - "argumentName": "albumName", - "nullable": true, - "description": "name of the context album for the context reference, omit to delete all task context references" - }, - { - "argumentName": "albumVersion", - "nullable": true, - "description": "version of the context album for the context reference, omit to use the latest version" - } - ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deletePolicyStateContextRef", - "description": "Delete a policy state context reference." - } - ] + "commandList": [ + { + "name": "quit", + "keywordlist": [ + "quit" + ], + "argumentList": [], + "systemCommand": "true", + "description": "quit execution of command handling, this command quits immediately without saving the model" + }, + { + "name": "back", + "keywordlist": [ + "back" + ], + "argumentList": [], + "systemCommand": "true", + "description": "go back one level in editor context hierarchy" + }, + { + "name": "help", + "keywordlist": [ + "help" + ], + "argumentList": [], + "systemCommand": "true", + "description": "output help information appropriate to this point in the editor context hierarchy" + }, + { + "name": "load", + "keywordlist": [ + "load" + ], + "argumentList": [ + { + "argumentName": "fileName", + "nullable": false, + "description": "Name of a file containing an Apex model in JSON or XML format" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexModel.loadFromFile", + "description": "Load an Apex model from a file" + }, + { + "name": "save", + "keywordlist": [ + "save" + ], + "argumentList": [ + { + "argumentName": "fileName", + "nullable": true, + "description": "Name of the file to save the model to" + }, + { + "argumentName": "xmlFlag", + "nullable": true, + "description": "Flag indicating that the model should be saved in XML format, model saved in JSON format if flag is false or is not specified" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexModel.saveToFile", + "description": "Save an Apex model to a file" + }, + { + "name": "analyse", + "keywordlist": [ + "analyse" + ], + "argumentList": [], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexModel.analyse", + "description": "Analyse an Apex model to show concept usage" + }, + { + "name": "validate", + "keywordlist": [ + "validate" + ], + "argumentList": [], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexModel.validate", + "description": "Validate the entire Apex model to ensure it is consistent" + }, + { + "name": "compare", + "keywordlist": [ + "compare" + ], + "argumentList": [ + { + "argumentName": "otherModelFileName", + "nullable": false, + "description": "The file name of the other model" + }, + { + "argumentName": "diffsOnly", + "nullable": true, + "description": "Flag indicating that only differences between the model are returned when set" + }, + { + "argumentName": "keysOnly", + "nullable": true, + "description": "Flag indicating that only keys are printed when set, more terse output" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexModel.compare", + "description": "Compare an Apex model with another Apex model" + }, + { + "name": "split", + "keywordlist": [ + "split" + ], + "argumentList": [ + { + "argumentName": "targetModelName", + "nullable": false, + "description": "the file name of the target model in which to store the model split out from the original model" + }, + { + "argumentName": "splitOutPolicies", + "nullable": "false", + "description": "the policies form the original model to include in the split out model, specified as a comma delimited list of policy names" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexModel.split", + "description": "Split an Apex model into a separate Apex model with only the specified policies" + }, + { + "name": "merge", + "keywordlist": [ + "merge" + ], + "argumentList": [ + { + "argumentName": "mergeInModelName", + "nullable": false, + "description": "the file name of the model to merge into the current model" + }, + { + "argumentName": "keepOriginal", + "nullable": "true", + "description": "if true, if a concept exists in both models, the original model copy of that concept is kept, if false, the mreged model overwrites" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexModel.merge", + "description": "Merge another Apex model into this model" + }, + { + "name": "createModel", + "keywordlist": [ + "model", + "create" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the model" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the model, omit to use the default version" + }, + { + "argumentName": "uuid", + "nullable": true, + "description": "model UUID, omit to generate a UUID" + }, + { + "argumentName": "description", + "nullable": true, + "description": "model description, omit to generate a description" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createModel", + "description": "Create an Apex model." + }, + { + "name": "listModel", + "keywordlist": [ + "model", + "list" + ], + "argumentList": [], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listModel", + "description": "List an Apex model, list all the concepts in the model" + }, + { + "name": "deleteModel", + "keywordlist": [ + "model", + "delete" + ], + "argumentList": [], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteModel", + "description": "Delete an Apex model, clear all the concepts in the model" + }, + { + "name": "createKeyInformation", + "keywordlist": [ + "keyinfo", + "create" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the concept for the key information" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the concept for the key information, omit to use the default version" + }, + { + "argumentName": "uuid", + "nullable": true, + "description": "key information UUID, set to null to generate a UUID" + }, + { + "argumentName": "description", + "nullable": true, + "description": "concept description, omit to generate a description" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createKeyInformation", + "description": "Create key information" + }, + { + "name": "updateKeyInformation", + "keywordlist": [ + "keyinfo", + "update" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the concept for the key information" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the concept for the key information, omit to update the latest version" + }, + { + "argumentName": "uuid", + "nullable": true, + "description": "key information UUID, omit to not update" + }, + { + "argumentName": "description", + "nullable": true, + "description": "concept description, omit to not update" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.updateKeyInformation", + "description": "Update key information" + }, + { + "name": "listKeyInformation", + "keywordlist": [ + "keyinfo", + "list" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": true, + "description": "name of the concept for the key information, omit to list all" + }, + { + "argumentName": "version", + "nullable": true, + "description": "starting version of the concept for the key information, omit to list all versions" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.ListKeyInformation", + "description": "List key information" + }, + { + "name": "deleteKeyInformation", + "keywordlist": [ + "keyinfo", + "delete" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": true, + "description": "name of the concept for the key information" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the concept for the key information, omit to delete all versions" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteKeyInformation", + "description": "Delete key information" + }, + { + "name": "validateKeyInformation", + "keywordlist": [ + "keyinfo", + "validate" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": true, + "description": "name of the concept for the key information" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the concept for the key information, omit to validate all versions" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.validateKeyInformation", + "description": "Validate key information" + }, + { + "name": "createSchema", + "keywordlist": [ + "schema", + "create" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the schema" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the schema, omit to use the default version" + }, + { + "argumentName": "flavour", + "nullable": true, + "description": "the flavour of the technology for this schema, defaults to \"Java\"" + }, + { + "argumentName": "schema", + "nullable": false, + "description": "the schema text that describes the item represented by the schema" + }, + { + "argumentName": "uuid", + "nullable": true, + "description": "schema UUID, omit to generate a UUID" + }, + { + "argumentName": "description", + "nullable": true, + "description": "schema description, omit to generate a description" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createContextSchema", + "description": "Create a schema." + }, + { + "name": "updateSchema", + "keywordlist": [ + "schema", + "update" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the schema" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the schema, omit to use the default version" + }, + { + "argumentName": "flavour", + "nullable": true, + "description": "the flavour of the technology for this schema, defaults to \"Java\"" + }, + { + "argumentName": "schema", + "nullable": false, + "description": "the schema text that describes the item represented by the schema" + }, + { + "argumentName": "uuid", + "nullable": true, + "description": "schema UUID, omit to generate a UUID" + }, + { + "argumentName": "description", + "nullable": true, + "description": "schema description, omit to generate a description" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.updateContextSchema", + "description": "Update a schema." + }, + { + "name": "listSchemas", + "keywordlist": [ + "schema", + "list" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": true, + "description": "name of the schema, omit to list all" + }, + { + "argumentName": "version", + "nullable": true, + "description": "starting version of the schema, omit to list all versions" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listContextSchemas", + "description": "List schemas." + }, + { + "name": "deleteSchema", + "keywordlist": [ + "schema", + "delete" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": true, + "description": "name of the schema" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the schema, omit to delete all versions" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteContextSchema", + "description": "Delete a schema." + }, + { + "name": "validateSchemas", + "keywordlist": [ + "schema", + "validate" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": true, + "description": "name of the schema, omit to list all" + }, + { + "argumentName": "version", + "nullable": true, + "description": "starting version of the schema, omit to list all versions" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.validateContextSchemas", + "description": "Validate context schemas." + }, + { + "name": "createEvent", + "keywordlist": [ + "event", + "create" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the event" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the event, omit to use the default version" + }, + { + "argumentName": "nameSpace", + "nullable": true, + "description": "of the event, omit to use the default value" + }, + { + "argumentName": "source", + "nullable": true, + "description": "of the event, omit to use the default value" + }, + { + "argumentName": "target", + "nullable": true, + "description": "of the event, omit to use the default value" + }, + { + "argumentName": "uuid", + "nullable": true, + "description": "event UUID, omit to generate a UUID" + }, + { + "argumentName": "description", + "nullable": true, + "description": "event description, omit to generate a description" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createEvent", + "description": "Create an event." + }, + { + "name": "updateEvent", + "keywordlist": [ + "event", + "update" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the event" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the event, omit to use the latest version" + }, + { + "argumentName": "nameSpace", + "nullable": true, + "description": "of the event, omit to not update" + }, + { + "argumentName": "source", + "nullable": true, + "description": "of the event, omit to not update" + }, + { + "argumentName": "target", + "nullable": true, + "description": "of the event, omit to not update" + }, + { + "argumentName": "uuid", + "nullable": true, + "description": "event UUID, omit to not update" + }, + { + "argumentName": "description", + "nullable": true, + "description": "event description, omit to not update" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.updateEvent", + "description": "Update an event." + }, + { + "name": "listEvent", + "keywordlist": [ + "event", + "list" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": true, + "description": "name of the event, omit to list all" + }, + { + "argumentName": "version", + "nullable": true, + "description": "starting version of the event, omit to list all versions" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listEvent", + "description": "List events." + }, + { + "name": "deleteEvent", + "keywordlist": [ + "event", + "delete" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the event" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the event, omit to delete all versions" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteEvent", + "description": "Delete an event." + }, + { + "name": "validateEvent", + "keywordlist": [ + "event", + "validate" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": true, + "description": "name of the event, omit to list all" + }, + { + "argumentName": "version", + "nullable": true, + "description": "starting version of the event, omit to list all versions" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.validateEvent", + "description": "Validate events." + }, + { + "name": "createEventPar", + "keywordlist": [ + "event", + "parameter", + "create" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the event" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the event, omit to use the latest version" + }, + { + "argumentName": "parName", + "nullable": false, + "description": "of the parameter" + }, + { + "argumentName": "schemaName", + "nullable": false, + "description": "name of the parameter schema" + }, + { + "argumentName": "schemaVersion", + "nullable": true, + "description": "version of the parameter schema, omit to use the latest version" + }, + { + "argumentName": "optional", + "nullable": true, + "description": "indicates if the parameter is optional, if omitted, the parameter is mandatory" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createEventPar", + "description": "Create an event parameter." + }, + { + "name": "listEventPar", + "keywordlist": [ + "event", + "parameter", + "list" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the event" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the event, omit to list latest version" + }, + { + "argumentName": "parName", + "nullable": true, + "description": "name of the parameter, omit to list all parameters of the event" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listEventPar", + "description": "List event parameters." + }, + { + "name": "deleteEventPar", + "keywordlist": [ + "event", + "parameter", + "delete" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the event" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the event, omit to use the latest version" + }, + { + "argumentName": "parName", + "nullable": true, + "description": "of the parameter, omit to delete all parameters" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteEventPar", + "description": "Delete an event parameter." + }, + { + "name": "createAlbum", + "keywordlist": [ + "album", + "create" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the context album" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the context album, omit to use the default version" + }, + { + "argumentName": "scope", + "nullable": false, + "description": "scope of application of the context album" + }, + { + "argumentName": "writable", + "nullable": false, + "description": "true if the album is writable, false otherwise, album defaults to writable if omitted" + }, + { + "argumentName": "schemaName", + "nullable": false, + "description": "name of the album schema" + }, + { + "argumentName": "schemaVersion", + "nullable": true, + "description": "version of the album schema, omit to use the latest version" + }, + { + "argumentName": "uuid", + "nullable": true, + "description": "context album UUID, omit to generate a UUID" + }, + { + "argumentName": "description", + "nullable": true, + "description": "album description, omit to generate a description" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createContextAlbum", + "description": "Create a context album." + }, + { + "name": "updateAlbum", + "keywordlist": [ + "album", + "update" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the context album" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the context album, omit to use the latest version" + }, + { + "argumentName": "scope", + "nullable": false, + "description": "scope of application of the context album" + }, + { + "argumentName": "writable", + "nullable": false, + "description": "true if the album is writable, false otherwise, album defaults to writable if omitted" + }, + { + "argumentName": "schemaName", + "nullable": false, + "description": "name of the album schema" + }, + { + "argumentName": "schemaVersion", + "nullable": true, + "description": "version of the album schema, omit to use the latest version" + }, + { + "argumentName": "uuid", + "nullable": true, + "description": "context album UUID, omit to not update" + }, + { + "argumentName": "description", + "nullable": true, + "description": "album description, omit to not update" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.updateContextAlbum", + "description": "Update a context album." + }, + { + "name": "listAlbum", + "keywordlist": [ + "album", + "list" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": true, + "description": "name of the context album, omit to list all" + }, + { + "argumentName": "version", + "nullable": true, + "description": "starting version of the context album, omit to list all versions" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listContextAlbum", + "description": "List context albums." + }, + { + "name": "deleteAlbum", + "keywordlist": [ + "album", + "delete" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the context album" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the context album, omit to delete versions" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteContextAlbum", + "description": "Delete a context album." + }, + { + "name": "validateAlbum", + "keywordlist": [ + "album", + "validate" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": true, + "description": "name of the context album, omit to list all" + }, + { + "argumentName": "version", + "nullable": true, + "description": "starting version of the context album, omit to list all versions" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.validateContextAlbum", + "description": "Validate context albums." + }, + { + "name": "createTask", + "keywordlist": [ + "task", + "create" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the task" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the task, omit to use the default version" + }, + { + "argumentName": "uuid", + "nullable": true, + "description": "task UUID, omit to generate a UUID" + }, + { + "argumentName": "description", + "nullable": true, + "description": "task description, omit to generate a description" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createTask", + "description": "Create a task." + }, + { + "name": "updateTask", + "keywordlist": [ + "task", + "update" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the task" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the task, omit to use the latest version" + }, + { + "argumentName": "uuid", + "nullable": true, + "description": "task UUID, omit to not update" + }, + { + "argumentName": "description", + "nullable": true, + "description": "task description, omit to not update" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.updateTask", + "description": "Update a task." + }, + { + "name": "listTask", + "keywordlist": [ + "task", + "list" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": true, + "description": "name of the task, omit to list all" + }, + { + "argumentName": "version", + "nullable": true, + "description": "starting version of the task, omit to list all versions" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listTask", + "description": "List tasks." + }, + { + "name": "deleteTask", + "keywordlist": [ + "task", + "delete" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the task" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the task, omit to use the latest version" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteTask", + "description": "Delete a task." + }, + { + "name": "validateTask", + "keywordlist": [ + "task", + "validate" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": true, + "description": "name of the task, omit to list all" + }, + { + "argumentName": "version", + "nullable": true, + "description": "starting version of the task, omit to list all versions" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.validateTask", + "description": "Validate tasks." + }, + { + "name": "createTaskLogic", + "keywordlist": [ + "task", + "logic", + "create" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the task" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the task, omit to use the latest version" + }, + { + "argumentName": "logicFlavour", + "nullable": true, + "description": "the task logic flavour for the task, omit to use the default task logic flavour" + }, + { + "argumentName": "logic", + "nullable": false, + "description": "the source code for the logic of the task" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createTaskLogic", + "description": "Create logic for a task." + }, + { + "name": "updateTaskLogic", + "keywordlist": [ + "task", + "logic", + "update" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the task" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the task, omit to use the latest version" + }, + { + "argumentName": "logicFlavour", + "nullable": true, + "description": "the task logic flavour for the task, omit to not update" + }, + { + "argumentName": "logic", + "nullable": true, + "description": "the source code for the logic of the task, omit to not update" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.updateTaskLogic", + "description": "Update logic for a task." + }, + { + "name": "listTaskLogic", + "keywordlist": [ + "task", + "logic", + "list" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the task" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the task, omit to list the latest version" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listTaskLogic", + "description": "List task logic." + }, + { + "name": "deleteTaskLogic", + "keywordlist": [ + "task", + "logic", + "delete" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the task" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the task, omit to use the latest version" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteTaskLogic", + "description": "Delete logic for a task." + }, + { + "name": "createTaskInputField", + "keywordlist": [ + "task", + "inputfield", + "create" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the task" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the task, omit to use the latest version" + }, + { + "argumentName": "fieldName", + "nullable": false, + "description": "of the input field" + }, + { + "argumentName": "schemaName", + "nullable": false, + "description": "name of the input field schema" + }, + { + "argumentName": "schemaVersion", + "nullable": true, + "description": "version of the input field schema, omit to use the latest version" + }, + { + "argumentName": "optional", + "nullable": true, + "description": "indicates if the field is optional, if omitted, the field is mandatory" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createTaskField", + "description": "Create a task input field." + }, + { + "name": "listTaskInputField", + "keywordlist": [ + "task", + "inputfield", + "list" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the task" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the task, omit to use the latest version" + }, + { + "argumentName": "fieldName", + "nullable": true, + "description": "field name of the input field, omit to list all input fields of the task" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.handleTaskField", + "description": "List task input fields." + }, + { + "name": "deleteTaskInputField", + "keywordlist": [ + "task", + "inputfield", + "delete" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the task" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the task, omit to use the latest version" + }, + { + "argumentName": "fieldName", + "nullable": true, + "description": "of the input field, omit to delete all input fields" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.handleTaskField", + "description": "Delete a task input field." + }, + { + "name": "createTaskOutputField", + "keywordlist": [ + "task", + "outputfield", + "create" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the task" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the task, omit to use the latest version" + }, + { + "argumentName": "fieldName", + "nullable": false, + "description": "of the output field" + }, + { + "argumentName": "schemaName", + "nullable": false, + "description": "name of the output field schema" + }, + { + "argumentName": "schemaVersion", + "nullable": true, + "description": "version of the output field schema, omit to use the latest version" + }, + { + "argumentName": "optional", + "nullable": true, + "description": "indicates if the field is optional, if omitted, the field is mandatory" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createTaskField", + "description": "Create a task output field." + }, + { + "name": "listTaskOutputField", + "keywordlist": [ + "task", + "outputfield", + "list" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the task" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the task, omit to use the latest version" + }, + { + "argumentName": "fieldName", + "nullable": true, + "description": "field name of the output field, omit to list all output fields of the task" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.handleTaskField", + "description": "List task output fields." + }, + { + "name": "deleteTaskOutputField", + "keywordlist": [ + "task", + "outputfield", + "delete" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the task" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the task, omit to use the latest version" + }, + { + "argumentName": "fieldName", + "nullable": true, + "description": "of the output field, omit to delete all output fields" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.handleTaskField", + "description": "Delete a task output field." + }, + { + "name": "createTaskParameter", + "keywordlist": [ + "task", + "parameter", + "create" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the task" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the task, omit to use the latest version" + }, + { + "argumentName": "parName", + "nullable": false, + "description": "of the parameter" + }, + { + "argumentName": "defaultValue", + "nullable": false, + "description": "of the parameter" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createTaskParameter", + "description": "Create a task parameter." + }, + { + "name": "listTaskParameter", + "keywordlist": [ + "task", + "parameter", + "list" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the task" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the task, omit to use the latest version" + }, + { + "argumentName": "parName", + "nullable": true, + "description": "name of the parameter, omit to list all parameters of the task" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listTaskParameter", + "description": "List task parameters." + }, + { + "name": "deleteTaskParameter", + "keywordlist": [ + "task", + "parameter", + "delete" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the task" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the task, omit to use the latest version" + }, + { + "argumentName": "parName", + "nullable": true, + "description": "of the parameter, omit to delete all task parameters" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteTaskParameter", + "description": "Delete a task parameter." + }, + { + "name": "createTaskContextRef", + "keywordlist": [ + "task", + "contextref", + "create" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the task" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the task, omit to use the latest version" + }, + { + "argumentName": "albumName", + "nullable": false, + "description": "name of the context album for the context reference" + }, + { + "argumentName": "albumVersion", + "nullable": true, + "description": "version of the context album for the context reference, omit to use the latest version" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createTaskContextRef", + "description": "Create a task context reference." + }, + { + "name": "listTaskContextRef", + "keywordlist": [ + "task", + "contextref", + "list" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the task" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the task, omit to use the latest version" + }, + { + "argumentName": "albumName", + "nullable": true, + "description": "name of the context album for the context reference, omit to list all task context references" + }, + { + "argumentName": "albumVersion", + "nullable": true, + "description": "version of the context album for the context reference, omit to use the latest version" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listTaskContextRef", + "description": "List task context references." + }, + { + "name": "deleteTaskContextRef", + "keywordlist": [ + "task", + "contextref", + "delete" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the task" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the task, omit to use the latest version" + }, + { + "argumentName": "albumName", + "nullable": true, + "description": "name of the context album for the context reference, omit to delete all task context references" + }, + { + "argumentName": "albumVersion", + "nullable": true, + "description": "version of the context album for the context reference, omit to use the latest version" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteTaskContextRef", + "description": "Delete a task context reference." + }, + { + "name": "createPolicy", + "keywordlist": [ + "policy", + "create" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the policy" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the policy, omit to use the default version" + }, + { + "argumentName": "template", + "nullable": true, + "description": "template used to create the policy, omit to use the default template" + }, + { + "argumentName": "firstState", + "nullable": false, + "description": "the first state of the policy" + }, + { + "argumentName": "uuid", + "nullable": true, + "description": "policy UUID, omit to generate a UUID" + }, + { + "argumentName": "description", + "nullable": true, + "description": "policy description, omit to generate a description" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createPolicy", + "description": "Create a policy." + }, + { + "name": "updatePolicy", + "keywordlist": [ + "policy", + "update" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the policy" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the policy, omit to use the latest version" + }, + { + "argumentName": "template", + "nullable": true, + "description": "template used to create the policy, omit to not update" + }, + { + "argumentName": "firstState", + "nullable": false, + "description": "the first state of the policy" + }, + { + "argumentName": "uuid", + "nullable": true, + "description": "policy UUID, omit to not update" + }, + { + "argumentName": "description", + "nullable": true, + "description": "policy description, omit to not update" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.updatePolicy", + "description": "Update a policy." + }, + { + "name": "listPolicy", + "keywordlist": [ + "policy", + "list" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": true, + "description": "name of the policy, omit to list all" + }, + { + "argumentName": "version", + "nullable": true, + "description": "starting version of the policy, omit to list all versions" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listPolicy", + "description": "List policies." + }, + { + "name": "deletePolicy", + "keywordlist": [ + "policy", + "delete" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the policy" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the policy, omit to use the latest version" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deletePolicy", + "description": "Delete a policy." + }, + { + "name": "validatePolicy", + "keywordlist": [ + "policy", + "validate" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": true, + "description": "name of the policy, omit to list all" + }, + { + "argumentName": "version", + "nullable": true, + "description": "starting version of the policy, omit to list all versions" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.validatePolicy", + "description": "Validate policies." + }, + { + "name": "createPolicyState", + "keywordlist": [ + "policy", + "state", + "create" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the policy" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the policy, omit to use the latest version" + }, + { + "argumentName": "stateName", + "nullable": false, + "description": "of the state" + }, + { + "argumentName": "triggerName", + "nullable": false, + "description": "name of the trigger event for this state" + }, + { + "argumentName": "triggerVersion", + "nullable": true, + "description": "version of the trigger event for this state, omit to use the latest version" + }, + { + "argumentName": "defaultTaskName", + "nullable": false, + "description": "the default task name" + }, + { + "argumentName": "defaultTaskVersion", + "nullable": true, + "description": "the default task version, omit to use the latest version" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createPolicyState", + "description": "Create a policy state." + }, + { + "name": "updatePolicyState", + "keywordlist": [ + "policy", + "state", + "update" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the policy" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the policy, omit to use the latest version" + }, + { + "argumentName": "stateName", + "nullable": false, + "description": "of the state" + }, + { + "argumentName": "triggerName", + "nullable": true, + "description": "name of the trigger event for this state, omit to not update" + }, + { + "argumentName": "triggerVersion", + "nullable": false, + "description": "version of the trigger event for this state, set to use latest version of trigger event" + }, + { + "argumentName": "defaultTaskName", + "nullable": true, + "description": "the default task name, omit to not update" + }, + { + "argumentName": "defaultTaskVersion", + "nullable": false, + "description": "the default task version, set to use latest version of default task" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.updatePolicyState", + "description": "Update a policy state." + }, + { + "name": "listPolicyState", + "keywordlist": [ + "policy", + "state", + "list" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the policy" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the policy, omit to use the latest version" + }, + { + "argumentName": "stateName", + "nullable": true, + "description": "of the state, omit to list all states of the policy" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listPolicyState", + "description": "List policy states." + }, + { + "name": "deletePolicyState", + "keywordlist": [ + "policy", + "state", + "delete" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the policy" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the policy, omit to use the latest version" + }, + { + "argumentName": "stateName", + "nullable": true, + "description": "of the state, omit to delete all states" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deletePolicyState", + "description": "Delete a policy state." + }, + { + "name": "createPolicyStateTaskSelectionLogic", + "keywordlist": [ + "policy", + "state", + "selecttasklogic", + "create" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the policy" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the policy, omit to use the latest version" + }, + { + "argumentName": "stateName", + "nullable": false, + "description": "of the state" + }, + { + "argumentName": "logicFlavour", + "nullable": true, + "description": "the task selection logic flavour for the state, omit to use the default task logic flavour" + }, + { + "argumentName": "logic", + "nullable": false, + "description": "the source code for the logic of the state" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createPolicyStateTaskSelectionLogic", + "description": "Create task selection logic for a state." + }, + { + "name": "updatePolicyStateTaskSelectionLogic", + "keywordlist": [ + "policy", + "state", + "selecttasklogic", + "update" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the policy" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the policy, omit to use the latest version" + }, + { + "argumentName": "stateName", + "nullable": false, + "description": "of the state" + }, + { + "argumentName": "logicFlavour", + "nullable": true, + "description": "the task selection logic flavour for the state, omit to not update" + }, + { + "argumentName": "logic", + "nullable": true, + "description": "the source code for the logic of the state, omit to not update" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.updatePolicyStateTaskSelectionLogic", + "description": "Update task selection logic for a state." + }, + { + "name": "listPolicyStateTaskSelectionLogic", + "keywordlist": [ + "policy", + "state", + "selecttasklogic", + "list" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the policy" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the policy, omit to use the latest version" + }, + { + "argumentName": "stateName", + "nullable": false, + "description": "of the state" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listPolicyStateTaskSelectionLogic", + "description": "List task selection logic for a state." + }, + { + "name": "deletePolicyStateTaskSelectionLogic", + "keywordlist": [ + "policy", + "state", + "selecttasklogic", + "delete" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the policy" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the policy, omit to use the latest version" + }, + { + "argumentName": "stateName", + "nullable": false, + "description": "of the state" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deletePolicyStateTaskSelectionLogic", + "description": "Delete task selection logic for a state." + }, + { + "name": "createPolicyStateOutput", + "keywordlist": [ + "policy", + "state", + "output", + "create" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the policy" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the policy, omit to use the latest version" + }, + { + "argumentName": "stateName", + "nullable": false, + "description": "of the state" + }, + { + "argumentName": "outputName", + "nullable": false, + "description": "of the state output" + }, + { + "argumentName": "eventName", + "nullable": false, + "description": "name of the output event for this state output" + }, + { + "argumentName": "eventVersion", + "nullable": true, + "description": "version of the output event for this state output, omit to use the latest version" + }, + { + "argumentName": "nextState", + "nullable": true, + "description": "for this state to transition to, omit if this is the last state that the policy transitions to on this branch" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createPolicyStateOutput", + "description": "Create a policy state output." + }, + { + "name": "listPolicyStateOutput", + "keywordlist": [ + "policy", + "state", + "output", + "list" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the policy" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the policy, omit to use the latest version" + }, + { + "argumentName": "stateName", + "nullable": false, + "description": "of the state" + }, + { + "argumentName": "outputName", + "nullable": true, + "description": "of the state output, omit to list all outputs of the state" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listPolicyStateOutput", + "description": "List policy state outputs." + }, + { + "name": "deletePolicyStateOutput", + "keywordlist": [ + "policy", + "state", + "output", + "delete" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the policy" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the policy, omit to use the latest version" + }, + { + "argumentName": "stateName", + "nullable": false, + "description": "of the state" + }, + { + "argumentName": "outputName", + "nullable": true, + "description": "of the state output, omit to delete all state outputs" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deletePolicyStateOutput", + "description": "Delete a policy state output." + }, + { + "name": "createPolicyStateFinalizerLogic", + "keywordlist": [ + "policy", + "state", + "finalizerlogic", + "create" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the policy" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the policy, omit to use the latest version" + }, + { + "argumentName": "stateName", + "nullable": false, + "description": "of the state" + }, + { + "argumentName": "finalizerLogicName", + "nullable": false, + "description": "name of the state finalizer logic" + }, + { + "argumentName": "logicFlavour", + "nullable": true, + "description": "the policy finalizer logic flavour for the state, omit to use the default task logic flavour" + }, + { + "argumentName": "logic", + "nullable": false, + "description": "the source code for the logic of the state" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createPolicyStateFinalizerLogic", + "description": "Create policy finalizer logic for a state." + }, + { + "name": "updatePolicyStateFinalizerLogic", + "keywordlist": [ + "policy", + "state", + "finalizerlogic", + "update" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the policy" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the policy, omit to use the latest version" + }, + { + "argumentName": "stateName", + "nullable": false, + "description": "of the state" + }, + { + "argumentName": "finalizerLogicName", + "nullable": false, + "description": "name of the state finalizer logic" + }, + { + "argumentName": "logicFlavour", + "nullable": true, + "description": "the policy finalizer logic flavour for the state, omit to not update" + }, + { + "argumentName": "logic", + "nullable": true, + "description": "the source code for the logic of the state, omit to not update" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.updatePolicyStateFinalizerLogic", + "description": "Update policy finalizer logic for a state." + }, + { + "name": "listPolicyStateFinalizerLogic", + "keywordlist": [ + "policy", + "state", + "finalizerlogic", + "list" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the policy" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the policy, omit to use the latest version" + }, + { + "argumentName": "stateName", + "nullable": false, + "description": "of the state" + }, + { + "argumentName": "finalizerLogicName", + "nullable": false, + "description": "name of the state finalizer logic" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listPolicyStateFinalizerLogic", + "description": "List policy finalizer logic for a state." + }, + { + "name": "deletePolicyStateFinalizerLogic", + "keywordlist": [ + "policy", + "state", + "finalizerlogic", + "delete" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the policy" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the policy, omit to use the latest version" + }, + { + "argumentName": "stateName", + "nullable": false, + "description": "of the state" + }, + { + "argumentName": "finalizerLogicName", + "nullable": false, + "description": "name of the state finalizer logic" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deletePolicyStateFinalizerLogic", + "description": "Delete policy finalizer logic for a state." + }, + { + "name": "createPolicyStateTaskRef", + "keywordlist": [ + "policy", + "state", + "taskref", + "create" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the policy" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the policy, omit to use the latest version" + }, + { + "argumentName": "stateName", + "nullable": false, + "description": "of the state" + }, + { + "argumentName": "taskLocalName", + "nullable": true, + "description": "local name of the task in the state, omit to use the task name" + }, + { + "argumentName": "taskName", + "nullable": false, + "description": "name of the task" + }, + { + "argumentName": "taskVersion", + "nullable": true, + "description": "version of the task, omit to use the latest version" + }, + { + "argumentName": "outputType", + "nullable": false, + "description": "Type of output for the task, must be DIRECT for direct output to a state output or LOGIC for output to state finalizer logic" + }, + { + "argumentName": "outputName", + "nullable": false, + "description": "the name of the state output or state state finalizer logic to handle the task output" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createPolicyStateTaskRef", + "description": "Create a policy state task reference." + }, + { + "name": "listPolicyStateTaskRef", + "keywordlist": [ + "policy", + "state", + "taskref", + "list" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the policy" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the policy, omit to use the latest version" + }, + { + "argumentName": "stateName", + "nullable": false, + "description": "of the state" + }, + { + "argumentName": "taskName", + "nullable": true, + "description": "name of the task, omit to list all task references" + }, + { + "argumentName": "taskVersion", + "nullable": true, + "description": "version of the task, omit to use the latest version" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listPolicyStateTaskRef", + "description": "List policy state task references." + }, + { + "name": "deletePolicyStateTaskRef", + "keywordlist": [ + "policy", + "state", + "taskref", + "delete" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the policy" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the policy, omit to use the latest version" + }, + { + "argumentName": "stateName", + "nullable": false, + "description": "of the state" + }, + { + "argumentName": "taskName", + "nullable": true, + "description": "name of the task, omit to delete all task references" + }, + { + "argumentName": "taskVersion", + "nullable": true, + "description": "version of the task, omit to use the latest version" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deletePolicyStateTaskRef", + "description": "Delete a policy state task reference." + }, + { + "name": "createPolicyStateContextRef", + "keywordlist": [ + "policy", + "state", + "contextref", + "create" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the policy" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the policy, omit to use the latest version" + }, + { + "argumentName": "stateName", + "nullable": false, + "description": "of the state" + }, + { + "argumentName": "albumName", + "nullable": false, + "description": "name of the context album for the context reference" + }, + { + "argumentName": "albumVersion", + "nullable": true, + "description": "version of the context album for the context reference, omit to use the latest version" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createPolicyStateContextRef", + "description": "Create a policy state context reference." + }, + { + "name": "listPolicyStateContextRef", + "keywordlist": [ + "policy", + "state", + "contextref", + "list" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the policy" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the policy, omit to use the latest version" + }, + { + "argumentName": "stateName", + "nullable": false, + "description": "of the state" + }, + { + "argumentName": "albumName", + "nullable": true, + "description": "name of the context album for the context reference, omit to list all task context references" + }, + { + "argumentName": "albumVersion", + "nullable": true, + "description": "version of the context album for the context reference, omit to use the latest version" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listPolicyStateContextRef", + "description": "List policy state context references." + }, + { + "name": "deletePolicyStateContextRef", + "keywordlist": [ + "policy", + "state", + "contextref", + "delete" + ], + "argumentList": [ + { + "argumentName": "name", + "nullable": false, + "description": "name of the policy" + }, + { + "argumentName": "version", + "nullable": true, + "description": "version of the policy, omit to use the default version" + }, + { + "argumentName": "stateName", + "nullable": false, + "description": "of the state" + }, + { + "argumentName": "albumName", + "nullable": true, + "description": "name of the context album for the context reference, omit to delete all task context references" + }, + { + "argumentName": "albumVersion", + "nullable": true, + "description": "version of the context album for the context reference, omit to use the latest version" + } + ], + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deletePolicyStateContextRef", + "description": "Delete a policy state context reference." + } + ] } diff --git a/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorEventsContextTest.java b/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorEventsContextTest.java index 0e87950d2..d5d288d04 100644 --- a/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorEventsContextTest.java +++ b/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorEventsContextTest.java @@ -22,6 +22,7 @@ package org.onap.policy.apex.auth.clieditor; +import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; import java.io.File; @@ -84,8 +85,8 @@ public class CommandLineEditorEventsContextTest { final int logCharCount = logString.replaceAll(SPACES, EMPTY_STRING).length(); final int modelCharCount = modelString.replaceAll(SPACES, EMPTY_STRING).length(); - assertEquals(25892, logCharCount); - assertEquals(51975, modelCharCount); + assertThat(logCharCount).isGreaterThan(20000); + assertThat(modelCharCount).isGreaterThan(30000); } /** @@ -114,8 +115,8 @@ public class CommandLineEditorEventsContextTest { final int logCharCount = logString.replaceAll(SPACES, EMPTY_STRING).length(); final int modelCharCount = modelString.replaceAll(SPACES, EMPTY_STRING).length(); - assertEquals(30068, logCharCount); - assertEquals(59015, modelCharCount); + assertThat(logCharCount).isGreaterThan(20000); + assertThat(modelCharCount).isGreaterThan(30000); } diff --git a/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/tosca/ApexCliToscaEditorTest.java b/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/tosca/ApexCliToscaEditorTest.java index 10bb63329..9ac046381 100644 --- a/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/tosca/ApexCliToscaEditorTest.java +++ b/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/tosca/ApexCliToscaEditorTest.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -84,8 +85,8 @@ public class ApexCliToscaEditorTest { public void testApexCliTosca_success() throws IOException { final ApexCliToscaEditorMain cliEditor = new ApexCliToscaEditorMain(sampleArgs); String outputTosca = TextFileUtils.getTextFileAsString(tempOutputToscaFile.getAbsolutePath()); - String outputToscaCompare = TextFileUtils.getTextFileAsString( - "src/test/resources/tosca/ToscaPolicyOutput_compare.json"); + String outputToscaCompare = + TextFileUtils.getTextFileAsString("src/test/resources/tosca/ToscaPolicyOutput_compare.json").trim(); assertEquals(outputToscaCompare, outputTosca); assertFalse(cliEditor.isFailure()); } diff --git a/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/utils/CliUtilsTest.java b/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/utils/CliUtilsTest.java index 2dfd6f6c9..371efd7d2 100644 --- a/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/utils/CliUtilsTest.java +++ b/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/utils/CliUtilsTest.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -81,7 +82,7 @@ public class CliUtilsTest { CliUtils.createToscaServiceTemplate(params, policyModelFilePath); String outputTosca = TextFileUtils.getTextFileAsString(tempOutputToscaFile.getAbsolutePath()); String outputToscaCompare = - TextFileUtils.getTextFileAsString("src/test/resources/tosca/ToscaPolicyOutput_compare.json"); + TextFileUtils.getTextFileAsString("src/test/resources/tosca/ToscaPolicyOutput_compare.json").trim(); assertEquals(outputToscaCompare, outputTosca); } diff --git a/auth/cli-editor/src/test/resources/tosca/PolicyModel.json b/auth/cli-editor/src/test/resources/tosca/PolicyModel.json index 3672be430..95fab2d5e 100644 --- a/auth/cli-editor/src/test/resources/tosca/PolicyModel.json +++ b/auth/cli-editor/src/test/resources/tosca/PolicyModel.json @@ -654,212 +654,6 @@ } ] }, - "inputFields": { - "entry": [ - { - "key": "amount", - "value": { - "key": "amount", - "fieldSchemaKey": { - "name": "price_type", - "version": "0.0.1" - }, - "optional": false - } - }, - { - "key": "assistant_ID", - "value": { - "key": "assistant_ID", - "fieldSchemaKey": { - "name": "assistant_ID_type", - "version": "0.0.1" - }, - "optional": false - } - }, - { - "key": "branch_ID", - "value": { - "key": "branch_ID", - "fieldSchemaKey": { - "name": "branch_ID_type", - "version": "0.0.1" - }, - "optional": false - } - }, - { - "key": "item_ID", - "value": { - "key": "item_ID", - "fieldSchemaKey": { - "name": "item_ID_type", - "version": "0.0.1" - }, - "optional": false - } - }, - { - "key": "notes", - "value": { - "key": "notes", - "fieldSchemaKey": { - "name": "notes_type", - "version": "0.0.1" - }, - "optional": true - } - }, - { - "key": "quantity", - "value": { - "key": "quantity", - "fieldSchemaKey": { - "name": "quantity_type", - "version": "0.0.1" - }, - "optional": false - } - }, - { - "key": "sale_ID", - "value": { - "key": "sale_ID", - "fieldSchemaKey": { - "name": "sale_ID_type", - "version": "0.0.1" - }, - "optional": false - } - }, - { - "key": "time", - "value": { - "key": "time", - "fieldSchemaKey": { - "name": "timestamp_type", - "version": "0.0.1" - }, - "optional": false - } - } - ] - }, - "outputFields": { - "entry": [ - { - "key": "amount", - "value": { - "key": "amount", - "fieldSchemaKey": { - "name": "price_type", - "version": "0.0.1" - }, - "optional": false - } - }, - { - "key": "assistant_ID", - "value": { - "key": "assistant_ID", - "fieldSchemaKey": { - "name": "assistant_ID_type", - "version": "0.0.1" - }, - "optional": false - } - }, - { - "key": "authorised", - "value": { - "key": "authorised", - "fieldSchemaKey": { - "name": "authorised_type", - "version": "0.0.1" - }, - "optional": false - } - }, - { - "key": "branch_ID", - "value": { - "key": "branch_ID", - "fieldSchemaKey": { - "name": "branch_ID_type", - "version": "0.0.1" - }, - "optional": false - } - }, - { - "key": "item_ID", - "value": { - "key": "item_ID", - "fieldSchemaKey": { - "name": "item_ID_type", - "version": "0.0.1" - }, - "optional": false - } - }, - { - "key": "message", - "value": { - "key": "message", - "fieldSchemaKey": { - "name": "message_type", - "version": "0.0.1" - }, - "optional": true - } - }, - { - "key": "notes", - "value": { - "key": "notes", - "fieldSchemaKey": { - "name": "notes_type", - "version": "0.0.1" - }, - "optional": true - } - }, - { - "key": "quantity", - "value": { - "key": "quantity", - "fieldSchemaKey": { - "name": "quantity_type", - "version": "0.0.1" - }, - "optional": false - } - }, - { - "key": "sale_ID", - "value": { - "key": "sale_ID", - "fieldSchemaKey": { - "name": "sale_ID_type", - "version": "0.0.1" - }, - "optional": false - } - }, - { - "key": "time", - "value": { - "key": "time", - "fieldSchemaKey": { - "name": "timestamp_type", - "version": "0.0.1" - }, - "optional": false - } - } - ] - }, "taskParameters": { "entry": [] }, diff --git a/auth/cli-editor/src/test/resources/tosca/ToscaPolicyOutput_compare.json b/auth/cli-editor/src/test/resources/tosca/ToscaPolicyOutput_compare.json index 55bd95eca..3649f945b 100644 --- a/auth/cli-editor/src/test/resources/tosca/ToscaPolicyOutput_compare.json +++ b/auth/cli-editor/src/test/resources/tosca/ToscaPolicyOutput_compare.json @@ -1 +1 @@ -{"tosca_definitions_version":"tosca_simple_yaml_1_1_0","topology_template":{"policies":[{"native.sampledomain":{"type":"onap.policies.native.Apex","type_version":"1.0.0","name":"native.sampledomain","version":"1.0.0","properties":{"engineServiceParameters":{"name":"MyFirstPolicyApexEngine","version":"0.0.1","id":101,"instanceCount":4,"deploymentPort":12345,"engineParameters":{"executorParameters":{"MVEL":{"parameterClassName":"org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters"},"JAVASCRIPT":{"parameterClassName":"org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters"}}},"policy_type_impl":{"apexPolicyModel":{"key":{"name":"MyFirstPolicyModel","version":"0.0.1"},"keyInformation":{"key":{"name":"MyFirstPolicyModel_KeyInfo","version":"0.0.1"},"keyInfoMap":{"entry":[{"key":{"name":"MorningBoozeCheck","version":"0.0.1"},"value":{"key":{"name":"MorningBoozeCheck","version":"0.0.1"},"UUID":"3351b0f4-cf06-4fa2-8823-edf67bd30223","description":"This task checks if the sales request is for an item that contains alcohol. \nIf the local time is between 00:00:00 and 11:30:00 then the sale is not authorised. Otherwise the sale is authorised. \nIn this implementation we assume that all items with item_ID values between 1000 and 2000 contain alcohol :-)"}},{"key":{"name":"MyFirstPolicy","version":"0.0.1"},"value":{"key":{"name":"MyFirstPolicy","version":"0.0.1"},"UUID":"6c5e410f-489a-46ff-964e-982ce6e8b6d0","description":"This is my first Apex policy. It checks if a sale should be authorised or not."}},{"key":{"name":"MyFirstPolicyModel","version":"0.0.1"},"value":{"key":{"name":"MyFirstPolicyModel","version":"0.0.1"},"UUID":"540226fb-55ee-4f0e-a444-983a0494818e","description":"This is my first Apex Policy Model."}},{"key":{"name":"MyFirstPolicyModel_Events","version":"0.0.1"},"value":{"key":{"name":"MyFirstPolicyModel_Events","version":"0.0.1"},"UUID":"ef281318-5ac9-3ef0-8db3-8f9c4e4a81e2","description":"Generated description for concept referred to by key \"MyFirstPolicyModel_Events:0.0.1\""}},{"key":{"name":"MyFirstPolicyModel_KeyInfo","version":"0.0.1"},"value":{"key":{"name":"MyFirstPolicyModel_KeyInfo","version":"0.0.1"},"UUID":"d9248c6f-7c00-38df-8251-611463ba4065","description":"Generated description for concept referred to by key \"MyFirstPolicyModel_KeyInfo:0.0.1\""}},{"key":{"name":"MyFirstPolicyModel_Policies","version":"0.0.1"},"value":{"key":{"name":"MyFirstPolicyModel_Policies","version":"0.0.1"},"UUID":"77c01a6b-510c-3aa9-b640-b4db356aa03b","description":"Generated description for concept referred to by key \"MyFirstPolicyModel_Policies:0.0.1\""}},{"key":{"name":"MyFirstPolicyModel_Schemas","version":"0.0.1"},"value":{"key":{"name":"MyFirstPolicyModel_Schemas","version":"0.0.1"},"UUID":"d0cc3aa0-ea69-3a43-80ff-a0dbb0ebd885","description":"Generated description for concept referred to by key \"MyFirstPolicyModel_Schemas:0.0.1\""}},{"key":{"name":"MyFirstPolicyModel_Tasks","version":"0.0.1"},"value":{"key":{"name":"MyFirstPolicyModel_Tasks","version":"0.0.1"},"UUID":"b02a7e02-2cd0-39e6-b3cb-946fa83a8f08","description":"Generated description for concept referred to by key \"MyFirstPolicyModel_Tasks:0.0.1\""}},{"key":{"name":"SALE_AUTH","version":"0.0.1"},"value":{"key":{"name":"SALE_AUTH","version":"0.0.1"},"UUID":"c4500941-3f98-4080-a9cc-5b9753ed050b","description":"An event emitted by the Policy to indicate whether the sale of an item has been authorised"}},{"key":{"name":"SALE_INPUT","version":"0.0.1"},"value":{"key":{"name":"SALE_INPUT","version":"0.0.1"},"UUID":"4f04aa98-e917-4f4a-882a-c75ba5a99374","description":"An event raised by the PoS system each time an item is scanned for purchase"}},{"key":{"name":"assistant_ID_type","version":"0.0.1"},"value":{"key":{"name":"assistant_ID_type","version":"0.0.1"},"UUID":"36df4c71-9616-4206-8b53-976a5cd4bd87","description":"A type for 'assistant_ID' values"}},{"key":{"name":"authorised_type","version":"0.0.1"},"value":{"key":{"name":"authorised_type","version":"0.0.1"},"UUID":"d48b619e-d00d-4008-b884-02d76ea4350b","description":"A type for 'authorised' values"}},{"key":{"name":"branch_ID_type","version":"0.0.1"},"value":{"key":{"name":"branch_ID_type","version":"0.0.1"},"UUID":"6468845f-4122-4128-8e49-0f52c26078b5","description":"A type for 'branch_ID' values"}},{"key":{"name":"item_ID_type","version":"0.0.1"},"value":{"key":{"name":"item_ID_type","version":"0.0.1"},"UUID":"4f227ff1-aee0-453a-b6b6-9a4b2e0da932","description":"A type for 'item_ID' values"}},{"key":{"name":"message_type","version":"0.0.1"},"value":{"key":{"name":"message_type","version":"0.0.1"},"UUID":"ad1431bb-3155-4e73-b5a3-b89bee498749","description":"A type for 'message' values"}},{"key":{"name":"notes_type","version":"0.0.1"},"value":{"key":{"name":"notes_type","version":"0.0.1"},"UUID":"eecfde90-896c-4343-8f9c-2603ced94e2d","description":"A type for 'notes' values"}},{"key":{"name":"price_type","version":"0.0.1"},"value":{"key":{"name":"price_type","version":"0.0.1"},"UUID":"52c2fc45-fd8c-463c-bd6f-d91b0554aea7","description":"A type for 'amount'/'price' values"}},{"key":{"name":"quantity_type","version":"0.0.1"},"value":{"key":{"name":"quantity_type","version":"0.0.1"},"UUID":"ac3d9842-80af-4a98-951c-bd79a431c613","description":"A type for 'quantity' values"}},{"key":{"name":"sale_ID_type","version":"0.0.1"},"value":{"key":{"name":"sale_ID_type","version":"0.0.1"},"UUID":"cca47d74-7754-4a61-b163-ca31f66b157b","description":"A type for 'sale_ID' values"}},{"key":{"name":"timestamp_type","version":"0.0.1"},"value":{"key":{"name":"timestamp_type","version":"0.0.1"},"UUID":"fd594e88-411d-4a94-b2be-697b3a0d7adf","description":"A type for 'time' values"}}]}},"policies":{"key":{"name":"MyFirstPolicyModel_Policies","version":"0.0.1"},"policyMap":{"entry":[{"key":{"name":"MyFirstPolicy","version":"0.0.1"},"value":{"policyKey":{"name":"MyFirstPolicy","version":"0.0.1"},"template":"FREEFORM","state":{"entry":[{"key":"BoozeAuthDecide","value":{"stateKey":{"parentKeyName":"MyFirstPolicy","parentKeyVersion":"0.0.1","parentLocalName":"NULL","localName":"BoozeAuthDecide"},"trigger":{"name":"SALE_INPUT","version":"0.0.1"},"stateOutputs":{"entry":[{"key":"MorningBoozeCheck_Output_Direct","value":{"key":{"parentKeyName":"MyFirstPolicy","parentKeyVersion":"0.0.1","parentLocalName":"BoozeAuthDecide","localName":"MorningBoozeCheck_Output_Direct"},"outgoingEvent":{"name":"SALE_AUTH","version":"0.0.1"},"outgoingEventReference":[{"name":"SALE_AUTH","version":"0.0.1"}],"nextState":{"parentKeyName":"NULL","parentKeyVersion":"0.0.0","parentLocalName":"NULL","localName":"NULL"}}}]},"contextAlbumReference":[],"taskSelectionLogic":{"key":"NULL","logicFlavour":"UNDEFINED","logic":""},"stateFinalizerLogicMap":{"entry":[]},"defaultTask":{"name":"MorningBoozeCheck","version":"0.0.1"},"taskReferences":{"entry":[{"key":{"name":"MorningBoozeCheck","version":"0.0.1"},"value":{"key":{"parentKeyName":"MyFirstPolicy","parentKeyVersion":"0.0.1","parentLocalName":"BoozeAuthDecide","localName":"MorningBoozeCheck"},"outputType":"DIRECT","output":{"parentKeyName":"MyFirstPolicy","parentKeyVersion":"0.0.1","parentLocalName":"BoozeAuthDecide","localName":"MorningBoozeCheck_Output_Direct"}}}]}}}]},"firstState":"BoozeAuthDecide"}}]}},"tasks":{"key":{"name":"MyFirstPolicyModel_Tasks","version":"0.0.1"},"taskMap":{"entry":[{"key":{"name":"MorningBoozeCheck","version":"0.0.1"},"value":{"key":{"name":"MorningBoozeCheck","version":"0.0.1"},"inputEvent":{"key":{"name":"SALE_INPUT","version":"0.0.1"},"nameSpace":"com.hyperm","source":"POS","target":"APEX","parameter":{"entry":[{"key":"amount","value":{"key":"amount","fieldSchemaKey":{"name":"price_type","version":"0.0.1"},"optional":false}},{"key":"assistant_ID","value":{"key":"assistant_ID","fieldSchemaKey":{"name":"assistant_ID_type","version":"0.0.1"},"optional":false}},{"key":"branch_ID","value":{"key":"branch_ID","fieldSchemaKey":{"name":"branch_ID_type","version":"0.0.1"},"optional":false}},{"key":"item_ID","value":{"key":"item_ID","fieldSchemaKey":{"name":"item_ID_type","version":"0.0.1"},"optional":false}},{"key":"notes","value":{"key":"notes","fieldSchemaKey":{"name":"notes_type","version":"0.0.1"},"optional":true}},{"key":"quantity","value":{"key":"quantity","fieldSchemaKey":{"name":"quantity_type","version":"0.0.1"},"optional":false}},{"key":"sale_ID","value":{"key":"sale_ID","fieldSchemaKey":{"name":"sale_ID_type","version":"0.0.1"},"optional":false}},{"key":"time","value":{"key":"time","fieldSchemaKey":{"name":"timestamp_type","version":"0.0.1"},"optional":false}}]}},"outputEvents":{"entry":[{"key":"SALE_AUTH","value":{"key":{"name":"SALE_AUTH","version":"0.0.1"},"nameSpace":"com.hyperm","source":"APEX","target":"POS","parameter":{"entry":[{"key":"amount","value":{"key":"amount","fieldSchemaKey":{"name":"price_type","version":"0.0.1"},"optional":false}},{"key":"assistant_ID","value":{"key":"assistant_ID","fieldSchemaKey":{"name":"assistant_ID_type","version":"0.0.1"},"optional":false}},{"key":"authorised","value":{"key":"authorised","fieldSchemaKey":{"name":"authorised_type","version":"0.0.1"},"optional":false}},{"key":"branch_ID","value":{"key":"branch_ID","fieldSchemaKey":{"name":"branch_ID_type","version":"0.0.1"},"optional":false}},{"key":"item_ID","value":{"key":"item_ID","fieldSchemaKey":{"name":"item_ID_type","version":"0.0.1"},"optional":false}},{"key":"message","value":{"key":"message","fieldSchemaKey":{"name":"message_type","version":"0.0.1"},"optional":true}},{"key":"notes","value":{"key":"notes","fieldSchemaKey":{"name":"notes_type","version":"0.0.1"},"optional":true}},{"key":"quantity","value":{"key":"quantity","fieldSchemaKey":{"name":"quantity_type","version":"0.0.1"},"optional":false}},{"key":"sale_ID","value":{"key":"sale_ID","fieldSchemaKey":{"name":"sale_ID_type","version":"0.0.1"},"optional":false}},{"key":"time","value":{"key":"time","fieldSchemaKey":{"name":"timestamp_type","version":"0.0.1"},"optional":false}}]}}}]},"inputFields":{"entry":[{"key":"amount","value":{"key":"amount","fieldSchemaKey":{"name":"price_type","version":"0.0.1"},"optional":false}},{"key":"assistant_ID","value":{"key":"assistant_ID","fieldSchemaKey":{"name":"assistant_ID_type","version":"0.0.1"},"optional":false}},{"key":"branch_ID","value":{"key":"branch_ID","fieldSchemaKey":{"name":"branch_ID_type","version":"0.0.1"},"optional":false}},{"key":"item_ID","value":{"key":"item_ID","fieldSchemaKey":{"name":"item_ID_type","version":"0.0.1"},"optional":false}},{"key":"notes","value":{"key":"notes","fieldSchemaKey":{"name":"notes_type","version":"0.0.1"},"optional":true}},{"key":"quantity","value":{"key":"quantity","fieldSchemaKey":{"name":"quantity_type","version":"0.0.1"},"optional":false}},{"key":"sale_ID","value":{"key":"sale_ID","fieldSchemaKey":{"name":"sale_ID_type","version":"0.0.1"},"optional":false}},{"key":"time","value":{"key":"time","fieldSchemaKey":{"name":"timestamp_type","version":"0.0.1"},"optional":false}}]},"outputFields":{"entry":[{"key":"amount","value":{"key":"amount","fieldSchemaKey":{"name":"price_type","version":"0.0.1"},"optional":false}},{"key":"assistant_ID","value":{"key":"assistant_ID","fieldSchemaKey":{"name":"assistant_ID_type","version":"0.0.1"},"optional":false}},{"key":"authorised","value":{"key":"authorised","fieldSchemaKey":{"name":"authorised_type","version":"0.0.1"},"optional":false}},{"key":"branch_ID","value":{"key":"branch_ID","fieldSchemaKey":{"name":"branch_ID_type","version":"0.0.1"},"optional":false}},{"key":"item_ID","value":{"key":"item_ID","fieldSchemaKey":{"name":"item_ID_type","version":"0.0.1"},"optional":false}},{"key":"message","value":{"key":"message","fieldSchemaKey":{"name":"message_type","version":"0.0.1"},"optional":true}},{"key":"notes","value":{"key":"notes","fieldSchemaKey":{"name":"notes_type","version":"0.0.1"},"optional":true}},{"key":"quantity","value":{"key":"quantity","fieldSchemaKey":{"name":"quantity_type","version":"0.0.1"},"optional":false}},{"key":"sale_ID","value":{"key":"sale_ID","fieldSchemaKey":{"name":"sale_ID_type","version":"0.0.1"},"optional":false}},{"key":"time","value":{"key":"time","fieldSchemaKey":{"name":"timestamp_type","version":"0.0.1"},"optional":false}}]},"taskParameters":{"entry":[]},"contextAlbumReference":[],"taskLogic":{"key":"TaskLogic","logicFlavour":"MVEL","logic":"/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2016-2018 Ericsson. All rights reserved.\n * Modifications Copyright (C) 2019 Nordix Foundation.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\nimport java.util.Date;\nimport java.util.Calendar;\nimport java.util.TimeZone;\nimport java.text.SimpleDateFormat;\n\nlogger.info(\"Task Execution: '\"+subject.id+\"'. Input Fields: '\"+inFields+\"'\");\n\noutFields.put(\"amount\" , inFields.get(\"amount\"));\noutFields.put(\"assistant_ID\", inFields.get(\"assistant_ID\"));\noutFields.put(\"notes\" , inFields.get(\"notes\"));\noutFields.put(\"quantity\" , inFields.get(\"quantity\"));\noutFields.put(\"branch_ID\" , inFields.get(\"branch_ID\"));\noutFields.put(\"item_ID\" , inFields.get(\"item_ID\"));\noutFields.put(\"time\" , inFields.get(\"time\"));\noutFields.put(\"sale_ID\" , inFields.get(\"sale_ID\"));\n\nitem_id = inFields.get(\"item_ID\");\n\n//The events used later to test this task use GMT timezone!\ngmt = TimeZone.getTimeZone(\"GMT\");\ntimenow = Calendar.getInstance(gmt);\ndf = new SimpleDateFormat(\"HH:mm:ss z\");\ndf.setTimeZone(gmt);\ntimenow.setTimeInMillis(inFields.get(\"time\"));\n\nmidnight = timenow.clone();\nmidnight.set(\n timenow.get(Calendar.YEAR),timenow.get(Calendar.MONTH),\n timenow.get(Calendar.DATE),0,0,0);\neleven30 = timenow.clone();\neleven30.set(\n timenow.get(Calendar.YEAR),timenow.get(Calendar.MONTH),\n timenow.get(Calendar.DATE),11,30,0);\n\nitemisalcohol = false;\nif(item_id != null && item_id >=1000 && item_id < 2000)\n itemisalcohol = true;\n\nif( itemisalcohol\n && timenow.after(midnight) && timenow.before(eleven30)){\n outFields.put(\"authorised\", false);\n outFields.put(\"message\", \"Sale not authorised by policy task \"+subject.taskName+\n \" for time \"+df.format(timenow.getTime())+\n \". Alcohol can not be sold between \"+df.format(midnight.getTime())+\n \" and \"+df.format(eleven30.getTime()));\n return true;\n}\nelse{\n outFields.put(\"authorised\", true);\n outFields.put(\"message\", \"Sale authorised by policy task \"+subject.taskName+\n \" for time \"+df.format(timenow.getTime()));\n return true;\n}\n\n/*\nThis task checks if a sale request is for an item that is an alcoholic drink.\nIf the local time is between 00:00:00 GMT and 11:30:00 GMT then the sale is not\nauthorised. Otherwise the sale is authorised.\nIn this implementation we assume that items with item_ID value between 1000 and\n2000 are all alcoholic drinks :-)\n*/"}}}]}},"events":{"key":{"name":"MyFirstPolicyModel_Events","version":"0.0.1"},"eventMap":{"entry":[{"key":{"name":"SALE_AUTH","version":"0.0.1"},"value":{"key":{"name":"SALE_AUTH","version":"0.0.1"},"nameSpace":"com.hyperm","source":"APEX","target":"POS","parameter":{"entry":[{"key":"amount","value":{"key":"amount","fieldSchemaKey":{"name":"price_type","version":"0.0.1"},"optional":false}},{"key":"assistant_ID","value":{"key":"assistant_ID","fieldSchemaKey":{"name":"assistant_ID_type","version":"0.0.1"},"optional":false}},{"key":"authorised","value":{"key":"authorised","fieldSchemaKey":{"name":"authorised_type","version":"0.0.1"},"optional":false}},{"key":"branch_ID","value":{"key":"branch_ID","fieldSchemaKey":{"name":"branch_ID_type","version":"0.0.1"},"optional":false}},{"key":"item_ID","value":{"key":"item_ID","fieldSchemaKey":{"name":"item_ID_type","version":"0.0.1"},"optional":false}},{"key":"message","value":{"key":"message","fieldSchemaKey":{"name":"message_type","version":"0.0.1"},"optional":true}},{"key":"notes","value":{"key":"notes","fieldSchemaKey":{"name":"notes_type","version":"0.0.1"},"optional":true}},{"key":"quantity","value":{"key":"quantity","fieldSchemaKey":{"name":"quantity_type","version":"0.0.1"},"optional":false}},{"key":"sale_ID","value":{"key":"sale_ID","fieldSchemaKey":{"name":"sale_ID_type","version":"0.0.1"},"optional":false}},{"key":"time","value":{"key":"time","fieldSchemaKey":{"name":"timestamp_type","version":"0.0.1"},"optional":false}}]}}},{"key":{"name":"SALE_INPUT","version":"0.0.1"},"value":{"key":{"name":"SALE_INPUT","version":"0.0.1"},"nameSpace":"com.hyperm","source":"POS","target":"APEX","parameter":{"entry":[{"key":"amount","value":{"key":"amount","fieldSchemaKey":{"name":"price_type","version":"0.0.1"},"optional":false}},{"key":"assistant_ID","value":{"key":"assistant_ID","fieldSchemaKey":{"name":"assistant_ID_type","version":"0.0.1"},"optional":false}},{"key":"branch_ID","value":{"key":"branch_ID","fieldSchemaKey":{"name":"branch_ID_type","version":"0.0.1"},"optional":false}},{"key":"item_ID","value":{"key":"item_ID","fieldSchemaKey":{"name":"item_ID_type","version":"0.0.1"},"optional":false}},{"key":"notes","value":{"key":"notes","fieldSchemaKey":{"name":"notes_type","version":"0.0.1"},"optional":true}},{"key":"quantity","value":{"key":"quantity","fieldSchemaKey":{"name":"quantity_type","version":"0.0.1"},"optional":false}},{"key":"sale_ID","value":{"key":"sale_ID","fieldSchemaKey":{"name":"sale_ID_type","version":"0.0.1"},"optional":false}},{"key":"time","value":{"key":"time","fieldSchemaKey":{"name":"timestamp_type","version":"0.0.1"},"optional":false}}]}}}]}},"schemas":{"key":{"name":"MyFirstPolicyModel_Schemas","version":"0.0.1"},"schemas":{"entry":[{"key":{"name":"assistant_ID_type","version":"0.0.1"},"value":{"key":{"name":"assistant_ID_type","version":"0.0.1"},"schemaFlavour":"Java","schemaDefinition":"java.lang.Long"}},{"key":{"name":"authorised_type","version":"0.0.1"},"value":{"key":{"name":"authorised_type","version":"0.0.1"},"schemaFlavour":"Java","schemaDefinition":"java.lang.Boolean"}},{"key":{"name":"branch_ID_type","version":"0.0.1"},"value":{"key":{"name":"branch_ID_type","version":"0.0.1"},"schemaFlavour":"Java","schemaDefinition":"java.lang.Long"}},{"key":{"name":"item_ID_type","version":"0.0.1"},"value":{"key":{"name":"item_ID_type","version":"0.0.1"},"schemaFlavour":"Java","schemaDefinition":"java.lang.Long"}},{"key":{"name":"message_type","version":"0.0.1"},"value":{"key":{"name":"message_type","version":"0.0.1"},"schemaFlavour":"Java","schemaDefinition":"java.lang.String"}},{"key":{"name":"notes_type","version":"0.0.1"},"value":{"key":{"name":"notes_type","version":"0.0.1"},"schemaFlavour":"Java","schemaDefinition":"java.lang.String"}},{"key":{"name":"price_type","version":"0.0.1"},"value":{"key":{"name":"price_type","version":"0.0.1"},"schemaFlavour":"Java","schemaDefinition":"java.lang.Long"}},{"key":{"name":"quantity_type","version":"0.0.1"},"value":{"key":{"name":"quantity_type","version":"0.0.1"},"schemaFlavour":"Java","schemaDefinition":"java.lang.Integer"}},{"key":{"name":"sale_ID_type","version":"0.0.1"},"value":{"key":{"name":"sale_ID_type","version":"0.0.1"},"schemaFlavour":"Java","schemaDefinition":"java.lang.Long"}},{"key":{"name":"timestamp_type","version":"0.0.1"},"value":{"key":{"name":"timestamp_type","version":"0.0.1"},"schemaFlavour":"Java","schemaDefinition":"java.lang.Long"}}]}}}}},"eventOutputParameters":{"FirstProducer":{"carrierTechnologyParameters":{"carrierTechnology":"FILE","parameters":{"standardIo":true}},"eventProtocolParameters":{"eventProtocol":"JSON"}}},"eventInputParameters":{"FirstConsumer":{"carrierTechnologyParameters":{"carrierTechnology":"FILE","parameters":{"standardIo":true}},"eventProtocolParameters":{"eventProtocol":"JSON"}}}}}}]}} \ No newline at end of file +{"tosca_definitions_version":"tosca_simple_yaml_1_1_0","topology_template":{"policies":[{"native.sampledomain":{"type":"onap.policies.native.Apex","type_version":"1.0.0","name":"native.sampledomain","version":"1.0.0","properties":{"engineServiceParameters":{"name":"MyFirstPolicyApexEngine","version":"0.0.1","id":101,"instanceCount":4,"deploymentPort":12345,"engineParameters":{"executorParameters":{"MVEL":{"parameterClassName":"org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters"},"JAVASCRIPT":{"parameterClassName":"org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters"}}},"policy_type_impl":{"apexPolicyModel":{"key":{"name":"MyFirstPolicyModel","version":"0.0.1"},"keyInformation":{"key":{"name":"MyFirstPolicyModel_KeyInfo","version":"0.0.1"},"keyInfoMap":{"entry":[{"key":{"name":"MorningBoozeCheck","version":"0.0.1"},"value":{"key":{"name":"MorningBoozeCheck","version":"0.0.1"},"UUID":"3351b0f4-cf06-4fa2-8823-edf67bd30223","description":"This task checks if the sales request is for an item that contains alcohol. \nIf the local time is between 00:00:00 and 11:30:00 then the sale is not authorised. Otherwise the sale is authorised. \nIn this implementation we assume that all items with item_ID values between 1000 and 2000 contain alcohol :-)"}},{"key":{"name":"MyFirstPolicy","version":"0.0.1"},"value":{"key":{"name":"MyFirstPolicy","version":"0.0.1"},"UUID":"6c5e410f-489a-46ff-964e-982ce6e8b6d0","description":"This is my first Apex policy. It checks if a sale should be authorised or not."}},{"key":{"name":"MyFirstPolicyModel","version":"0.0.1"},"value":{"key":{"name":"MyFirstPolicyModel","version":"0.0.1"},"UUID":"540226fb-55ee-4f0e-a444-983a0494818e","description":"This is my first Apex Policy Model."}},{"key":{"name":"MyFirstPolicyModel_Events","version":"0.0.1"},"value":{"key":{"name":"MyFirstPolicyModel_Events","version":"0.0.1"},"UUID":"ef281318-5ac9-3ef0-8db3-8f9c4e4a81e2","description":"Generated description for concept referred to by key \"MyFirstPolicyModel_Events:0.0.1\""}},{"key":{"name":"MyFirstPolicyModel_KeyInfo","version":"0.0.1"},"value":{"key":{"name":"MyFirstPolicyModel_KeyInfo","version":"0.0.1"},"UUID":"d9248c6f-7c00-38df-8251-611463ba4065","description":"Generated description for concept referred to by key \"MyFirstPolicyModel_KeyInfo:0.0.1\""}},{"key":{"name":"MyFirstPolicyModel_Policies","version":"0.0.1"},"value":{"key":{"name":"MyFirstPolicyModel_Policies","version":"0.0.1"},"UUID":"77c01a6b-510c-3aa9-b640-b4db356aa03b","description":"Generated description for concept referred to by key \"MyFirstPolicyModel_Policies:0.0.1\""}},{"key":{"name":"MyFirstPolicyModel_Schemas","version":"0.0.1"},"value":{"key":{"name":"MyFirstPolicyModel_Schemas","version":"0.0.1"},"UUID":"d0cc3aa0-ea69-3a43-80ff-a0dbb0ebd885","description":"Generated description for concept referred to by key \"MyFirstPolicyModel_Schemas:0.0.1\""}},{"key":{"name":"MyFirstPolicyModel_Tasks","version":"0.0.1"},"value":{"key":{"name":"MyFirstPolicyModel_Tasks","version":"0.0.1"},"UUID":"b02a7e02-2cd0-39e6-b3cb-946fa83a8f08","description":"Generated description for concept referred to by key \"MyFirstPolicyModel_Tasks:0.0.1\""}},{"key":{"name":"SALE_AUTH","version":"0.0.1"},"value":{"key":{"name":"SALE_AUTH","version":"0.0.1"},"UUID":"c4500941-3f98-4080-a9cc-5b9753ed050b","description":"An event emitted by the Policy to indicate whether the sale of an item has been authorised"}},{"key":{"name":"SALE_INPUT","version":"0.0.1"},"value":{"key":{"name":"SALE_INPUT","version":"0.0.1"},"UUID":"4f04aa98-e917-4f4a-882a-c75ba5a99374","description":"An event raised by the PoS system each time an item is scanned for purchase"}},{"key":{"name":"assistant_ID_type","version":"0.0.1"},"value":{"key":{"name":"assistant_ID_type","version":"0.0.1"},"UUID":"36df4c71-9616-4206-8b53-976a5cd4bd87","description":"A type for 'assistant_ID' values"}},{"key":{"name":"authorised_type","version":"0.0.1"},"value":{"key":{"name":"authorised_type","version":"0.0.1"},"UUID":"d48b619e-d00d-4008-b884-02d76ea4350b","description":"A type for 'authorised' values"}},{"key":{"name":"branch_ID_type","version":"0.0.1"},"value":{"key":{"name":"branch_ID_type","version":"0.0.1"},"UUID":"6468845f-4122-4128-8e49-0f52c26078b5","description":"A type for 'branch_ID' values"}},{"key":{"name":"item_ID_type","version":"0.0.1"},"value":{"key":{"name":"item_ID_type","version":"0.0.1"},"UUID":"4f227ff1-aee0-453a-b6b6-9a4b2e0da932","description":"A type for 'item_ID' values"}},{"key":{"name":"message_type","version":"0.0.1"},"value":{"key":{"name":"message_type","version":"0.0.1"},"UUID":"ad1431bb-3155-4e73-b5a3-b89bee498749","description":"A type for 'message' values"}},{"key":{"name":"notes_type","version":"0.0.1"},"value":{"key":{"name":"notes_type","version":"0.0.1"},"UUID":"eecfde90-896c-4343-8f9c-2603ced94e2d","description":"A type for 'notes' values"}},{"key":{"name":"price_type","version":"0.0.1"},"value":{"key":{"name":"price_type","version":"0.0.1"},"UUID":"52c2fc45-fd8c-463c-bd6f-d91b0554aea7","description":"A type for 'amount'/'price' values"}},{"key":{"name":"quantity_type","version":"0.0.1"},"value":{"key":{"name":"quantity_type","version":"0.0.1"},"UUID":"ac3d9842-80af-4a98-951c-bd79a431c613","description":"A type for 'quantity' values"}},{"key":{"name":"sale_ID_type","version":"0.0.1"},"value":{"key":{"name":"sale_ID_type","version":"0.0.1"},"UUID":"cca47d74-7754-4a61-b163-ca31f66b157b","description":"A type for 'sale_ID' values"}},{"key":{"name":"timestamp_type","version":"0.0.1"},"value":{"key":{"name":"timestamp_type","version":"0.0.1"},"UUID":"fd594e88-411d-4a94-b2be-697b3a0d7adf","description":"A type for 'time' values"}}]}},"policies":{"key":{"name":"MyFirstPolicyModel_Policies","version":"0.0.1"},"policyMap":{"entry":[{"key":{"name":"MyFirstPolicy","version":"0.0.1"},"value":{"policyKey":{"name":"MyFirstPolicy","version":"0.0.1"},"template":"FREEFORM","state":{"entry":[{"key":"BoozeAuthDecide","value":{"stateKey":{"parentKeyName":"MyFirstPolicy","parentKeyVersion":"0.0.1","parentLocalName":"NULL","localName":"BoozeAuthDecide"},"trigger":{"name":"SALE_INPUT","version":"0.0.1"},"stateOutputs":{"entry":[{"key":"MorningBoozeCheck_Output_Direct","value":{"key":{"parentKeyName":"MyFirstPolicy","parentKeyVersion":"0.0.1","parentLocalName":"BoozeAuthDecide","localName":"MorningBoozeCheck_Output_Direct"},"outgoingEvent":{"name":"SALE_AUTH","version":"0.0.1"},"outgoingEventReference":[{"name":"SALE_AUTH","version":"0.0.1"}],"nextState":{"parentKeyName":"NULL","parentKeyVersion":"0.0.0","parentLocalName":"NULL","localName":"NULL"}}}]},"contextAlbumReference":[],"taskSelectionLogic":{"key":"NULL","logicFlavour":"UNDEFINED","logic":""},"stateFinalizerLogicMap":{"entry":[]},"defaultTask":{"name":"MorningBoozeCheck","version":"0.0.1"},"taskReferences":{"entry":[{"key":{"name":"MorningBoozeCheck","version":"0.0.1"},"value":{"key":{"parentKeyName":"MyFirstPolicy","parentKeyVersion":"0.0.1","parentLocalName":"BoozeAuthDecide","localName":"MorningBoozeCheck"},"outputType":"DIRECT","output":{"parentKeyName":"MyFirstPolicy","parentKeyVersion":"0.0.1","parentLocalName":"BoozeAuthDecide","localName":"MorningBoozeCheck_Output_Direct"}}}]}}}]},"firstState":"BoozeAuthDecide"}}]}},"tasks":{"key":{"name":"MyFirstPolicyModel_Tasks","version":"0.0.1"},"taskMap":{"entry":[{"key":{"name":"MorningBoozeCheck","version":"0.0.1"},"value":{"key":{"name":"MorningBoozeCheck","version":"0.0.1"},"inputEvent":{"key":{"name":"SALE_INPUT","version":"0.0.1"},"nameSpace":"com.hyperm","source":"POS","target":"APEX","parameter":{"entry":[{"key":"amount","value":{"key":"amount","fieldSchemaKey":{"name":"price_type","version":"0.0.1"},"optional":false}},{"key":"assistant_ID","value":{"key":"assistant_ID","fieldSchemaKey":{"name":"assistant_ID_type","version":"0.0.1"},"optional":false}},{"key":"branch_ID","value":{"key":"branch_ID","fieldSchemaKey":{"name":"branch_ID_type","version":"0.0.1"},"optional":false}},{"key":"item_ID","value":{"key":"item_ID","fieldSchemaKey":{"name":"item_ID_type","version":"0.0.1"},"optional":false}},{"key":"notes","value":{"key":"notes","fieldSchemaKey":{"name":"notes_type","version":"0.0.1"},"optional":true}},{"key":"quantity","value":{"key":"quantity","fieldSchemaKey":{"name":"quantity_type","version":"0.0.1"},"optional":false}},{"key":"sale_ID","value":{"key":"sale_ID","fieldSchemaKey":{"name":"sale_ID_type","version":"0.0.1"},"optional":false}},{"key":"time","value":{"key":"time","fieldSchemaKey":{"name":"timestamp_type","version":"0.0.1"},"optional":false}}]}},"outputEvents":{"entry":[{"key":"SALE_AUTH","value":{"key":{"name":"SALE_AUTH","version":"0.0.1"},"nameSpace":"com.hyperm","source":"APEX","target":"POS","parameter":{"entry":[{"key":"amount","value":{"key":"amount","fieldSchemaKey":{"name":"price_type","version":"0.0.1"},"optional":false}},{"key":"assistant_ID","value":{"key":"assistant_ID","fieldSchemaKey":{"name":"assistant_ID_type","version":"0.0.1"},"optional":false}},{"key":"authorised","value":{"key":"authorised","fieldSchemaKey":{"name":"authorised_type","version":"0.0.1"},"optional":false}},{"key":"branch_ID","value":{"key":"branch_ID","fieldSchemaKey":{"name":"branch_ID_type","version":"0.0.1"},"optional":false}},{"key":"item_ID","value":{"key":"item_ID","fieldSchemaKey":{"name":"item_ID_type","version":"0.0.1"},"optional":false}},{"key":"message","value":{"key":"message","fieldSchemaKey":{"name":"message_type","version":"0.0.1"},"optional":true}},{"key":"notes","value":{"key":"notes","fieldSchemaKey":{"name":"notes_type","version":"0.0.1"},"optional":true}},{"key":"quantity","value":{"key":"quantity","fieldSchemaKey":{"name":"quantity_type","version":"0.0.1"},"optional":false}},{"key":"sale_ID","value":{"key":"sale_ID","fieldSchemaKey":{"name":"sale_ID_type","version":"0.0.1"},"optional":false}},{"key":"time","value":{"key":"time","fieldSchemaKey":{"name":"timestamp_type","version":"0.0.1"},"optional":false}}]}}}]},"taskParameters":{"entry":[]},"contextAlbumReference":[],"taskLogic":{"key":"TaskLogic","logicFlavour":"MVEL","logic":"/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2016-2018 Ericsson. All rights reserved.\n * Modifications Copyright (C) 2019 Nordix Foundation.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\nimport java.util.Date;\nimport java.util.Calendar;\nimport java.util.TimeZone;\nimport java.text.SimpleDateFormat;\n\nlogger.info(\"Task Execution: '\"+subject.id+\"'. Input Fields: '\"+inFields+\"'\");\n\noutFields.put(\"amount\" , inFields.get(\"amount\"));\noutFields.put(\"assistant_ID\", inFields.get(\"assistant_ID\"));\noutFields.put(\"notes\" , inFields.get(\"notes\"));\noutFields.put(\"quantity\" , inFields.get(\"quantity\"));\noutFields.put(\"branch_ID\" , inFields.get(\"branch_ID\"));\noutFields.put(\"item_ID\" , inFields.get(\"item_ID\"));\noutFields.put(\"time\" , inFields.get(\"time\"));\noutFields.put(\"sale_ID\" , inFields.get(\"sale_ID\"));\n\nitem_id = inFields.get(\"item_ID\");\n\n//The events used later to test this task use GMT timezone!\ngmt = TimeZone.getTimeZone(\"GMT\");\ntimenow = Calendar.getInstance(gmt);\ndf = new SimpleDateFormat(\"HH:mm:ss z\");\ndf.setTimeZone(gmt);\ntimenow.setTimeInMillis(inFields.get(\"time\"));\n\nmidnight = timenow.clone();\nmidnight.set(\n timenow.get(Calendar.YEAR),timenow.get(Calendar.MONTH),\n timenow.get(Calendar.DATE),0,0,0);\neleven30 = timenow.clone();\neleven30.set(\n timenow.get(Calendar.YEAR),timenow.get(Calendar.MONTH),\n timenow.get(Calendar.DATE),11,30,0);\n\nitemisalcohol = false;\nif(item_id != null && item_id >=1000 && item_id < 2000)\n itemisalcohol = true;\n\nif( itemisalcohol\n && timenow.after(midnight) && timenow.before(eleven30)){\n outFields.put(\"authorised\", false);\n outFields.put(\"message\", \"Sale not authorised by policy task \"+subject.taskName+\n \" for time \"+df.format(timenow.getTime())+\n \". Alcohol can not be sold between \"+df.format(midnight.getTime())+\n \" and \"+df.format(eleven30.getTime()));\n return true;\n}\nelse{\n outFields.put(\"authorised\", true);\n outFields.put(\"message\", \"Sale authorised by policy task \"+subject.taskName+\n \" for time \"+df.format(timenow.getTime()));\n return true;\n}\n\n/*\nThis task checks if a sale request is for an item that is an alcoholic drink.\nIf the local time is between 00:00:00 GMT and 11:30:00 GMT then the sale is not\nauthorised. Otherwise the sale is authorised.\nIn this implementation we assume that items with item_ID value between 1000 and\n2000 are all alcoholic drinks :-)\n*/"}}}]}},"events":{"key":{"name":"MyFirstPolicyModel_Events","version":"0.0.1"},"eventMap":{"entry":[{"key":{"name":"SALE_AUTH","version":"0.0.1"},"value":{"key":{"name":"SALE_AUTH","version":"0.0.1"},"nameSpace":"com.hyperm","source":"APEX","target":"POS","parameter":{"entry":[{"key":"amount","value":{"key":"amount","fieldSchemaKey":{"name":"price_type","version":"0.0.1"},"optional":false}},{"key":"assistant_ID","value":{"key":"assistant_ID","fieldSchemaKey":{"name":"assistant_ID_type","version":"0.0.1"},"optional":false}},{"key":"authorised","value":{"key":"authorised","fieldSchemaKey":{"name":"authorised_type","version":"0.0.1"},"optional":false}},{"key":"branch_ID","value":{"key":"branch_ID","fieldSchemaKey":{"name":"branch_ID_type","version":"0.0.1"},"optional":false}},{"key":"item_ID","value":{"key":"item_ID","fieldSchemaKey":{"name":"item_ID_type","version":"0.0.1"},"optional":false}},{"key":"message","value":{"key":"message","fieldSchemaKey":{"name":"message_type","version":"0.0.1"},"optional":true}},{"key":"notes","value":{"key":"notes","fieldSchemaKey":{"name":"notes_type","version":"0.0.1"},"optional":true}},{"key":"quantity","value":{"key":"quantity","fieldSchemaKey":{"name":"quantity_type","version":"0.0.1"},"optional":false}},{"key":"sale_ID","value":{"key":"sale_ID","fieldSchemaKey":{"name":"sale_ID_type","version":"0.0.1"},"optional":false}},{"key":"time","value":{"key":"time","fieldSchemaKey":{"name":"timestamp_type","version":"0.0.1"},"optional":false}}]}}},{"key":{"name":"SALE_INPUT","version":"0.0.1"},"value":{"key":{"name":"SALE_INPUT","version":"0.0.1"},"nameSpace":"com.hyperm","source":"POS","target":"APEX","parameter":{"entry":[{"key":"amount","value":{"key":"amount","fieldSchemaKey":{"name":"price_type","version":"0.0.1"},"optional":false}},{"key":"assistant_ID","value":{"key":"assistant_ID","fieldSchemaKey":{"name":"assistant_ID_type","version":"0.0.1"},"optional":false}},{"key":"branch_ID","value":{"key":"branch_ID","fieldSchemaKey":{"name":"branch_ID_type","version":"0.0.1"},"optional":false}},{"key":"item_ID","value":{"key":"item_ID","fieldSchemaKey":{"name":"item_ID_type","version":"0.0.1"},"optional":false}},{"key":"notes","value":{"key":"notes","fieldSchemaKey":{"name":"notes_type","version":"0.0.1"},"optional":true}},{"key":"quantity","value":{"key":"quantity","fieldSchemaKey":{"name":"quantity_type","version":"0.0.1"},"optional":false}},{"key":"sale_ID","value":{"key":"sale_ID","fieldSchemaKey":{"name":"sale_ID_type","version":"0.0.1"},"optional":false}},{"key":"time","value":{"key":"time","fieldSchemaKey":{"name":"timestamp_type","version":"0.0.1"},"optional":false}}]}}}]}},"schemas":{"key":{"name":"MyFirstPolicyModel_Schemas","version":"0.0.1"},"schemas":{"entry":[{"key":{"name":"assistant_ID_type","version":"0.0.1"},"value":{"key":{"name":"assistant_ID_type","version":"0.0.1"},"schemaFlavour":"Java","schemaDefinition":"java.lang.Long"}},{"key":{"name":"authorised_type","version":"0.0.1"},"value":{"key":{"name":"authorised_type","version":"0.0.1"},"schemaFlavour":"Java","schemaDefinition":"java.lang.Boolean"}},{"key":{"name":"branch_ID_type","version":"0.0.1"},"value":{"key":{"name":"branch_ID_type","version":"0.0.1"},"schemaFlavour":"Java","schemaDefinition":"java.lang.Long"}},{"key":{"name":"item_ID_type","version":"0.0.1"},"value":{"key":{"name":"item_ID_type","version":"0.0.1"},"schemaFlavour":"Java","schemaDefinition":"java.lang.Long"}},{"key":{"name":"message_type","version":"0.0.1"},"value":{"key":{"name":"message_type","version":"0.0.1"},"schemaFlavour":"Java","schemaDefinition":"java.lang.String"}},{"key":{"name":"notes_type","version":"0.0.1"},"value":{"key":{"name":"notes_type","version":"0.0.1"},"schemaFlavour":"Java","schemaDefinition":"java.lang.String"}},{"key":{"name":"price_type","version":"0.0.1"},"value":{"key":{"name":"price_type","version":"0.0.1"},"schemaFlavour":"Java","schemaDefinition":"java.lang.Long"}},{"key":{"name":"quantity_type","version":"0.0.1"},"value":{"key":{"name":"quantity_type","version":"0.0.1"},"schemaFlavour":"Java","schemaDefinition":"java.lang.Integer"}},{"key":{"name":"sale_ID_type","version":"0.0.1"},"value":{"key":{"name":"sale_ID_type","version":"0.0.1"},"schemaFlavour":"Java","schemaDefinition":"java.lang.Long"}},{"key":{"name":"timestamp_type","version":"0.0.1"},"value":{"key":{"name":"timestamp_type","version":"0.0.1"},"schemaFlavour":"Java","schemaDefinition":"java.lang.Long"}}]}}}}},"eventOutputParameters":{"FirstProducer":{"carrierTechnologyParameters":{"carrierTechnology":"FILE","parameters":{"standardIo":true}},"eventProtocolParameters":{"eventProtocol":"JSON"}}},"eventInputParameters":{"FirstConsumer":{"carrierTechnologyParameters":{"carrierTechnology":"FILE","parameters":{"standardIo":true}},"eventProtocolParameters":{"eventProtocol":"JSON"}}}}}}]}} diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java index 878d5277a..d45be9652 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java @@ -50,6 +50,7 @@ import org.onap.policy.apex.model.eventmodel.concepts.AxEvent; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; import org.onap.policy.apex.model.policymodel.concepts.AxState; import org.onap.policy.apex.model.policymodel.concepts.AxStateOutput; +import org.onap.policy.apex.model.policymodel.concepts.AxStateTaskOutputType; import org.onap.policy.apex.model.policymodel.concepts.AxStateTaskReference; import org.onap.policy.apex.model.policymodel.concepts.AxTask; import org.slf4j.ext.XLogger; @@ -180,26 +181,34 @@ public class ApexEngineImpl implements ApexEngine { private void updateTaskBasedOnStateOutput(AxPolicyModel apexPolicyModel, Set updatedTasks, AxState state, AxArtifactKey taskKey, AxStateTaskReference taskRef, AxTask task) { Map outputEvents = new TreeMap<>(); - AxStateOutput stateOutput = state.getStateOutputs().get(taskRef.getOutput().getLocalName()); - if (null == stateOutput.getOutgoingEventSet() || stateOutput.getOutgoingEventSet().isEmpty()) { - Set outEventSet = new TreeSet<>(); - outEventSet.add(stateOutput.getOutgoingEvent()); - stateOutput.setOutgoingEventSet(outEventSet); - } - if (state.getNextStateSet().isEmpty() - || state.getNextStateSet().contains(AxReferenceKey.getNullKey().getLocalName())) { - stateOutput.getOutgoingEventSet().forEach(outgoingEventKey -> outputEvents.put(outgoingEventKey.getName(), - apexPolicyModel.getEvents().get(outgoingEventKey))); + AxStateOutput stateOutput = null; + if (AxStateTaskOutputType.LOGIC.equals(taskRef.getStateTaskOutputType())) { + // in case of SFL, outgoing event will be same for all state outputs that are part of SFL.So, take any entry + stateOutput = state.getStateOutputs().values().iterator().next(); } else { - AxArtifactKey outgoingEventKey = stateOutput.getOutgoingEvent(); - outputEvents.put(outgoingEventKey.getName(), apexPolicyModel.getEvents().get(outgoingEventKey)); + stateOutput = state.getStateOutputs().get(taskRef.getOutput().getLocalName()); } - if (updatedTasks.contains(taskKey)) { - // this happens only when same task is used by multiple policies - // with different eventName but same fields - task.getOutputEvents().putAll(outputEvents); - } else { - task.setOutputEvents(outputEvents); + if (null != stateOutput) { + if (null == stateOutput.getOutgoingEventSet() || stateOutput.getOutgoingEventSet().isEmpty()) { + Set outEventSet = new TreeSet<>(); + outEventSet.add(stateOutput.getOutgoingEvent()); + stateOutput.setOutgoingEventSet(outEventSet); + } + if (state.getNextStateSet().isEmpty() + || state.getNextStateSet().contains(AxReferenceKey.getNullKey().getLocalName())) { + stateOutput.getOutgoingEventSet().forEach(outgoingEventKey -> outputEvents + .put(outgoingEventKey.getName(), apexPolicyModel.getEvents().get(outgoingEventKey))); + } else { + AxArtifactKey outgoingEventKey = stateOutput.getOutgoingEvent(); + outputEvents.put(outgoingEventKey.getName(), apexPolicyModel.getEvents().get(outgoingEventKey)); + } + if (updatedTasks.contains(taskKey)) { + // this happens only when same task is used by multiple policies + // with different eventName but same fields + task.getOutputEvents().putAll(outputEvents); + } else { + task.setOutputEvents(outputEvents); + } } } diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/TaskExecutorTest.java b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/TaskExecutorTest.java index 1ddc3f5b5..4160a9f19 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/TaskExecutorTest.java +++ b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/TaskExecutorTest.java @@ -125,8 +125,6 @@ public class TaskExecutorTest { Mockito.doReturn(true).when(axOptionalOutputFieldMock).getOptional(); Mockito.doReturn(false).when(axMissingOutputFieldMock).getOptional(); - Mockito.doReturn(inFieldMap).when(axTaskMock).getInputFields(); - Mockito.doReturn(outFieldMap).when(axTaskMock).getOutputFields(); Mockito.doReturn(taskLogicMock).when(axTaskMock).getTaskLogic(); Mockito.doReturn(inEvent).when(axTaskMock).getInputEvent(); diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacadeTest.java b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacadeTest.java index 6f8402e55..9da8ecfad 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacadeTest.java +++ b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacadeTest.java @@ -99,9 +99,6 @@ public class AxTaskFacadeTest { Mockito.doReturn(inEvent).when(axTaskMock).getInputEvent(); Mockito.doReturn(outEvents).when(axTaskMock).getOutputEvents(); - Mockito.doReturn(inFieldMap).when(axTaskMock).getInputFields(); - Mockito.doReturn(outFieldMap).when(axTaskMock).getOutputFields(); - Mockito.doReturn(new AxReferenceKey(task0Key, "InField0")).when(axInputFieldMock).getKey(); Mockito.doReturn(stringTypeKey).when(axInputFieldMock).getSchema(); diff --git a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AadmDomainModelFactory.java b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AadmDomainModelFactory.java index c0003ac68..09fd9a105 100644 --- a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AadmDomainModelFactory.java +++ b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AadmDomainModelFactory.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -366,94 +367,64 @@ public class AadmDomainModelFactory { .setLogicPackage(this.getClass().getPackage().getName()).setDefaultLogic(null); final AxTask aadmMatchTask = new AxTask(new AxArtifactKey("AADMMatchTask", DEFAULT_VERSION)); - aadmMatchTask.duplicateInputFields(aadmEvent.getParameterMap()); - aadmMatchTask.duplicateOutputFields(aadmEvent.getParameterMap()); aadmMatchTask.getContextAlbumReferences().add(eNodeBStatusAlbum.getKey()); aadmMatchTask.getContextAlbumReferences().add(imsiStatusAlbum.getKey()); aadmMatchTask.getContextAlbumReferences().add(ipAddressStatusAlbum.getKey()); aadmMatchTask.setTaskLogic(new AxTaskLogic(aadmMatchTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); final AxTask aadmEstablishTask = new AxTask(new AxArtifactKey("AADMEstablishTask", DEFAULT_VERSION)); - aadmEstablishTask.duplicateInputFields(aadmEvent.getParameterMap()); - aadmEstablishTask.duplicateOutputFields(aadmEvent.getParameterMap()); logicReader.setDefaultLogic(DEFAULT_TASK_LOGIC); aadmEstablishTask.setTaskLogic(new AxTaskLogic(aadmEstablishTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); final AxTask aadmDecideTask = new AxTask(new AxArtifactKey("AADMDecideTask", DEFAULT_VERSION)); - aadmDecideTask.duplicateInputFields(aadmEvent.getParameterMap()); - aadmDecideTask.duplicateOutputFields(aadmEvent.getParameterMap()); aadmDecideTask.setTaskLogic(new AxTaskLogic(aadmDecideTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); logicReader.setDefaultLogic(null); final AxTask aadmDoSSuggestionActTask = new AxTask( new AxArtifactKey("AADMDoSSuggestionActTask", DEFAULT_VERSION)); - aadmDoSSuggestionActTask.duplicateInputFields(aadmEvent.getParameterMap()); - aadmDoSSuggestionActTask.duplicateOutputFields(aadmXStreamActEvent.getParameterMap()); aadmDoSSuggestionActTask.getContextAlbumReferences().add(eNodeBStatusAlbum.getKey()); aadmDoSSuggestionActTask.getContextAlbumReferences().add(imsiStatusAlbum.getKey()); aadmDoSSuggestionActTask.setTaskLogic( new AxTaskLogic(aadmDoSSuggestionActTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); final AxTask aadmNoActTask = new AxTask(new AxArtifactKey("AADMNoActTask", DEFAULT_VERSION)); - aadmNoActTask.duplicateInputFields(aadmEvent.getParameterMap()); - aadmNoActTask.duplicateOutputFields(aadmXStreamActEvent.getParameterMap()); aadmNoActTask.setTaskLogic(new AxTaskLogic(aadmNoActTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); final AxTask aadmDoSProvenActTask = new AxTask(new AxArtifactKey("AADMDoSProvenActTask", DEFAULT_VERSION)); - aadmDoSProvenActTask.duplicateInputFields(aadmEvent.getParameterMap()); - aadmDoSProvenActTask.duplicateOutputFields(aadmXStreamActEvent.getParameterMap()); aadmDoSProvenActTask.getContextAlbumReferences().add(eNodeBStatusAlbum.getKey()); aadmDoSProvenActTask.getContextAlbumReferences().add(imsiStatusAlbum.getKey()); aadmDoSProvenActTask .setTaskLogic(new AxTaskLogic(aadmDoSProvenActTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); final AxTask vMmeMatchTask = new AxTask(new AxArtifactKey("VMMEMatchTask", DEFAULT_VERSION)); - vMmeMatchTask.duplicateInputFields(vMmeEvent.getParameterMap()); - vMmeMatchTask.duplicateOutputFields(vMmeEvent.getParameterMap()); vMmeMatchTask.setTaskLogic(new AxTaskLogic(vMmeMatchTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); final AxTask vMmeEstablishTask = new AxTask(new AxArtifactKey("VMMEEstablishTask", DEFAULT_VERSION)); - vMmeEstablishTask.duplicateInputFields(vMmeEvent.getParameterMap()); - vMmeEstablishTask.duplicateOutputFields(vMmeEvent.getParameterMap()); logicReader.setDefaultLogic(DEFAULT_TASK_LOGIC); vMmeEstablishTask.setTaskLogic(new AxTaskLogic(vMmeEstablishTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); final AxTask vMmeDecideTask = new AxTask(new AxArtifactKey("VMMEDecideTask", DEFAULT_VERSION)); - vMmeDecideTask.duplicateInputFields(vMmeEvent.getParameterMap()); - vMmeDecideTask.duplicateOutputFields(vMmeEvent.getParameterMap()); vMmeDecideTask.setTaskLogic(new AxTaskLogic(vMmeDecideTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); final AxTask vMmeNoActTask = new AxTask(new AxArtifactKey("VMMENoActTask", DEFAULT_VERSION)); - vMmeNoActTask.duplicateInputFields(vMmeEvent.getParameterMap()); - vMmeNoActTask.duplicateOutputFields(vMmeEvent.getParameterMap()); vMmeNoActTask.setTaskLogic(new AxTaskLogic(vMmeNoActTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); final AxTask vMmeActTask = new AxTask(new AxArtifactKey("VMMEActTask", DEFAULT_VERSION)); - vMmeActTask.duplicateInputFields(vMmeEvent.getParameterMap()); - vMmeActTask.duplicateOutputFields(vMmeEvent.getParameterMap()); logicReader.setDefaultLogic(null); vMmeActTask.setTaskLogic(new AxTaskLogic(vMmeActTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); final AxTask sapcMatchTask = new AxTask(new AxArtifactKey("SAPCMatchTask", DEFAULT_VERSION)); - sapcMatchTask.duplicateInputFields(sapcEvent.getParameterMap()); - sapcMatchTask.duplicateOutputFields(sapcBlacklistSubscriberEvent.getParameterMap()); sapcMatchTask.setTaskLogic(new AxTaskLogic(sapcMatchTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); final AxTask sapcEstablishTask = new AxTask(new AxArtifactKey("SAPCEstablishTask", DEFAULT_VERSION)); - sapcEstablishTask.duplicateInputFields(sapcEvent.getParameterMap()); - sapcEstablishTask.duplicateOutputFields(sapcBlacklistSubscriberEvent.getParameterMap()); logicReader.setDefaultLogic(DEFAULT_TASK_LOGIC); sapcEstablishTask.setTaskLogic(new AxTaskLogic(sapcEstablishTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); final AxTask sapcDecideTask = new AxTask(new AxArtifactKey("SAPCDecideTask", DEFAULT_VERSION)); - sapcDecideTask.duplicateInputFields(sapcEvent.getParameterMap()); - sapcDecideTask.duplicateOutputFields(sapcBlacklistSubscriberEvent.getParameterMap()); sapcDecideTask.setTaskLogic(new AxTaskLogic(sapcDecideTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); final AxTask sapcActTask = new AxTask(new AxArtifactKey("SAPCActTask", DEFAULT_VERSION)); - sapcActTask.duplicateInputFields(sapcEvent.getParameterMap()); - sapcActTask.duplicateOutputFields(sapcBlacklistSubscriberEvent.getParameterMap()); sapcActTask.getContextAlbumReferences().add(imsiStatusAlbum.getKey()); logicReader.setDefaultLogic(null); sapcActTask.setTaskLogic(new AxTaskLogic(sapcActTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); @@ -461,24 +432,16 @@ public class AadmDomainModelFactory { logicReader.setDefaultLogic(DEFAULT_TASK_LOGIC); final AxTask periodicMatchTask = new AxTask(new AxArtifactKey("PeriodicMatchTask", DEFAULT_VERSION)); - periodicMatchTask.duplicateInputFields(periodicEvent.getParameterMap()); - periodicMatchTask.duplicateOutputFields(periodicEvent.getParameterMap()); periodicMatchTask.setTaskLogic(new AxTaskLogic(periodicMatchTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); final AxTask periodicEstablishTask = new AxTask(new AxArtifactKey("PeriodicEstablishTask", DEFAULT_VERSION)); - periodicEstablishTask.duplicateInputFields(periodicEvent.getParameterMap()); - periodicEstablishTask.duplicateOutputFields(periodicEvent.getParameterMap()); periodicEstablishTask.setTaskLogic( new AxTaskLogic(periodicEstablishTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); final AxTask periodicDecideTask = new AxTask(new AxArtifactKey("PeriodicDecideTask", DEFAULT_VERSION)); - periodicDecideTask.duplicateInputFields(periodicEvent.getParameterMap()); - periodicDecideTask.duplicateOutputFields(periodicEvent.getParameterMap()); periodicDecideTask.setTaskLogic(new AxTaskLogic(periodicDecideTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); final AxTask periodicActTask = new AxTask(new AxArtifactKey("PeriodicActTask", DEFAULT_VERSION)); - periodicActTask.duplicateInputFields(periodicEvent.getParameterMap()); - periodicActTask.duplicateOutputFields(sapcBlacklistSubscriberEvent.getParameterMap()); periodicActTask.getContextAlbumReferences().add(imsiStatusAlbum.getKey()); logicReader.setDefaultLogic(null); periodicActTask.setTaskLogic(new AxTaskLogic(periodicActTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); diff --git a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelFactory.java b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelFactory.java index d13f93099..7dbb4ad23 100644 --- a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelFactory.java +++ b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelFactory.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -168,43 +169,31 @@ public class AdaptiveDomainModelFactory { final AxTask anomalyDetectionMatchTask = new AxTask( new AxArtifactKey("AnomalyDetectionMatchTask", DEFAULT_VERSION)); - anomalyDetectionMatchTask.duplicateInputFields(anomalyDetectionTriggerEvent.getParameterMap()); - anomalyDetectionMatchTask.duplicateOutputFields(anomalyDetectionMatchEvent.getParameterMap()); anomalyDetectionMatchTask.setTaskLogic( new AxTaskLogic(anomalyDetectionMatchTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); final AxTask anomalyDetectionEstablishTask = new AxTask( new AxArtifactKey("AnomalyDetectionEstablishTask", DEFAULT_VERSION)); - anomalyDetectionEstablishTask.duplicateInputFields(anomalyDetectionMatchEvent.getParameterMap()); - anomalyDetectionEstablishTask.duplicateOutputFields(anomalyDetectionEstablishEvent.getParameterMap()); anomalyDetectionEstablishTask.setTaskLogic( new AxTaskLogic(anomalyDetectionEstablishTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); final AxTask anomalyDetectionDecideTask0 = new AxTask( new AxArtifactKey("AnomalyDetectionDecideTask0", DEFAULT_VERSION)); - anomalyDetectionDecideTask0.duplicateInputFields(anomalyDetectionEstablishEvent.getParameterMap()); - anomalyDetectionDecideTask0.duplicateOutputFields(anomalyDetectionDecideEvent.getParameterMap()); anomalyDetectionDecideTask0.setTaskLogic( new AxTaskLogic(anomalyDetectionDecideTask0.getKey(), TASK_LOGIC, "MVEL", logicReader)); final AxTask anomalyDetectionDecideTask1 = new AxTask( new AxArtifactKey("AnomalyDetectionDecideTask1", DEFAULT_VERSION)); - anomalyDetectionDecideTask1.duplicateInputFields(anomalyDetectionEstablishEvent.getParameterMap()); - anomalyDetectionDecideTask1.duplicateOutputFields(anomalyDetectionDecideEvent.getParameterMap()); anomalyDetectionDecideTask1.setTaskLogic( new AxTaskLogic(anomalyDetectionDecideTask1.getKey(), TASK_LOGIC, "MVEL", logicReader)); final AxTask anomalyDetectionDecideTask2 = new AxTask( new AxArtifactKey("AnomalyDetectionDecideTask2", DEFAULT_VERSION)); - anomalyDetectionDecideTask2.duplicateInputFields(anomalyDetectionEstablishEvent.getParameterMap()); - anomalyDetectionDecideTask2.duplicateOutputFields(anomalyDetectionDecideEvent.getParameterMap()); anomalyDetectionDecideTask2.setTaskLogic( new AxTaskLogic(anomalyDetectionDecideTask2.getKey(), TASK_LOGIC, "MVEL", logicReader)); final AxTask anomalyDetectionActTask = new AxTask( new AxArtifactKey("AnomalyDetectionActTask", DEFAULT_VERSION)); - anomalyDetectionActTask.duplicateInputFields(anomalyDetectionDecideEvent.getParameterMap()); - anomalyDetectionActTask.duplicateOutputFields(anomalyDetectionActEvent.getParameterMap()); anomalyDetectionActTask.setTaskLogic( new AxTaskLogic(anomalyDetectionActTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); @@ -417,65 +406,45 @@ public class AdaptiveDomainModelFactory { .setDefaultLogic("DefaultAutoLearnTask_Logic"); final AxTask autoLearnMatchTask = new AxTask(new AxArtifactKey("AutoLearnMatchTask", DEFAULT_VERSION)); - autoLearnMatchTask.duplicateInputFields(autoLearnTriggerEvent.getParameterMap()); - autoLearnMatchTask.duplicateOutputFields(autoLearnMatchEvent.getParameterMap()); autoLearnMatchTask.setTaskLogic(new AxTaskLogic(autoLearnMatchTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); final AxTask autoLearnEstablishTask = new AxTask(new AxArtifactKey("AutoLearnEstablishTask", DEFAULT_VERSION)); - autoLearnEstablishTask.duplicateInputFields(autoLearnMatchEvent.getParameterMap()); - autoLearnEstablishTask.duplicateOutputFields(autoLearnEstablishEvent.getParameterMap()); autoLearnEstablishTask.setTaskLogic( new AxTaskLogic(autoLearnEstablishTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); logicReader.setDefaultLogic(null); final AxTask autoLearnDecideTask0 = new AxTask(new AxArtifactKey("AutoLearnDecideTask0", DEFAULT_VERSION)); - autoLearnDecideTask0.duplicateInputFields(autoLearnEstablishEvent.getParameterMap()); - autoLearnDecideTask0.duplicateOutputFields(autoLearnDecideEvent.getParameterMap()); autoLearnDecideTask0 .setTaskLogic(new AxTaskLogic(autoLearnDecideTask0.getKey(), TASK_LOGIC, "MVEL", logicReader)); final AxTask autoLearnDecideTask1 = new AxTask(new AxArtifactKey("AutoLearnDecideTask1", DEFAULT_VERSION)); - autoLearnDecideTask1.duplicateInputFields(autoLearnEstablishEvent.getParameterMap()); - autoLearnDecideTask1.duplicateOutputFields(autoLearnDecideEvent.getParameterMap()); autoLearnDecideTask1 .setTaskLogic(new AxTaskLogic(autoLearnDecideTask1.getKey(), TASK_LOGIC, "MVEL", logicReader)); final AxTask autoLearnDecideTask2 = new AxTask(new AxArtifactKey("AutoLearnDecideTask2", DEFAULT_VERSION)); - autoLearnDecideTask2.duplicateInputFields(autoLearnEstablishEvent.getParameterMap()); - autoLearnDecideTask2.duplicateOutputFields(autoLearnDecideEvent.getParameterMap()); autoLearnDecideTask2 .setTaskLogic(new AxTaskLogic(autoLearnDecideTask2.getKey(), TASK_LOGIC, "MVEL", logicReader)); final AxTask autoLearnDecideTask3 = new AxTask(new AxArtifactKey("AutoLearnDecideTask3", DEFAULT_VERSION)); - autoLearnDecideTask3.duplicateInputFields(autoLearnEstablishEvent.getParameterMap()); - autoLearnDecideTask3.duplicateOutputFields(autoLearnDecideEvent.getParameterMap()); autoLearnDecideTask3 .setTaskLogic(new AxTaskLogic(autoLearnDecideTask3.getKey(), TASK_LOGIC, "MVEL", logicReader)); final AxTask autoLearnDecideTask4 = new AxTask(new AxArtifactKey("AutoLearnDecideTask4", DEFAULT_VERSION)); - autoLearnDecideTask4.duplicateInputFields(autoLearnEstablishEvent.getParameterMap()); - autoLearnDecideTask4.duplicateOutputFields(autoLearnDecideEvent.getParameterMap()); autoLearnDecideTask4 .setTaskLogic(new AxTaskLogic(autoLearnDecideTask4.getKey(), TASK_LOGIC, "MVEL", logicReader)); final AxTask autoLearnDecideTask5 = new AxTask(new AxArtifactKey("AutoLearnDecideTask5", DEFAULT_VERSION)); - autoLearnDecideTask5.duplicateInputFields(autoLearnEstablishEvent.getParameterMap()); - autoLearnDecideTask5.duplicateOutputFields(autoLearnDecideEvent.getParameterMap()); autoLearnDecideTask5 .setTaskLogic(new AxTaskLogic(autoLearnDecideTask5.getKey(), TASK_LOGIC, "MVEL", logicReader)); final AxTask autoLearnDecideTask6 = new AxTask(new AxArtifactKey("AutoLearnDecideTask6", DEFAULT_VERSION)); - autoLearnDecideTask6.duplicateInputFields(autoLearnEstablishEvent.getParameterMap()); - autoLearnDecideTask6.duplicateOutputFields(autoLearnDecideEvent.getParameterMap()); autoLearnDecideTask6 .setTaskLogic(new AxTaskLogic(autoLearnDecideTask6.getKey(), TASK_LOGIC, "MVEL", logicReader)); logicReader.setDefaultLogic("DefaultAutoLearnTask_Logic"); final AxTask autoLearnActTask = new AxTask(new AxArtifactKey("AutoLearnActTask", DEFAULT_VERSION)); - autoLearnActTask.duplicateInputFields(autoLearnDecideEvent.getParameterMap()); - autoLearnActTask.duplicateOutputFields(autoLearnActEvent.getParameterMap()); autoLearnActTask.setTaskLogic(new AxTaskLogic(autoLearnActTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); final AxTasks autoLearnTasks = new AxTasks(new AxArtifactKey("AutoLearnTasks", DEFAULT_VERSION)); diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexEditorApi.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexEditorApi.java index 741fbdc90..fab6ba163 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexEditorApi.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexEditorApi.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -456,7 +457,7 @@ public interface ApexEditorApi { ApexApiResult deleteTaskLogic(final String name, final String version); /** - * Create a task input field. + * Create a task field. * * @param name name of the task * @param version version of the task, set to null to use the latest version @@ -467,11 +468,11 @@ public interface ApexEditorApi { * @param optional true if the task field is optional, false otherwise * @return result of the operation */ - ApexApiResult createTaskInputField(final String name, final String version, final String fieldName, + ApexApiResult createTaskField(final String name, final String version, final String fieldName, final String contextSchemaName, final String contextSchemaVersion, boolean optional); /** - * List task input fields. + * Handle a task field. * * @param name name of the task * @param version version of the task, set to null to use the latest version @@ -479,53 +480,7 @@ public interface ApexEditorApi { * task * @return result of the operation */ - ApexApiResult listTaskInputField(final String name, final String version, final String fieldName); - - /** - * Delete a task input field. - * - * @param name name of the task - * @param version version of the task, set to null to use the latest version - * @param fieldName of the input field, set to null to delete all input fields - * @return result of the operation - */ - ApexApiResult deleteTaskInputField(final String name, final String version, final String fieldName); - - /** - * Create a task output field. - * - * @param name name of the task - * @param version version of the task, set to null to use the latest version - * @param fieldName of the output field - * @param contextSchemaName name of the output field context schema - * @param contextSchemaVersion version of the output field context schema, set to null to use - * the latest version - * @param optional true if the task field is optional, false otherwise - * @return result of the operation - */ - ApexApiResult createTaskOutputField(final String name, final String version, final String fieldName, - final String contextSchemaName, final String contextSchemaVersion, boolean optional); - - /** - * List task output fields. - * - * @param name name of the task - * @param version version of the task, set to null to use the latest version - * @param fieldName field name of the output field, set to null to list all output fields of the - * task - * @return result of the operation - */ - ApexApiResult listTaskOutputField(final String name, final String version, final String fieldName); - - /** - * Delete a task output field. - * - * @param name name of the task - * @param version version of the task, set to null to use the latest version - * @param fieldName of the output field, set to null to delete all output fields - * @return result of the operation - */ - ApexApiResult deleteTaskOutputField(final String name, final String version, final String fieldName); + ApexApiResult handleTaskField(final String name, final String version, final String fieldName); /** * Create a task parameter. diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java index 5e8d1a5c7..67083bfe8 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java @@ -26,6 +26,7 @@ package org.onap.policy.apex.model.modelapi.impl; import java.util.Properties; import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; import org.onap.policy.apex.model.modelapi.ApexApiResult; +import org.onap.policy.apex.model.modelapi.ApexApiResult.Result; import org.onap.policy.apex.model.modelapi.ApexModel; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; import org.slf4j.Logger; @@ -38,7 +39,7 @@ import org.slf4j.LoggerFactory; */ public final class ApexModelImpl implements ApexModel { - private static final String FIELDS_DEPRECATED_WARN_MSG = + public static final String FIELDS_DEPRECATED_WARN_MSG = "inputFields and outputFields are deprecated from Task definition and will be removed. " + "Instead, inputEvent and outputEvents are automatically populated to Tasks based on State definition"; @@ -444,56 +445,19 @@ public final class ApexModelImpl implements ApexModel { * {@inheritDoc}. */ @Override - public ApexApiResult createTaskInputField(final String name, final String version, final String fieldName, + public ApexApiResult createTaskField(final String name, final String version, final String fieldName, final String dataTypeName, final String dataTypeVersion, final boolean optional) { LOGGER.warn(FIELDS_DEPRECATED_WARN_MSG); - return taskFacade.createTaskInputField(name, version, fieldName, dataTypeName, dataTypeVersion, optional); + return new ApexApiResult(Result.SUCCESS, FIELDS_DEPRECATED_WARN_MSG); } /** * {@inheritDoc}. */ @Override - public ApexApiResult listTaskInputField(final String name, final String version, final String fieldName) { + public ApexApiResult handleTaskField(final String name, final String version, final String fieldName) { LOGGER.warn(FIELDS_DEPRECATED_WARN_MSG); - return taskFacade.listTaskInputField(name, version, fieldName); - } - - /** - * {@inheritDoc}. - */ - @Override - public ApexApiResult deleteTaskInputField(final String name, final String version, final String fieldName) { - LOGGER.warn(FIELDS_DEPRECATED_WARN_MSG); - return taskFacade.deleteTaskInputField(name, version, fieldName); - } - - /** - * {@inheritDoc}. - */ - @Override - public ApexApiResult createTaskOutputField(final String name, final String version, final String fieldName, - final String dataTypeName, final String dataTypeVersion, final boolean optional) { - LOGGER.warn(FIELDS_DEPRECATED_WARN_MSG); - return taskFacade.createTaskOutputField(name, version, fieldName, dataTypeName, dataTypeVersion, optional); - } - - /** - * {@inheritDoc}. - */ - @Override - public ApexApiResult listTaskOutputField(final String name, final String version, final String fieldName) { - LOGGER.warn(FIELDS_DEPRECATED_WARN_MSG); - return taskFacade.listTaskOutputField(name, version, fieldName); - } - - /** - * {@inheritDoc}. - */ - @Override - public ApexApiResult deleteTaskOutputField(final String name, final String version, final String fieldName) { - LOGGER.warn(FIELDS_DEPRECATED_WARN_MSG); - return taskFacade.deleteTaskOutputField(name, version, fieldName); + return new ApexApiResult(Result.SUCCESS, FIELDS_DEPRECATED_WARN_MSG); } /** diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/PolicyFacade.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/PolicyFacade.java index 9480702ac..c36e7e8a5 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/PolicyFacade.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/PolicyFacade.java @@ -1112,10 +1112,17 @@ public class PolicyFacade { ApexApiResult.Result.FAILED, "output type " + builder.getOutputType() + " invalid"); } + String outputRefName = outputRefKey.getLocalName(); + // in case of SFL, outgoing event will be same for all state outputs that are part of SFL.So, take any entry + if (AxStateTaskOutputType.LOGIC.equals(stateTaskOutputType)) { + outputRefName = state.getStateOutputs().keySet().iterator().next(); + } + // add input and output events to the task based on state definition - if (state.getStateOutputs().containsKey(outputRefKey.getLocalName())) { - populateIoEventsToTask(state, task, outputRefKey); + if (state.getStateOutputs().containsKey(outputRefName)) { + populateIoEventsToTask(state, task, outputRefName); } + state.getTaskReferences().put(task.getKey(), new AxStateTaskReference(refKey, stateTaskOutputType, outputRefKey)); return new ApexApiResult(); @@ -1124,18 +1131,18 @@ public class PolicyFacade { } } - private void populateIoEventsToTask(final AxState state, final AxTask task, final AxReferenceKey outputRefKey) { + private void populateIoEventsToTask(final AxState state, final AxTask task, final String outputRefName) { AxEvent triggerEvent = apexModel.getPolicyModel().getEvents().get(state.getTrigger()); task.setInputEvent(triggerEvent); Map outputEvents = new TreeMap<>(); if (state.getNextStateSet().isEmpty() || state.getNextStateSet().contains(AxReferenceKey.getNullKey().getLocalName())) { - state.getStateOutputs().get(outputRefKey.getLocalName()).getOutgoingEventSet() + state.getStateOutputs().get(outputRefName).getOutgoingEventSet() .forEach(outgoingEventKey -> outputEvents.put(outgoingEventKey.getName(), apexModel.getPolicyModel().getEvents().get(outgoingEventKey))); } else { AxArtifactKey outgoingEventKey = - state.getStateOutputs().get(outputRefKey.getLocalName()).getOutgoingEvent(); + state.getStateOutputs().get(outputRefName).getOutgoingEvent(); outputEvents.put(outgoingEventKey.getName(), apexModel.getPolicyModel().getEvents().get(outgoingEventKey)); } diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/TaskFacade.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/TaskFacade.java index a6f4a87cb..ad1edd72e 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/TaskFacade.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/TaskFacade.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,9 +31,6 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; import org.onap.policy.apex.model.basicmodel.handling.ApexModelStringWriter; import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum; -import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema; -import org.onap.policy.apex.model.eventmodel.concepts.AxInputField; -import org.onap.policy.apex.model.eventmodel.concepts.AxOutputField; import org.onap.policy.apex.model.modelapi.ApexApiResult; import org.onap.policy.apex.model.modelapi.ApexModel; import org.onap.policy.apex.model.policymodel.concepts.AxTask; @@ -355,278 +353,6 @@ public class TaskFacade { } } - /** - * Create a task input field. - * - * @param name name of the task - * @param version version of the task, set to null to use the latest version - * @param fieldName of the input field - * @param contextSchemaName name of the input field context schema - * @param contextSchemaVersion version of the input field context schema, set to null to use the - * latest version - * @param optional true if the task field is optional, false otherwise - * @return result of the operation - */ - public ApexApiResult createTaskInputField(final String name, final String version, final String fieldName, - final String contextSchemaName, final String contextSchemaVersion, final boolean optional) { - try { - Assertions.argumentNotNull(fieldName, "fieldName may not be null"); - - final AxTask task = apexModel.getPolicyModel().getTasks().get(name, version); - if (task == null) { - return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, - CONCEPT + name + ':' + version + DOES_NOT_EXIST); - } - - final AxReferenceKey refKey = - new AxReferenceKey(task.getKey().getName(), task.getKey().getVersion(), "inputFields", fieldName); - - if (task.getInputFields().containsKey(refKey.getLocalName())) { - return new ApexApiResult(ApexApiResult.Result.CONCEPT_EXISTS, - CONCEPT + refKey.getId() + ALREADY_EXISTS); - } - - final AxContextSchema schema = - apexModel.getPolicyModel().getSchemas().get(contextSchemaName, contextSchemaVersion); - if (schema == null) { - return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, - CONCEPT + contextSchemaName + ':' + contextSchemaVersion + DOES_NOT_EXIST); - } - - task.getInputFields().put(refKey.getLocalName(), new AxInputField(refKey, schema.getKey(), optional)); - return new ApexApiResult(); - } catch (final Exception e) { - return new ApexApiResult(ApexApiResult.Result.FAILED, e); - } - } - - /** - * List task input fields. - * - * @param name name of the task - * @param version version of the task, set to null to use the latest version - * @param fieldName field name of the input field, set to null to list all input fields of the - * task - * @return result of the operation - */ - public ApexApiResult listTaskInputField(final String name, final String version, final String fieldName) { - try { - final AxTask task = apexModel.getPolicyModel().getTasks().get(name, version); - if (task == null) { - return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, - CONCEPT + name + ':' + version + DOES_NOT_EXIST); - } - - if (fieldName != null) { - final AxInputField inputField = task.getInputFields().get(fieldName); - if (inputField != null) { - return new ApexApiResult(ApexApiResult.Result.SUCCESS, - new ApexModelStringWriter(false).writeString(inputField, AxInputField.class, - jsonMode)); - } else { - return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, - CONCEPT + name + ':' + version + ':' + inputField + DOES_NOT_EXIST); - } - } else { - if (task.getInputFields().size() == 0) { - return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, - "no input fields defined on task " + task.getKey().getId()); - } - - final ApexApiResult result = new ApexApiResult(); - for (final AxInputField field : task.getInputFields().values()) { - result.addMessage(new ApexModelStringWriter(false).writeString(field, - AxInputField.class, jsonMode)); - } - return result; - } - } catch (final Exception e) { - return new ApexApiResult(ApexApiResult.Result.FAILED, e); - } - - } - - /** - * Delete a task input field. - * - * @param name name of the task - * @param version version of the task, set to null to use the latest version - * @param fieldName of the input field, set to null to delete all input fields - * @return result of the operation - */ - public ApexApiResult deleteTaskInputField(final String name, final String version, final String fieldName) { - try { - final AxTask task = apexModel.getPolicyModel().getTasks().get(name, version); - if (task == null) { - return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, - CONCEPT + name + ':' + version + DOES_NOT_EXIST); - } - - final ApexApiResult result = new ApexApiResult(); - if (fieldName != null) { - if (task.getInputFields().containsKey(fieldName)) { - result.addMessage(new ApexModelStringWriter(false) - .writeString(task.getInputFields().get(fieldName), AxInputField.class, jsonMode)); - task.getInputFields().remove(fieldName); - return result; - } else { - return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, - CONCEPT + name + ':' + version + ':' + fieldName + DOES_NOT_EXIST); - } - } else { - if (task.getInputFields().size() == 0) { - return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, - "no input fields defined on task " + task.getKey().getId()); - } - - for (final AxInputField field : task.getInputFields().values()) { - result.addMessage(new ApexModelStringWriter(false).writeString(field, - AxInputField.class, jsonMode)); - } - task.getInputFields().clear(); - return result; - } - } catch (final Exception e) { - return new ApexApiResult(ApexApiResult.Result.FAILED, e); - } - - } - - /** - * Create a task output field. - * - * @param name name of the task - * @param version version of the task, set to null to use the latest version - * @param fieldName of the output field - * @param contextSchemaName name of the output field context schema - * @param contextSchemaVersion version of the output field context schema, set to null to use - * the latest version - * @param optional true if the task field is optional, false otherwise - * @return result of the operation - */ - public ApexApiResult createTaskOutputField(final String name, final String version, final String fieldName, - final String contextSchemaName, final String contextSchemaVersion, final boolean optional) { - try { - Assertions.argumentNotNull(fieldName, "fieldName may not be null"); - - final AxTask task = apexModel.getPolicyModel().getTasks().get(name, version); - if (task == null) { - return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, - CONCEPT + name + ':' + version + DOES_NOT_EXIST); - } - - final AxReferenceKey refKey = - new AxReferenceKey(task.getKey().getName(), task.getKey().getVersion(), "outputFields", fieldName); - - if (task.getOutputFields().containsKey(refKey.getLocalName())) { - return new ApexApiResult(ApexApiResult.Result.CONCEPT_EXISTS, - CONCEPT + refKey.getId() + ALREADY_EXISTS); - } - - final AxContextSchema schema = - apexModel.getPolicyModel().getSchemas().get(contextSchemaName, contextSchemaVersion); - if (schema == null) { - return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, - CONCEPT + contextSchemaName + ':' + contextSchemaVersion + DOES_NOT_EXIST); - } - - task.getOutputFields().put(refKey.getLocalName(), new AxOutputField(refKey, schema.getKey(), optional)); - return new ApexApiResult(); - } catch (final Exception e) { - return new ApexApiResult(ApexApiResult.Result.FAILED, e); - } - } - - /** - * List task output fields. - * - * @param name name of the task - * @param version version of the task, set to null to use the latest version - * @param fieldName field name of the output field, set to null to list all output fields of the - * task - * @return result of the operation - */ - public ApexApiResult listTaskOutputField(final String name, final String version, final String fieldName) { - try { - final AxTask task = apexModel.getPolicyModel().getTasks().get(name, version); - if (task == null) { - return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, - CONCEPT + name + ':' + version + DOES_NOT_EXIST); - } - - if (fieldName != null) { - final AxOutputField outputField = task.getOutputFields().get(fieldName); - if (outputField != null) { - return new ApexApiResult(ApexApiResult.Result.SUCCESS, - new ApexModelStringWriter(false).writeString(outputField, - AxOutputField.class, jsonMode)); - } else { - return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, - CONCEPT + name + ':' + version + ':' + outputField + DOES_NOT_EXIST); - } - } else { - if (task.getOutputFields().size() == 0) { - return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, - "no output fields defined on task " + task.getKey().getId()); - } - - final ApexApiResult result = new ApexApiResult(); - for (final AxOutputField field : task.getOutputFields().values()) { - result.addMessage(new ApexModelStringWriter(false).writeString(field, - AxOutputField.class, jsonMode)); - } - return result; - } - } catch (final Exception e) { - return new ApexApiResult(ApexApiResult.Result.FAILED, e); - } - } - - /** - * Delete a task output field. - * - * @param name name of the task - * @param version version of the task, set to null to use the latest version - * @param fieldName of the output field, set to null to delete all output fields - * @return result of the operation - */ - public ApexApiResult deleteTaskOutputField(final String name, final String version, final String fieldName) { - try { - final AxTask task = apexModel.getPolicyModel().getTasks().get(name, version); - if (task == null) { - return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, - CONCEPT + name + ':' + version + DOES_NOT_EXIST); - } - - final ApexApiResult result = new ApexApiResult(); - if (fieldName != null) { - if (task.getOutputFields().containsKey(fieldName)) { - result.addMessage(new ApexModelStringWriter(false) - .writeString(task.getOutputFields().get(fieldName), AxOutputField.class, jsonMode)); - task.getOutputFields().remove(fieldName); - return result; - } else { - return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, - CONCEPT + name + ':' + version + ':' + fieldName + DOES_NOT_EXIST); - } - } else { - if (task.getOutputFields().size() == 0) { - return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, - "no output fields defined on task " + task.getKey().getId()); - } - - for (final AxOutputField field : task.getOutputFields().values()) { - result.addMessage(new ApexModelStringWriter(false).writeString(field, - AxOutputField.class, jsonMode)); - } - task.getOutputFields().clear(); - return result; - } - } catch (final Exception e) { - return new ApexApiResult(ApexApiResult.Result.FAILED, e); - } - } - /** * Create a task parameter. * diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiTaskTest.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiTaskTest.java index f2c41318c..026f67c29 100644 --- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiTaskTest.java +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiTaskTest.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +25,7 @@ package org.onap.policy.apex.model.modelapi; import static org.junit.Assert.assertEquals; import org.junit.Test; +import org.onap.policy.apex.model.modelapi.impl.ApexModelImpl; /** * Test tasks for API tests. @@ -214,124 +216,12 @@ public class ApexEditorApiTaskTest { result = apexModel.deleteTaskLogic("MyTask002", "0.0.2"); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); - result = apexModel.createTaskInputField("MyTask123", null, "NewField00", null, null, false); - assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); - - result = apexModel.createTaskInputField("MyTask002", "4.5.6", "NewField00", null, null, true); - assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); - - result = apexModel.createTaskInputField("MyTask002", "0.1.4", "NewField00", null, null, false); - assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); - - result = apexModel.createTaskInputField("MyTask002", "0.0.2", "NewField00", null, null, true); - assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - - result = apexModel.createTaskInputField("MyTask002", "0.0.2", "NewField00", "eventContextItem0", null, false); - assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModel.createTaskInputField("MyTask002", "0.0.2", "NewField00", "eventContextItem0", null, true); - assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); - result = apexModel.createTaskInputField("MyTask002", "0.0.2", "NewField01", "eventContextItem0", "0.0.1", - false); - assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModel.createTaskInputField("MyTask002", "0.0.2", "NewField02", "eventContextItem0", "0.0.2", true); - assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); - result = apexModel.createTaskInputField("MyTask002", null, "NewField02", "eventContextItem0", null, false); - assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModel.createTaskInputField("MyTask002", null, "NewField03", "eventContextItem0", null, true); - assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - - result = apexModel.listTaskInputField("@£$%", null, null); - assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - result = apexModel.listTaskInputField("MyTask002", null, null); - assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModel.listTaskInputField("MyTask002", "0.0.1", null); - assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); - result = apexModel.listTaskInputField("MyTask002", "0.0.2", null); - assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModel.listTaskInputField("MyTask002", "0.0.2", "NewField01"); + result = apexModel.createTaskField("MyTask002", "0.0.2", "NewField00", "eventContextItem0", null, false); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModel.listTaskInputField("MyTask002", "0.0.2", "NewField02"); + assertEquals(ApexModelImpl.FIELDS_DEPRECATED_WARN_MSG, result.getMessage().trim()); + result = apexModel.handleTaskField("MyTask002", "0.0.2", "NewField01"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModel.listTaskInputField("MyTask002", "0.0.2", "NewField04"); - assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); - - result = apexModel.deleteTaskInputField("@£$%", "0.0.2", "NewField04"); - assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - result = apexModel.deleteTaskInputField("NonExistantTask", "0.0.2", "NewField04"); - assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); - assertEquals(4, apexModel.listTaskInputField("MyTask002", null, null).getMessages().size()); - result = apexModel.deleteTaskInputField("MyTask002", "0.0.2", "NewField04"); - assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); - assertEquals(4, apexModel.listTaskInputField("MyTask002", null, null).getMessages().size()); - result = apexModel.deleteTaskInputField("MyTask002", null, "NewField02"); - assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - assertEquals(3, apexModel.listTaskInputField("MyTask002", null, null).getMessages().size()); - result = apexModel.deleteTaskInputField("MyTask002", null, null); - assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModel.listTaskInputField("MyTask002", null, null); - assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); - result = apexModel.deleteTaskInputField("MyTask002", null, null); - assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); - - result = apexModel.createTaskOutputField("MyTask123", null, "NewField00", null, null, false); - assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); - - result = apexModel.createTaskOutputField("MyTask002", "4.5.6", "NewField00", null, null, false); - assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); - - result = apexModel.createTaskOutputField("MyTask002", "0.1.4", "NewField00", null, null, false); - assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); - - result = apexModel.createTaskOutputField("MyTask002", "0.0.2", "NewField00", null, null, false); - assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - - result = apexModel.createTaskOutputField("MyTask002", "0.0.2", "NewField00", "eventContextItem0", null, false); - assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModel.createTaskOutputField("MyTask002", "0.0.2", "NewField00", "eventContextItem0", null, false); - assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); - result = apexModel.createTaskOutputField("MyTask002", "0.0.2", "NewField01", "eventContextItem0", "0.0.1", - false); - assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModel.createTaskOutputField("MyTask002", "0.0.2", "NewField02", "eventContextItem0", "0.0.2", - false); - assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); - result = apexModel.createTaskOutputField("MyTask002", null, "NewField02", "eventContextItem0", null, false); - assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModel.createTaskOutputField("MyTask002", null, "NewField03", "eventContextItem0", null, false); - assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - - result = apexModel.listTaskOutputField("@£$%", null, null); - assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - result = apexModel.listTaskOutputField("MyTask002", null, null); - assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModel.listTaskOutputField("MyTask002", "0.0.1", null); - assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); - result = apexModel.listTaskOutputField("MyTask002", "0.0.2", null); - assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModel.listTaskOutputField("MyTask002", "0.0.2", "NewField01"); - assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModel.listTaskOutputField("MyTask002", "0.0.2", "NewField02"); - assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModel.listTaskOutputField("MyTask002", "0.0.2", "NewField04"); - assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); - - result = apexModel.deleteTaskOutputField("@£$%", "0.0.2", "NewField04"); - assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - result = apexModel.deleteTaskOutputField("NonExistantTask", "0.0.2", "NewField04"); - assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); - assertEquals(4, apexModel.listTaskOutputField("MyTask002", null, null).getMessages().size()); - result = apexModel.deleteTaskOutputField("MyTask002", "0.0.2", "NewField04"); - assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); - assertEquals(4, apexModel.listTaskOutputField("MyTask002", null, null).getMessages().size()); - result = apexModel.deleteTaskOutputField("MyTask002", null, "NewField02"); - assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - assertEquals(3, apexModel.listTaskOutputField("MyTask002", null, null).getMessages().size()); - result = apexModel.deleteTaskOutputField("MyTask002", null, null); - assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModel.listTaskOutputField("MyTask002", null, null); - assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); - result = apexModel.deleteTaskOutputField("MyTask002", null, null); - assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); + assertEquals(ApexModelImpl.FIELDS_DEPRECATED_WARN_MSG, result.getMessage().trim()); result = apexModel.createTaskParameter("MyTask123", null, "NewPar00", null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); diff --git a/model/model-api/src/test/resources/models/PolicyModel.xml b/model/model-api/src/test/resources/models/PolicyModel.xml index e3bf59f29..e47e21afc 100644 --- a/model/model-api/src/test/resources/models/PolicyModel.xml +++ b/model/model-api/src/test/resources/models/PolicyModel.xml @@ -402,70 +402,6 @@ task 0.0.1 - - - IEPAR0 - - IEPAR0 - - eventContextItem0 - 0.0.1 - - - - - IEPAR1 - - IEPAR1 - - eventContextItem1 - 0.0.1 - - - - - - - OE0PAR0 - - OE0PAR0 - - eventContextItem0 - 0.0.1 - - - - - OE0PAR1 - - OE0PAR1 - - eventContextItem1 - 0.0.1 - - - - - OE1PAR0 - - OE1PAR0 - - eventContextItem0 - 0.0.1 - - - - - OE1PAR1 - - OE1PAR1 - - eventContextItem1 - 0.0.1 - - - - taskParameter0 diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicyModel.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicyModel.java index 4ee176d97..aec144a46 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicyModel.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicyModel.java @@ -25,8 +25,6 @@ package org.onap.policy.apex.model.policymodel.concepts; import java.util.List; import java.util.Map.Entry; -import java.util.Set; -import java.util.TreeSet; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.JoinColumn; @@ -45,7 +43,6 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxConcept; import org.onap.policy.apex.model.basicmodel.concepts.AxKey; import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation; import org.onap.policy.apex.model.basicmodel.concepts.AxModel; -import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationMessage; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult; @@ -425,19 +422,6 @@ public class AxPolicyModel extends AxModel { * @return the result */ private AxValidationResult validateTaskKeys(final AxTask task, AxValidationResult result) { - for (final AxField field : task.getInputFieldSet()) { - if (getSchemas().get(field.getSchema()) == null) { - result.addValidationMessage(new AxValidationMessage(task.getKey(), this.getClass(), - ValidationResult.INVALID, "task input field schema " + field.getSchema().getId() + DOES_NOT_EXIST)); - } - } - for (final AxField field : task.getOutputFieldSet()) { - if (getSchemas().get(field.getSchema()) == null) { - result.addValidationMessage( - new AxValidationMessage(task.getKey(), this.getClass(), ValidationResult.INVALID, - "task output field schema " + field.getSchema().getId() + DOES_NOT_EXIST)); - } - } for (final AxArtifactKey contextAlbumKey : task.getContextAlbumReferences()) { if (albums.get(contextAlbumKey) == null) { result.addValidationMessage(new AxValidationMessage(task.getKey(), this.getClass(), @@ -489,19 +473,6 @@ public class AxPolicyModel extends AxModel { ValidationResult.INVALID, "state default task " + state.getDefaultTask().getId() + DOES_NOT_EXIST)); } - // Check task input fields and event fields are compatible for default tasks with no task - // selection logic - if (state.getTaskSelectionLogic().getKey().equals(AxReferenceKey.getNullKey()) - && triggerEvent != null && defaultTask != null) { - final Set unhandledTaskInputFields = new TreeSet<>(defaultTask.getInputFieldSet()); - unhandledTaskInputFields.removeAll(triggerEvent.getFields()); - for (final AxField unhandledTaskInputField : unhandledTaskInputFields) { - result.addValidationMessage(new AxValidationMessage(state.getKey(), this.getClass(), - ValidationResult.INVALID, "task input field " + unhandledTaskInputField + " for task " - + defaultTask.getId() + " not in trigger event " + triggerEvent.getId())); - } - } - for (final AxStateOutput stateOutput : state.getStateOutputs().values()) { if (events.getEventMap().get(stateOutput.getOutgoingEvent()) == null) { result.addValidationMessage(new AxValidationMessage(stateOutput.getKey(), this.getClass(), @@ -562,16 +533,6 @@ public class AxPolicyModel extends AxModel { ValidationResult.INVALID, "output event " + stateOutput.getOutgoingEvent().getId() + " for state output " + stateOutput.getId() + DOES_NOT_EXIST)); } - - if (task != null && usedEvent != null) { - final Set unhandledTaskOutputFields = new TreeSet<>(task.getOutputFieldSet()); - unhandledTaskOutputFields.removeAll(usedEvent.getFields()); - for (final AxField unhandledTaskOutputField : unhandledTaskOutputFields) { - result.addValidationMessage(new AxValidationMessage(state.getKey(), this.getClass(), - ValidationResult.INVALID, "task output field " + unhandledTaskOutputField + " for task " - + task.getId() + " not in output event " + usedEvent.getId())); - } - } } } diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTask.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTask.java index a30a80acc..7eba99af0 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTask.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTask.java @@ -56,9 +56,6 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxValidationMessage; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult; import org.onap.policy.apex.model.eventmodel.concepts.AxEvent; -import org.onap.policy.apex.model.eventmodel.concepts.AxField; -import org.onap.policy.apex.model.eventmodel.concepts.AxInputField; -import org.onap.policy.apex.model.eventmodel.concepts.AxOutputField; import org.onap.policy.common.utils.validation.Assertions; /** @@ -78,12 +75,6 @@ import org.onap.policy.common.utils.validation.Assertions; *
    *
  1. The task key must not be a null key and must be valid, see validation in * {@link AxArtifactKey} - *
  2. The task must have at least one input field - *
  3. The parent of each input field of a task must be that task - *
  4. Each input field must be valid, see validation in {@link AxInputField} - *
  5. The task must have at least one output field - *
  6. The parent of each output field of a task must be that task - *
  7. Each output field must be valid, see validation in {@link AxOutputField} *
  8. The parent of each task parameter of a task must be that task *
  9. Each task parameter must be valid, see validation in {@link AxTaskParameter} *
  10. The parent of the task logic in a task must be that task @@ -99,7 +90,7 @@ import org.onap.policy.common.utils.validation.Assertions; @XmlType( name = "AxTask", namespace = "http://www.onap.org/policy/apex-pdp", - propOrder = {"key", "inputEvent", "outputEvents", "inputFields", "outputFields", "taskParameters", + propOrder = {"key", "inputEvent", "outputEvents", "taskParameters", "contextAlbumReferenceSet", "taskLogic"}) @Getter @Setter @@ -129,14 +120,6 @@ public class AxTask extends AxConcept { @XmlElement(name = "outputEvents", required = false) private Map outputEvents; - @OneToMany(cascade = CascadeType.ALL) - @XmlElement(name = "inputFields", required = true) - private Map inputFields; - - @OneToMany(cascade = CascadeType.ALL) - @XmlElement(name = "outputFields", required = true) - private Map outputFields; - @OneToMany(cascade = CascadeType.ALL) @XmlElement(name = "taskParameters", required = true) private Map taskParameters; @@ -181,8 +164,6 @@ public class AxTask extends AxConcept { */ public AxTask(final AxArtifactKey key) { this(key, // Task Key - new TreeMap<>(), // Input fields - new TreeMap<>(), // Output Fields new TreeMap<>(), // Task Parameters new TreeSet<>(), // Context Album References new AxTaskLogic(new AxReferenceKey(key)) // Task Logic @@ -193,27 +174,20 @@ public class AxTask extends AxConcept { * This Constructor defines all the fields of the task. * * @param key the key of the task - * @param inputFields the input fields that the task expects - * @param outputFields the output fields that the task emits * @param taskParameters the task parameters that are used to initialize tasks of this type * @param contextAlbumReferenceSet the context album reference set defines the context that may * be used by Task Logic in the state * @param taskLogic the task logic that performs the domain specific work of the task */ - public AxTask(final AxArtifactKey key, final Map inputFields, - final Map outputFields, final Map taskParameters, - final Set contextAlbumReferenceSet, final AxTaskLogic taskLogic) { + public AxTask(final AxArtifactKey key, final Map taskParameters, + final Set contextAlbumReferenceSet, final AxTaskLogic taskLogic) { super(); Assertions.argumentNotNull(key, "key may not be null"); - Assertions.argumentNotNull(inputFields, "inputFields may not be null"); - Assertions.argumentNotNull(outputFields, "outputFields may not be null"); Assertions.argumentNotNull(taskParameters, "taskParameters may not be null"); Assertions.argumentNotNull(contextAlbumReferenceSet, "contextAlbumReferenceSet may not be null"); Assertions.argumentNotNull(taskLogic, "taskLogic may not be null"); this.key = key; - this.inputFields = inputFields; - this.outputFields = outputFields; this.taskParameters = taskParameters; this.contextAlbumReferenceSet = contextAlbumReferenceSet; this.taskLogic = taskLogic; @@ -222,23 +196,13 @@ public class AxTask extends AxConcept { /** * When a task is unmarshalled from disk or from the database, the parent of contained objects * is not defined. This method is called by JAXB after unmarshaling and is used to set the - * parent keys of all {@link AxInputField}, {@link AxOutputField}, and {@link AxTaskParameter} - * instance in the task. + * parent keys of all {@link AxTaskParameter} instance in the task. * * @param unmarshaler the unmarshaler that is unmarshaling the model * @param parent the parent object of this object in the unmarshaler */ public void afterUnmarshal(final Unmarshaller unmarshaler, final Object parent) { taskLogic.getKey().setParentArtifactKey(key); - - for (final AxInputField inputField : inputFields.values()) { - inputField.getKey().setParentArtifactKey(key); - inputField.getKey().setParentLocalName("InField"); - } - for (final AxOutputField outputField : outputFields.values()) { - outputField.getKey().setParentArtifactKey(key); - outputField.getKey().setParentLocalName("OutField"); - } for (final AxTaskParameter parameter : taskParameters.values()) { parameter.getKey().setParentArtifactKey(key); } @@ -250,12 +214,6 @@ public class AxTask extends AxConcept { @Override public List getKeys() { final List keyList = key.getKeys(); - for (final AxInputField inputField : inputFields.values()) { - keyList.addAll(inputField.getKeys()); - } - for (final AxOutputField outputField : outputFields.values()) { - keyList.addAll(outputField.getKeys()); - } for (final AxTaskParameter taskParameter : taskParameters.values()) { keyList.addAll(taskParameter.getKeys()); } @@ -266,85 +224,6 @@ public class AxTask extends AxConcept { return keyList; } - /** - * Gets the raw input fields that the task expects as a tree map. - * - * @return the raw input fields that the task expects - */ - public Map getRawInputFields() { - return new TreeMap<>(inputFields); - } - - /** - * Convenience method to get the input fields as a set. - * - * @return the input fields as a set - */ - public Set getInputFieldSet() { - final Set inputFieldSet = new TreeSet<>(); - for (final AxInputField field : inputFields.values()) { - inputFieldSet.add(field); - } - return inputFieldSet; - } - - /** - * Copy the input fields from the given map into the task. This method is used to get a copy of - * the input fields, which can be useful for unit testing of policies and tasks. - * - * @param fields the fields to copy into the task - */ - public void duplicateInputFields(final Map fields) { - Assertions.argumentNotNull(fields, "fields may not be null"); - - for (final AxField field : fields.values()) { - final AxReferenceKey fieldKey = new AxReferenceKey(this.getKey().getName(), this.getKey().getVersion(), - "inputFields", field.getKey().getLocalName()); - final AxInputField inputField = new AxInputField(fieldKey, field.getSchema()); - inputFields.put(inputField.getKey().getLocalName(), inputField); - } - } - - /** - * Gets the raw output fields that the task emits as a tree map. - * - * @return the raw output fields as a tree map - */ - public Map getRawOutputFields() { - return new TreeMap<>(outputFields); - } - - /** - * Gets the output fields that the task emits as a set. - * - * @return the output fields as a set - */ - public Set getOutputFieldSet() { - final Set outputFieldSet = new TreeSet<>(); - for (final AxOutputField field : outputFields.values()) { - outputFieldSet.add(field); - } - return outputFieldSet; - } - - /** - * Copy the output fields from the given map into the task. This method is used to get a copy of - * the output fields, which can be useful for unit testing of policies and tasks. - * - * @param fields the fields to copy into the task - */ - public void duplicateOutputFields(final Map fields) { - Assertions.argumentNotNull(fields, "fields may not be null"); - - for (final AxField field : fields.values()) { - final AxReferenceKey fieldKey = new AxReferenceKey(this.getKey().getName(), this.getKey().getVersion(), - "outputFields", field.getKey().getLocalName()); - final AxOutputField outputField = new AxOutputField(fieldKey, field.getSchema()); - outputFields.put(outputField.getKey().getLocalName(), outputField); - } - } - - /** * Gets the context album reference set defines the context that may be used by Task Logic in * the state. @@ -446,12 +325,6 @@ public class AxTask extends AxConcept { @Override public void clean() { key.clean(); - for (final AxInputField inputField : inputFields.values()) { - inputField.clean(); - } - for (final AxOutputField outputField : outputFields.values()) { - outputField.clean(); - } for (final AxTaskParameter parameter : taskParameters.values()) { parameter.clean(); } @@ -471,10 +344,6 @@ public class AxTask extends AxConcept { builder.append(":("); builder.append("key="); builder.append(key); - builder.append(",inputFields="); - builder.append(inputFields); - builder.append(",outputFields="); - builder.append(outputFields); builder.append(",taskParameters="); builder.append(taskParameters); builder.append(",contextAlbumReferenceSet="); @@ -498,18 +367,6 @@ public class AxTask extends AxConcept { final AxTask copy = ((AxTask) copyObject); copy.setKey(key); - final Map newInputFields = new TreeMap<>(); - for (final Entry inputFieldEntry : inputFields.entrySet()) { - newInputFields.put(inputFieldEntry.getKey(), new AxInputField(inputFieldEntry.getValue())); - } - copy.setInputFields(newInputFields); - - final Map newOutputFields = new TreeMap<>(); - for (final Entry outputFieldEntry : outputFields.entrySet()) { - newOutputFields.put(outputFieldEntry.getKey(), new AxOutputField(outputFieldEntry.getValue())); - } - copy.setOutputFields(newOutputFields); - final Map newTaskParameter = new TreeMap<>(); for (final Entry taskParameterEntry : taskParameters.entrySet()) { newTaskParameter.put(taskParameterEntry.getKey(), new AxTaskParameter(taskParameterEntry.getValue())); @@ -535,8 +392,6 @@ public class AxTask extends AxConcept { final int prime = 31; int result = 1; result = prime * result + key.hashCode(); - result = prime * result + inputFields.hashCode(); - result = prime * result + outputFields.hashCode(); result = prime * result + taskParameters.hashCode(); result = prime * result + contextAlbumReferenceSet.hashCode(); result = prime * result + taskLogic.hashCode(); @@ -563,12 +418,6 @@ public class AxTask extends AxConcept { if (!key.equals(other.key)) { return false; } - if (!inputFields.equals(other.inputFields)) { - return false; - } - if (!outputFields.equals(other.outputFields)) { - return false; - } if (!taskParameters.equals(other.taskParameters)) { return false; } @@ -597,12 +446,6 @@ public class AxTask extends AxConcept { if (!key.equals(other.key)) { return key.compareTo(other.key); } - if (!inputFields.equals(other.inputFields)) { - return (inputFields.hashCode() - other.inputFields.hashCode()); - } - if (!outputFields.equals(other.outputFields)) { - return (outputFields.hashCode() - other.outputFields.hashCode()); - } if (!taskParameters.equals(other.taskParameters)) { return (taskParameters.hashCode() - other.taskParameters.hashCode()); } diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyAnalyser.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyAnalyser.java index 3a4c36bc5..6731caf30 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyAnalyser.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyAnalyser.java @@ -29,8 +29,6 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxKey; import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum; import org.onap.policy.apex.model.eventmodel.concepts.AxEvent; import org.onap.policy.apex.model.eventmodel.concepts.AxField; -import org.onap.policy.apex.model.eventmodel.concepts.AxInputField; -import org.onap.policy.apex.model.eventmodel.concepts.AxOutputField; import org.onap.policy.apex.model.policymodel.concepts.AxPolicy; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; import org.onap.policy.apex.model.policymodel.concepts.AxState; @@ -163,14 +161,6 @@ public class PolicyAnalyser { for (final AxArtifactKey contextAlbumKey : task.getContextAlbumReferences()) { result.getContextAlbumUsage().get(contextAlbumKey).add(task.getKey()); } - - // Task data type usage - for (final AxInputField inputField : task.getInputFields().values()) { - result.getContextSchemaUsage().get(inputField.getSchema()).add(task.getKey()); - } - for (final AxOutputField outputField : task.getOutputFields().values()) { - result.getContextSchemaUsage().get(outputField.getSchema()).add(task.getKey()); - } } /** diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/PolicyModelTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/PolicyModelTest.java index 48022e878..b699b5d48 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/PolicyModelTest.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/PolicyModelTest.java @@ -37,8 +37,6 @@ import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums; import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas; import org.onap.policy.apex.model.eventmodel.concepts.AxEvents; import org.onap.policy.apex.model.eventmodel.concepts.AxField; -import org.onap.policy.apex.model.eventmodel.concepts.AxInputField; -import org.onap.policy.apex.model.eventmodel.concepts.AxOutputField; import org.onap.policy.apex.model.policymodel.handling.SupportApexPolicyModelCreator; /** @@ -183,32 +181,6 @@ public class PolicyModelTest { result = model.validate(result); assertEquals(ValidationResult.VALID, result.getValidationResult()); - final AxInputField badInField = new AxInputField( - new AxReferenceKey(model.getTasks().get("task").getKey(), "BadInField"), - new AxArtifactKey("NonExistantSchema", "0.0.1")); - model.getTasks().get("task").getInputFields().put(badInField.getKey().getLocalName(), badInField); - result = new AxValidationResult(); - result = model.validate(result); - assertEquals(ValidationResult.INVALID, result.getValidationResult()); - - model.getTasks().get("task").getInputFields().remove(badInField.getKey().getLocalName()); - result = new AxValidationResult(); - result = model.validate(result); - assertEquals(ValidationResult.VALID, result.getValidationResult()); - - final AxOutputField badOutField = new AxOutputField( - new AxReferenceKey(model.getTasks().get("task").getKey(), "BadOutField"), - new AxArtifactKey("NonExistantSchema", "0.0.1")); - model.getTasks().get("task").getOutputFields().put(badOutField.getKey().getLocalName(), badOutField); - result = new AxValidationResult(); - result = model.validate(result); - assertEquals(ValidationResult.INVALID, result.getValidationResult()); - - model.getTasks().get("task").getOutputFields().remove(badOutField.getKey().getLocalName()); - result = new AxValidationResult(); - result = model.validate(result); - assertEquals(ValidationResult.VALID, result.getValidationResult()); - model.getTasks().get("task").getContextAlbumReferences() .add(new AxArtifactKey("NonExistantContextAlbum", "0.0.1")); result = new AxValidationResult(); @@ -267,16 +239,6 @@ public class PolicyModelTest { result = model.validate(result); assertEquals(ValidationResult.VALID, result.getValidationResult()); - model.getTasks().get("task").getInputFields().put(badInField.getKey().getLocalName(), badInField); - result = new AxValidationResult(); - result = model.validate(result); - assertEquals(ValidationResult.INVALID, result.getValidationResult()); - - model.getTasks().get("task").getInputFields().remove(badInField.getKey().getLocalName()); - result = new AxValidationResult(); - result = model.validate(result); - assertEquals(ValidationResult.VALID, result.getValidationResult()); - model.getPolicies().get("policy").getStateMap().get("state").setTaskSelectionLogic(savedTaskSelectionLogic); result = new AxValidationResult(); result = model.validate(result); diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TasksTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TasksTest.java index 95266acc8..89dc9a048 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TasksTest.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TasksTest.java @@ -25,7 +25,6 @@ package org.onap.policy.apex.model.policymodel.concepts; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; import java.util.Map; import java.util.TreeMap; @@ -36,9 +35,6 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult; import org.onap.policy.apex.model.eventmodel.concepts.AxEvent; -import org.onap.policy.apex.model.eventmodel.concepts.AxField; -import org.onap.policy.apex.model.eventmodel.concepts.AxInputField; -import org.onap.policy.apex.model.eventmodel.concepts.AxOutputField; /** * Test policy tasks. @@ -49,19 +45,15 @@ public class TasksTest { @Test public void testTasks() { - final TreeMap ifEmptyMap = new TreeMap<>(); - final TreeMap ofEmptyMap = new TreeMap<>(); final TreeMap tpEmptyMap = new TreeMap<>(); final TreeSet ctxtEmptySet = new TreeSet<>(); - final TreeMap ifMap = new TreeMap<>(); - final TreeMap ofMap = new TreeMap<>(); final TreeMap tpMap = new TreeMap<>(); final TreeSet ctxtSet = new TreeSet<>(); assertNotNull(new AxTask()); assertNotNull(new AxTask(new AxArtifactKey())); - assertNotNull(new AxTask(new AxArtifactKey(), ifMap, ofMap, tpMap, ctxtSet, new AxTaskLogic())); + assertNotNull(new AxTask(new AxArtifactKey(), tpMap, ctxtSet, new AxTaskLogic())); final AxTask task = new AxTask(); @@ -70,40 +62,15 @@ public class TasksTest { assertEquals("TaskName:0.0.1", task.getKey().getId()); assertEquals("TaskName:0.0.1", task.getKeys().get(0).getId()); - final AxArtifactKey f0SchemaKey = new AxArtifactKey("FS0", "0.0.1"); - - final AxInputField if0 = new AxInputField(new AxReferenceKey(taskKey, "IF0"), f0SchemaKey, false); - final AxInputField if1 = new AxInputField(new AxReferenceKey(taskKey, "IF1"), f0SchemaKey, false); - final AxOutputField of0 = new AxOutputField(new AxReferenceKey(taskKey, "OF0"), f0SchemaKey, false); - final AxOutputField of1 = new AxOutputField(new AxReferenceKey(taskKey, "OF1"), f0SchemaKey, false); final AxTaskParameter tp0 = new AxTaskParameter(new AxReferenceKey(taskKey, "TP0"), "DefaultValue"); final AxArtifactKey cr0 = new AxArtifactKey("ContextReference", "0.0.1"); final AxTaskLogic tl = new AxTaskLogic(taskKey, "LogicName", "LogicFlavour", "Logic"); - ifMap.put(if0.getKey().getLocalName(), if0); - ofMap.put(of0.getKey().getLocalName(), of0); tpMap.put(tp0.getKey().getLocalName(), tp0); ctxtSet.add(cr0); - task.setInputFields(ifMap); - assertEquals(ifMap, task.getInputFields()); - assertTrue(task.getInputFieldSet().contains(if0)); - assertTrue(task.getRawInputFields().keySet().contains(if0.getKey().getLocalName())); - - task.setOutputFields(ofMap); - assertEquals(ofMap, task.getOutputFields()); - assertTrue(task.getOutputFieldSet().contains(of0)); - assertTrue(task.getRawOutputFields().keySet().contains(of0.getKey().getLocalName())); task.setInputEvent(new AxEvent()); task.setOutputEvents(Map.of("Event", new AxEvent())); - final TreeMap ifDupMap = new TreeMap<>(); - final TreeMap ofDupMap = new TreeMap<>(); - ifDupMap.put(if1.getKey().getLocalName(), if1); - ofDupMap.put(of1.getKey().getLocalName(), of1); - task.duplicateInputFields(ifDupMap); - task.duplicateOutputFields(ofDupMap); - assertTrue(ifMap.containsKey("IF1")); - assertTrue(ofMap.containsKey("OF1")); task.setTaskParameters(tpMap); assertEquals(tpMap, task.getTaskParameters()); @@ -188,25 +155,23 @@ public class TasksTest { assertEquals(task, clonedTask); assertNotNull(task); assertNotEquals(task, (Object) "Hello"); - assertNotEquals(task, new AxTask(new AxArtifactKey(), ifMap, ofMap, tpMap, ctxtSet, tl)); - assertNotEquals(task, new AxTask(taskKey, ifEmptyMap, ofMap, tpMap, ctxtSet, tl)); - assertNotEquals(task, new AxTask(taskKey, ifMap, ofEmptyMap, tpMap, ctxtSet, tl)); - assertNotEquals(task, new AxTask(taskKey, ifMap, ofMap, tpEmptyMap, ctxtSet, tl)); - assertNotEquals(task, new AxTask(taskKey, ifMap, ofMap, tpMap, ctxtEmptySet, tl)); - assertNotEquals(task, new AxTask(taskKey, ifMap, ofMap, tpMap, ctxtSet, new AxTaskLogic())); - assertEquals(task, new AxTask(taskKey, ifMap, ofMap, tpMap, ctxtSet, tl)); + assertNotEquals(task, new AxTask(new AxArtifactKey(), tpMap, ctxtSet, tl)); + assertEquals(task, new AxTask(taskKey, tpMap, ctxtSet, tl)); + assertNotEquals(task, new AxTask(taskKey, tpEmptyMap, ctxtSet, tl)); + assertNotEquals(task, new AxTask(taskKey, tpMap, ctxtEmptySet, tl)); + assertNotEquals(task, new AxTask(taskKey, tpMap, ctxtSet, new AxTaskLogic())); + assertEquals(task, new AxTask(taskKey, tpMap, ctxtSet, tl)); assertEquals(0, task.compareTo(task)); assertEquals(0, task.compareTo(clonedTask)); assertNotEquals(0, task.compareTo(new AxArtifactKey())); assertNotEquals(0, task.compareTo(null)); - assertNotEquals(0, task.compareTo(new AxTask(new AxArtifactKey(), ifMap, ofMap, tpMap, ctxtSet, tl))); - assertNotEquals(0, task.compareTo(new AxTask(taskKey, ifEmptyMap, ofMap, tpMap, ctxtSet, tl))); - assertNotEquals(0, task.compareTo(new AxTask(taskKey, ifMap, ofEmptyMap, tpMap, ctxtSet, tl))); - assertNotEquals(0, task.compareTo(new AxTask(taskKey, ifMap, ofMap, tpEmptyMap, ctxtSet, tl))); - assertNotEquals(0, task.compareTo(new AxTask(taskKey, ifMap, ofMap, tpMap, ctxtEmptySet, tl))); - assertNotEquals(0, task.compareTo(new AxTask(taskKey, ifMap, ofMap, tpMap, ctxtSet, new AxTaskLogic()))); - assertEquals(0, task.compareTo(new AxTask(taskKey, ifMap, ofMap, tpMap, ctxtSet, tl))); + assertNotEquals(0, task.compareTo(new AxTask(new AxArtifactKey(), tpMap, ctxtSet, tl))); + assertEquals(0, task.compareTo(new AxTask(taskKey, tpMap, ctxtSet, tl))); + assertNotEquals(0, task.compareTo(new AxTask(taskKey, tpEmptyMap, ctxtSet, tl))); + assertNotEquals(0, task.compareTo(new AxTask(taskKey, tpMap, ctxtEmptySet, tl))); + assertNotEquals(0, task.compareTo(new AxTask(taskKey, tpMap, ctxtSet, new AxTaskLogic()))); + assertEquals(0, task.compareTo(new AxTask(taskKey, tpMap, ctxtSet, tl))); assertNotNull(task.getKeys()); diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java index 3192079d7..3e3051021 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -112,19 +113,7 @@ public class ApexPolicyModelTest { + "org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum:INVALID:scope is not defined\n" + "AxArtifactKey:(name=contextAlbum1,version=0.0.1):" + "org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum:INVALID:scope is not defined\n" - + "AxReferenceKey:" - + "(parentKeyName=policy,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=state):" - + "org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:" - + "task output field AxOutputField:(key=AxReferenceKey:" - + "(parentKeyName=task,parentKeyVersion=0.0.1,parentLocalName=outputFields,localName=OE1PAR0)," - + "fieldSchemaKey=AxArtifactKey:(name=eventContextItem0,version=0.0.1),optional=false) for task " - + "task:0.0.1 not in output event outEvent0:0.0.1\n" + "AxReferenceKey:" - + "(parentKeyName=policy,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=state):" - + "org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:" - + "task output field AxOutputField:(key=AxReferenceKey:" - + "(parentKeyName=task,parentKeyVersion=0.0.1,parentLocalName=outputFields,localName=OE1PAR1)," - + "fieldSchemaKey=AxArtifactKey:(name=eventContextItem1,version=0.0.1),optional=false) for task " - + "task:0.0.1 not in output event outEvent0:0.0.1\n" + "********************************"; + + "********************************"; private static final String INVALID_MODEL_MALSTRUCTURED_STRING = "\n" + "***validation of model failed***\n" + "AxArtifactKey:(name=policyModel_KeyInfo,version=0.0.1):" diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/PolicyAnalyserTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/PolicyAnalyserTest.java index 3ff85c898..b1e2d5cbd 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/PolicyAnalyserTest.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/PolicyAnalyserTest.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,8 +51,8 @@ public class PolicyAnalyserTest { private static final String EXPECTED_ANALYSIS_RESULT = "" + "Context Schema usage\n" + " MapType:0.0.1\n" + " contextAlbum0:0.0.1\n" + " StringType:0.0.1\n" + " contextAlbum1:0.0.1\n" + " eventContextItem0:0.0.1\n" + " inEvent:0.0.1\n" + " outEvent0:0.0.1\n" + " outEvent1:0.0.1\n" - + " task:0.0.1\n" + " eventContextItem1:0.0.1\n" + " inEvent:0.0.1\n" + " outEvent0:0.0.1\n" - + " outEvent1:0.0.1\n" + " task:0.0.1\n" + "Context Album usage\n" + " contextAlbum0:0.0.1\n" + + " eventContextItem1:0.0.1\n" + " inEvent:0.0.1\n" + " outEvent0:0.0.1\n" + + " outEvent1:0.0.1\n" + "Context Album usage\n" + " contextAlbum0:0.0.1\n" + " task:0.0.1\n" + " policy:0.0.1:NULL:state\n" + " contextAlbum1:0.0.1\n" + " task:0.0.1\n" + " policy:0.0.1:NULL:state\n" + "Event usage\n" + " inEvent:0.0.1\n" + " policy:0.0.1:NULL:state\n" + " outEvent0:0.0.1\n" + " policy:0.0.1:NULL:state\n" + " outEvent1:0.0.1 (unused)\n" + "Task usage\n" diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/SupportApexPolicyModelCreator.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/SupportApexPolicyModelCreator.java index ea2de8603..85040221a 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/SupportApexPolicyModelCreator.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/SupportApexPolicyModelCreator.java @@ -36,8 +36,6 @@ import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas; import org.onap.policy.apex.model.eventmodel.concepts.AxEvent; import org.onap.policy.apex.model.eventmodel.concepts.AxEvents; import org.onap.policy.apex.model.eventmodel.concepts.AxField; -import org.onap.policy.apex.model.eventmodel.concepts.AxInputField; -import org.onap.policy.apex.model.eventmodel.concepts.AxOutputField; import org.onap.policy.apex.model.policymodel.concepts.AxPolicies; import org.onap.policy.apex.model.policymodel.concepts.AxPolicy; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; @@ -117,27 +115,6 @@ public class SupportApexPolicyModelCreator implements TestApexModelCreator incomingParameters = new HashMap<>(); incomingParameters.put(parKey0, "value0"); AxEvent inEvent = new AxEvent(); inEvent.setParameterMap(Map.of(parKey0, new AxField())); task.setInputEvent(inEvent); + String parKey1 = "par1"; AxEvent outEvent = new AxEvent(); outEvent.setParameterMap(Map.of(parKey0, new AxField(), parKey1, new AxField())); final String eventName = "event1"; diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/EvalDomainModelFactory.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/EvalDomainModelFactory.java index d25bea3a4..ec5eb371a 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/EvalDomainModelFactory.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/EvalDomainModelFactory.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020-2021 Nordix Foundation. + * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -217,8 +218,6 @@ public class EvalDomainModelFactory { .setDefaultLogic("EvalTaskLogic"); final var obTask = new AxTask(new AxArtifactKey("Task_Observe_0", DEFAULT_VERSION)); - obTask.duplicateInputFields(event0000.getParameterMap()); - obTask.duplicateOutputFields(event0001.getParameterMap()); final var obAxLogic = new AxTaskLogic(obTask.getKey(), TASK_LOGIC, (justOneLang == null ? JAVASCRIPT : justOneLang), logicReader); obAxLogic.setLogic(obAxLogic.getLogic().replace(STATE_NAME, OBSERVE) @@ -226,8 +225,6 @@ public class EvalDomainModelFactory { obTask.setTaskLogic(obAxLogic); final var orTask = new AxTask(new AxArtifactKey("Task_Orient_0", DEFAULT_VERSION)); - orTask.duplicateInputFields(event0001.getParameterMap()); - orTask.duplicateOutputFields(event0002.getParameterMap()); final var orAxLogic = new AxTaskLogic(orTask.getKey(), TASK_LOGIC, (justOneLang == null ? JAVASCRIPT : justOneLang), logicReader); orAxLogic.setLogic(orAxLogic.getLogic().replace(STATE_NAME, ORIENT) @@ -235,8 +232,6 @@ public class EvalDomainModelFactory { orTask.setTaskLogic(orAxLogic); final var dTask = new AxTask(new AxArtifactKey("Task_Decide_0", DEFAULT_VERSION)); - dTask.duplicateInputFields(event0002.getParameterMap()); - dTask.duplicateOutputFields(event0003.getParameterMap()); final var dAxLogic = new AxTaskLogic(dTask.getKey(), TASK_LOGIC, (justOneLang == null ? MVEL : justOneLang), logicReader); dAxLogic.setLogic(dAxLogic.getLogic().replace(STATE_NAME, ORIENT) @@ -244,8 +239,6 @@ public class EvalDomainModelFactory { dTask.setTaskLogic(dAxLogic); final var aTask = new AxTask(new AxArtifactKey("Task_Act_0", DEFAULT_VERSION)); - aTask.duplicateInputFields(event0003.getParameterMap()); - aTask.duplicateOutputFields(event0004.getParameterMap()); final var aAxLogic = new AxTaskLogic(aTask.getKey(), TASK_LOGIC, (justOneLang == null ? "JAVA" : justOneLang), logicReader); aAxLogic.setLogic(aAxLogic.getLogic().replace(STATE_NAME, "Act") @@ -460,8 +453,6 @@ public class EvalDomainModelFactory { .setDefaultLogic("EvalTaskLogic"); final var eTask = new AxTask(new AxArtifactKey("Task_Event_0", DEFAULT_VERSION)); - eTask.duplicateInputFields(event0000.getParameterMap()); - eTask.duplicateOutputFields(event0001.getParameterMap()); final var eAxLogic = new AxTaskLogic(eTask.getKey(), TASK_LOGIC, (justOneLang == null ? JYTHON : justOneLang), logicReader); eAxLogic.setLogic(eAxLogic.getLogic().replace(STATE_NAME, EVENT) @@ -469,8 +460,6 @@ public class EvalDomainModelFactory { eTask.setTaskLogic(eAxLogic); final var cTask = new AxTask(new AxArtifactKey("Task_Condition_0", DEFAULT_VERSION)); - cTask.duplicateInputFields(event0001.getParameterMap()); - cTask.duplicateOutputFields(event0002.getParameterMap()); final var cAxLogic = new AxTaskLogic(cTask.getKey(), TASK_LOGIC, (justOneLang == null ? JAVASCRIPT : justOneLang), logicReader); cAxLogic.setLogic(cAxLogic.getLogic().replace(STATE_NAME, CONDITION) @@ -478,8 +467,6 @@ public class EvalDomainModelFactory { cTask.setTaskLogic(cAxLogic); final var aTask = new AxTask(new AxArtifactKey("Task_Action_0", DEFAULT_VERSION)); - aTask.duplicateInputFields(event0002.getParameterMap()); - aTask.duplicateOutputFields(event0003.getParameterMap()); final var aAxLogic = new AxTaskLogic(aTask.getKey(), TASK_LOGIC, (justOneLang == null ? "JAVA" : justOneLang), logicReader); aAxLogic.setLogic(aAxLogic.getLogic().replace(STATE_NAME, ACTION) diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelFactory.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelFactory.java index c32dbcf4f..596362aec 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelFactory.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelFactory.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020-2021 Nordix Foundation. + * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -446,14 +447,10 @@ public class SampleDomainModelFactory { referenceKeySetList.add(referenceKeySet3); var tasks = new AxTasks(new AxArtifactKey("Tasks", DEFAULT_VERSION)); - tasks.getTaskMap().putAll(getTaskMap(MATCH, event0000.getParameterMap(), event0001.getParameterMap(), - referenceKeySetList, axLogicExecutorType)); - tasks.getTaskMap().putAll(getTaskMap(ESTABLISH, event0001.getParameterMap(), event0002.getParameterMap(), - referenceKeySetList, axLogicExecutorType)); - tasks.getTaskMap().putAll(getTaskMap(DECIDE, event0002.getParameterMap(), event0003.getParameterMap(), - referenceKeySetList, axLogicExecutorType)); - tasks.getTaskMap().putAll(getTaskMap("Act", event0003.getParameterMap(), event0004.getParameterMap(), - referenceKeySetList, axLogicExecutorType)); + tasks.getTaskMap().putAll(getTaskMap(MATCH, referenceKeySetList, axLogicExecutorType)); + tasks.getTaskMap().putAll(getTaskMap(ESTABLISH, referenceKeySetList, axLogicExecutorType)); + tasks.getTaskMap().putAll(getTaskMap(DECIDE, referenceKeySetList, axLogicExecutorType)); + tasks.getTaskMap().putAll(getTaskMap("Act", referenceKeySetList, axLogicExecutorType)); Set matchTasks = new TreeSet<>(); Set establishTasks = new TreeSet<>(); @@ -685,25 +682,17 @@ public class SampleDomainModelFactory { * Gets the task map. * * @param state the state - * @param inputFields the input fields - * @param outputFields the output fields * @param referenceKeySetList the reference key set list * @param axLogicExecutorType the ax logic executor type * @return the task map */ - private Map getTaskMap(final String state, final Map inputFields, - final Map outputFields, final List> referenceKeySetList, - final String axLogicExecutorType) { + private Map getTaskMap(final String state, + final List> referenceKeySetList, final String axLogicExecutorType) { var testTask0 = new AxTask(new AxArtifactKey(TASK + state + "0", DEFAULT_VERSION)); - testTask0.duplicateInputFields(inputFields); - testTask0.duplicateOutputFields(outputFields); - var parameter00 = new AxTaskParameter(new AxReferenceKey(testTask0.getKey(), PARAMETER0), - DEFAULT_VALUE0); - var parameter01 = new AxTaskParameter(new AxReferenceKey(testTask0.getKey(), PARAMETER1), - DEFAULT_VALUE1); - var parameter02 = new AxTaskParameter(new AxReferenceKey(testTask0.getKey(), PARAMETER2), - DEFAULT_VALUE2); + var parameter00 = new AxTaskParameter(new AxReferenceKey(testTask0.getKey(), PARAMETER0), DEFAULT_VALUE0); + var parameter01 = new AxTaskParameter(new AxReferenceKey(testTask0.getKey(), PARAMETER1), DEFAULT_VALUE1); + var parameter02 = new AxTaskParameter(new AxReferenceKey(testTask0.getKey(), PARAMETER2), DEFAULT_VALUE2); testTask0.getTaskParameters().put(parameter00.getKey().getLocalName(), parameter00); testTask0.getTaskParameters().put(parameter01.getKey().getLocalName(), parameter01); testTask0.getTaskParameters().put(parameter02.getKey().getLocalName(), parameter02); @@ -714,8 +703,6 @@ public class SampleDomainModelFactory { testTask0.setTaskLogic(getTaskLogic(testTask0, logicReader, axLogicExecutorType, state, "2")); var testTask1 = new AxTask(new AxArtifactKey(TASK + state + "1", DEFAULT_VERSION)); - testTask1.duplicateInputFields(inputFields); - testTask1.duplicateOutputFields(outputFields); var parameter10 = new AxTaskParameter(new AxReferenceKey(testTask1.getKey(), PARAMETER0), DEFAULT_VALUE0); var parameter11 = new AxTaskParameter(new AxReferenceKey(testTask1.getKey(), PARAMETER1), @@ -726,8 +713,6 @@ public class SampleDomainModelFactory { testTask1.setTaskLogic(getTaskLogic(testTask1, logicReader, axLogicExecutorType, state, "3")); var testTask2 = new AxTask(new AxArtifactKey(TASK + state + "2", DEFAULT_VERSION)); - testTask2.duplicateInputFields(inputFields); - testTask2.duplicateOutputFields(outputFields); var parameter20 = new AxTaskParameter(new AxReferenceKey(testTask2.getKey(), PARAMETER0), DEFAULT_VALUE0); testTask2.getTaskParameters().put(parameter20.getKey().getLocalName(), parameter20); @@ -735,8 +720,6 @@ public class SampleDomainModelFactory { testTask2.setTaskLogic(getTaskLogic(testTask2, logicReader, axLogicExecutorType, state, "0")); var testTask3 = new AxTask(new AxArtifactKey(TASK + state + "3", DEFAULT_VERSION)); - testTask3.duplicateInputFields(inputFields); - testTask3.duplicateOutputFields(outputFields); var parameter30 = new AxTaskParameter(new AxReferenceKey(testTask3.getKey(), PARAMETER0), DEFAULT_VALUE0); testTask3.getTaskParameters().put(parameter30.getKey().getLocalName(), parameter30); diff --git a/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2cli/Model2Cli.java b/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2cli/Model2Cli.java index 81d897762..b5f6f432a 100644 --- a/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2cli/Model2Cli.java +++ b/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2cli/Model2Cli.java @@ -166,16 +166,13 @@ public class Model2Cli { // 2: tasks for (final AxTask t : policyModel.getTasks().getTaskMap().values()) { final AxArtifactKey key = t.getKey(); - final List infields = getInfieldsForTask(codeGen, t); - final List outfields = getOutfieldsForTask(codeGen, t); final ST logic = getLogicForTask(codeGen, t); final List parameters = getParametersForTask(codeGen, t); final List contextRefs = getCtxtRefsForTask(codeGen, t); codeGen.addTaskDeclaration(new TaskDeclarationBuilder().setName(kig.getName(key)) - .setVersion(kig.getVersion(key)).setUuid(kig.getUuid(key)) - .setDescription(kig.getDesc(key)).setInfields(infields).setOutfields(outfields) - .setLogic(logic).setParameters(parameters).setContextRefs(contextRefs)); + .setVersion(kig.getVersion(key)).setUuid(kig.getUuid(key)).setDescription(kig.getDesc(key)) + .setLogic(logic).setParameters(parameters).setContextRefs(contextRefs)); } // 3: events @@ -312,48 +309,6 @@ public class Model2Cli { return cg.createTaskDefLogic(kig.getName(tkey), kig.getVersion(tkey), tl.getLogicFlavour(), tl.getLogic()); } - /** - * Gets the output fields for task. - * - * @param cg the code generator - * @param task the task - * @return the output fields for task - */ - private List getOutfieldsForTask(final CodeGeneratorCliEditor cg, final AxTask task) { - final Collection fields = task.getOutputFields().values(); - final List ret = new ArrayList<>(fields.size()); - for (final AxField f : fields) { - final AxReferenceKey fkey = f.getKey(); - - final ST val = cg.createTaskDefinitionOutfields(kig.getPName(fkey), kig.getPVersion(fkey), - kig.getLName(fkey), kig.getName(f.getSchema()), kig.getVersion(f.getSchema())); - - ret.add(val); - } - return ret; - } - - /** - * Gets the input fields for task. - * - * @param cg the code generator - * @param task the task - * @return the input fields for task - */ - private List getInfieldsForTask(final CodeGeneratorCliEditor cg, final AxTask task) { - final Collection fields = task.getInputFields().values(); - final List ret = new ArrayList<>(fields.size()); - for (final AxField f : fields) { - final AxReferenceKey fkey = f.getKey(); - - final ST val = cg.createTaskDefinitionInfields(kig.getPName(fkey), kig.getPVersion(fkey), - kig.getLName(fkey), kig.getName(f.getSchema()), kig.getVersion(f.getSchema())); - - ret.add(val); - } - return ret; - } - /** * Gets the states for policy. * -- cgit 1.2.3-korg