diff options
Diffstat (limited to 'examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelFactory.java')
-rw-r--r-- | examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelFactory.java | 526 |
1 files changed, 283 insertions, 243 deletions
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 6b71468d9..d13f93099 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 @@ -50,6 +50,19 @@ import org.onap.policy.apex.model.policymodel.handling.PolicyLogicReader; * The Class AdaptiveDomainModelFactory. */ public class AdaptiveDomainModelFactory { + // Recurring string constants + private static final String LAST_MONITORED_VALUE = "LastMonitoredValue"; + private static final String TASK_SELECTION_LOGIC = "TaskSelectionLogic"; + private static final String DEFAULT_STATE_LOGIC = "DefaultState_Logic"; + private static final String TASK_LOGIC = "TaskLogic"; + private static final String DECIDE = "Decide"; + private static final String ESTABLISH = "Establish"; + private static final String MATCH = "Match"; + private static final String EXTERNAL = "External"; + private static final String DEFAULT_NAMESPACE = "org.onap.policy.apex.examples.adaptive.events"; + private static final String ITERATION2 = "Iteration"; + private static final String DEFAULT_VERSION = "0.0.1"; + private static final String MONITORED_VALUE = "MonitoredValue"; /** * Gets the anomaly detection policy model. @@ -60,130 +73,142 @@ public class AdaptiveDomainModelFactory { public AxPolicyModel getAnomalyDetectionPolicyModel() { // CHECKSTYLE:ON: checkstyle:maximumMethodLength // Data types for event parameters - final AxContextSchema monitoredValue = - new AxContextSchema(new AxArtifactKey("MonitoredValue", "0.0.1"), "Java", "java.lang.Double"); - final AxContextSchema iteration = - new AxContextSchema(new AxArtifactKey("Iteration", "0.0.1"), "Java", "java.lang.Integer"); + final AxContextSchema monitoredValue = new AxContextSchema(new AxArtifactKey(MONITORED_VALUE, DEFAULT_VERSION), + "Java", "java.lang.Double"); + final AxContextSchema iteration = new AxContextSchema(new AxArtifactKey(ITERATION2, DEFAULT_VERSION), "Java", + "java.lang.Integer"); - final AxContextSchemas adContextSchemas = new AxContextSchemas(new AxArtifactKey("AADMDatatypes", "0.0.1")); + final AxContextSchemas adContextSchemas = new AxContextSchemas( + new AxArtifactKey("AADMDatatypes", DEFAULT_VERSION)); adContextSchemas.getSchemasMap().put(monitoredValue.getKey(), monitoredValue); adContextSchemas.getSchemasMap().put(iteration.getKey(), iteration); - final AxEvent anomalyDetectionTriggerEvent = - new AxEvent(new AxArtifactKey("AnomalyDetectionTriggerEvent", "0.0.1"), - "org.onap.policy.apex.examples.adaptive.events"); - anomalyDetectionTriggerEvent.setSource("External"); - anomalyDetectionTriggerEvent.setTarget("Match"); - anomalyDetectionTriggerEvent.getParameterMap().put("MonitoredValue", new AxField( - new AxReferenceKey(anomalyDetectionTriggerEvent.getKey(), "MonitoredValue"), monitoredValue.getKey())); - anomalyDetectionTriggerEvent.getParameterMap().put("Iteration", new AxField( - new AxReferenceKey(anomalyDetectionTriggerEvent.getKey(), "Iteration"), iteration.getKey())); - - final AxEvent anomalyDetectionMatchEvent = new AxEvent(new AxArtifactKey("AnomalyDetectionMatchEvent", "0.0.1"), - "org.onap.policy.apex.examples.adaptive.events"); - anomalyDetectionMatchEvent.setSource("Match"); - anomalyDetectionMatchEvent.setTarget("Establish"); - anomalyDetectionMatchEvent.getParameterMap().put("MonitoredValue", new AxField( - new AxReferenceKey(anomalyDetectionMatchEvent.getKey(), "MonitoredValue"), monitoredValue.getKey())); - anomalyDetectionMatchEvent.getParameterMap().put("Iteration", - new AxField(new AxReferenceKey(anomalyDetectionMatchEvent.getKey(), "Iteration"), iteration.getKey())); - - final AxEvent anomalyDetectionEstablishEvent = - new AxEvent(new AxArtifactKey("AnomalyDetectionEstablishEvent", "0.0.1"), - "org.onap.policy.apex.examples.adaptive.events"); - anomalyDetectionEstablishEvent.setSource("Establish"); - anomalyDetectionEstablishEvent.setTarget("Decide"); - anomalyDetectionEstablishEvent.getParameterMap().put("MonitoredValue", - new AxField(new AxReferenceKey(anomalyDetectionEstablishEvent.getKey(), "MonitoredValue"), - monitoredValue.getKey())); - anomalyDetectionEstablishEvent.getParameterMap().put("Iteration", new AxField( - new AxReferenceKey(anomalyDetectionEstablishEvent.getKey(), "Iteration"), iteration.getKey())); - - final AxEvent anomalyDetectionDecideEvent = - new AxEvent(new AxArtifactKey("AnomalyDetectionDecideEvent", "0.0.1"), - "org.onap.policy.apex.examples.adaptive.events"); - anomalyDetectionDecideEvent.setSource("Decide"); + final AxEvent anomalyDetectionTriggerEvent = new AxEvent( + new AxArtifactKey("AnomalyDetectionTriggerEvent", DEFAULT_VERSION), + DEFAULT_NAMESPACE); + anomalyDetectionTriggerEvent.setSource(EXTERNAL); + anomalyDetectionTriggerEvent.setTarget(MATCH); + anomalyDetectionTriggerEvent.getParameterMap().put(MONITORED_VALUE, + new AxField(new AxReferenceKey(anomalyDetectionTriggerEvent.getKey(), MONITORED_VALUE), + monitoredValue.getKey())); + anomalyDetectionTriggerEvent.getParameterMap().put(ITERATION2, new AxField( + new AxReferenceKey(anomalyDetectionTriggerEvent.getKey(), ITERATION2), iteration.getKey())); + + final AxEvent anomalyDetectionMatchEvent = new AxEvent( + new AxArtifactKey("AnomalyDetectionMatchEvent", DEFAULT_VERSION), + DEFAULT_NAMESPACE); + anomalyDetectionMatchEvent.setSource(MATCH); + anomalyDetectionMatchEvent.setTarget(ESTABLISH); + anomalyDetectionMatchEvent.getParameterMap().put(MONITORED_VALUE, + new AxField(new AxReferenceKey(anomalyDetectionMatchEvent.getKey(), MONITORED_VALUE), + monitoredValue.getKey())); + anomalyDetectionMatchEvent.getParameterMap().put(ITERATION2, new AxField( + new AxReferenceKey(anomalyDetectionMatchEvent.getKey(), ITERATION2), iteration.getKey())); + + final AxEvent anomalyDetectionEstablishEvent = new AxEvent( + new AxArtifactKey("AnomalyDetectionEstablishEvent", DEFAULT_VERSION), + DEFAULT_NAMESPACE); + anomalyDetectionEstablishEvent.setSource(ESTABLISH); + anomalyDetectionEstablishEvent.setTarget(DECIDE); + anomalyDetectionEstablishEvent.getParameterMap().put(MONITORED_VALUE, + new AxField(new AxReferenceKey(anomalyDetectionEstablishEvent.getKey(), MONITORED_VALUE), + monitoredValue.getKey())); + anomalyDetectionEstablishEvent.getParameterMap().put(ITERATION2, new AxField( + new AxReferenceKey(anomalyDetectionEstablishEvent.getKey(), ITERATION2), iteration.getKey())); + + final AxEvent anomalyDetectionDecideEvent = new AxEvent( + new AxArtifactKey("AnomalyDetectionDecideEvent", DEFAULT_VERSION), + DEFAULT_NAMESPACE); + anomalyDetectionDecideEvent.setSource(DECIDE); anomalyDetectionDecideEvent.setTarget("Act"); - anomalyDetectionDecideEvent.getParameterMap().put("MonitoredValue", new AxField( - new AxReferenceKey(anomalyDetectionDecideEvent.getKey(), "MonitoredValue"), monitoredValue.getKey())); - anomalyDetectionDecideEvent.getParameterMap().put("Iteration", - new AxField(new AxReferenceKey(anomalyDetectionDecideEvent.getKey(), "Iteration"), iteration.getKey())); - - final AxEvent anomalyDetectionActEvent = new AxEvent(new AxArtifactKey("AnomalyDetectionActEvent", "0.0.1"), - "org.onap.policy.apex.examples.adaptive.events"); + anomalyDetectionDecideEvent.getParameterMap().put(MONITORED_VALUE, + new AxField(new AxReferenceKey(anomalyDetectionDecideEvent.getKey(), MONITORED_VALUE), + monitoredValue.getKey())); + anomalyDetectionDecideEvent.getParameterMap().put(ITERATION2, new AxField( + new AxReferenceKey(anomalyDetectionDecideEvent.getKey(), ITERATION2), iteration.getKey())); + + final AxEvent anomalyDetectionActEvent = new AxEvent( + new AxArtifactKey("AnomalyDetectionActEvent", DEFAULT_VERSION), + DEFAULT_NAMESPACE); anomalyDetectionActEvent.setSource("Act"); - anomalyDetectionActEvent.setTarget("External"); - anomalyDetectionActEvent.getParameterMap().put("MonitoredValue", new AxField( - new AxReferenceKey(anomalyDetectionActEvent.getKey(), "MonitoredValue"), monitoredValue.getKey())); - anomalyDetectionActEvent.getParameterMap().put("Iteration", - new AxField(new AxReferenceKey(anomalyDetectionActEvent.getKey(), "Iteration"), iteration.getKey())); - - final AxEvents anomalyDetectionEvents = new AxEvents(new AxArtifactKey("AnomalyDetectionEvents", "0.0.1")); + anomalyDetectionActEvent.setTarget(EXTERNAL); + anomalyDetectionActEvent.getParameterMap().put(MONITORED_VALUE, + new AxField(new AxReferenceKey(anomalyDetectionActEvent.getKey(), MONITORED_VALUE), + monitoredValue.getKey())); + anomalyDetectionActEvent.getParameterMap().put(ITERATION2, new AxField( + new AxReferenceKey(anomalyDetectionActEvent.getKey(), ITERATION2), iteration.getKey())); + + final AxEvents anomalyDetectionEvents = new AxEvents( + new AxArtifactKey("AnomalyDetectionEvents", DEFAULT_VERSION)); anomalyDetectionEvents.getEventMap().put(anomalyDetectionTriggerEvent.getKey(), anomalyDetectionTriggerEvent); anomalyDetectionEvents.getEventMap().put(anomalyDetectionMatchEvent.getKey(), anomalyDetectionMatchEvent); anomalyDetectionEvents.getEventMap().put(anomalyDetectionEstablishEvent.getKey(), - anomalyDetectionEstablishEvent); + anomalyDetectionEstablishEvent); anomalyDetectionEvents.getEventMap().put(anomalyDetectionDecideEvent.getKey(), anomalyDetectionDecideEvent); anomalyDetectionEvents.getEventMap().put(anomalyDetectionActEvent.getKey(), anomalyDetectionActEvent); // Data types for context - final AxContextSchema anomalyDetection = new AxContextSchema(new AxArtifactKey("AnomalyDetection", "0.0.1"), - "Java", "org.onap.policy.apex.examples.adaptive.concepts.AnomalyDetection"); + final AxContextSchema anomalyDetection = new AxContextSchema( + new AxArtifactKey("AnomalyDetection", DEFAULT_VERSION), "Java", + "org.onap.policy.apex.examples.adaptive.concepts.AnomalyDetection"); adContextSchemas.getSchemasMap().put(anomalyDetection.getKey(), anomalyDetection); // One context map final AxContextAlbum anomalyDetectionAlbum = new AxContextAlbum( - new AxArtifactKey("AnomalyDetectionAlbum", "0.0.1"), "APPLICATION", true, anomalyDetection.getKey()); - final AxContextAlbums anomalyDetectionAlbums = - new AxContextAlbums(new AxArtifactKey("AnomalyDetectionAlbums", "0.0.1")); + new AxArtifactKey("AnomalyDetectionAlbum", DEFAULT_VERSION), "APPLICATION", true, + anomalyDetection.getKey()); + final AxContextAlbums anomalyDetectionAlbums = new AxContextAlbums( + new AxArtifactKey("AnomalyDetectionAlbums", DEFAULT_VERSION)); anomalyDetectionAlbums.getAlbumsMap().put(anomalyDetectionAlbum.getKey(), anomalyDetectionAlbum); // Tasks - final AxLogicReader logicReader = - new PolicyLogicReader().setLogicPackage(this.getClass().getPackage().getName()) + final AxLogicReader logicReader = new PolicyLogicReader() + .setLogicPackage(this.getClass().getPackage().getName()) .setDefaultLogic("DefaultAnomalyDetectionTask_Logic"); - final AxTask anomalyDetectionMatchTask = new AxTask(new AxArtifactKey("AnomalyDetectionMatchTask", "0.0.1")); + final AxTask anomalyDetectionMatchTask = new AxTask( + new AxArtifactKey("AnomalyDetectionMatchTask", DEFAULT_VERSION)); anomalyDetectionMatchTask.duplicateInputFields(anomalyDetectionTriggerEvent.getParameterMap()); anomalyDetectionMatchTask.duplicateOutputFields(anomalyDetectionMatchEvent.getParameterMap()); - anomalyDetectionMatchTask - .setTaskLogic(new AxTaskLogic(anomalyDetectionMatchTask.getKey(), "TaskLogic", "MVEL", logicReader)); + anomalyDetectionMatchTask.setTaskLogic( + new AxTaskLogic(anomalyDetectionMatchTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask anomalyDetectionEstablishTask = - new AxTask(new AxArtifactKey("AnomalyDetectionEstablishTask", "0.0.1")); + final AxTask anomalyDetectionEstablishTask = new AxTask( + new AxArtifactKey("AnomalyDetectionEstablishTask", DEFAULT_VERSION)); anomalyDetectionEstablishTask.duplicateInputFields(anomalyDetectionMatchEvent.getParameterMap()); anomalyDetectionEstablishTask.duplicateOutputFields(anomalyDetectionEstablishEvent.getParameterMap()); anomalyDetectionEstablishTask.setTaskLogic( - new AxTaskLogic(anomalyDetectionEstablishTask.getKey(), "TaskLogic", "MVEL", logicReader)); + new AxTaskLogic(anomalyDetectionEstablishTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask anomalyDetectionDecideTask0 = - new AxTask(new AxArtifactKey("AnomalyDetectionDecideTask0", "0.0.1")); + final AxTask anomalyDetectionDecideTask0 = new AxTask( + new AxArtifactKey("AnomalyDetectionDecideTask0", DEFAULT_VERSION)); anomalyDetectionDecideTask0.duplicateInputFields(anomalyDetectionEstablishEvent.getParameterMap()); anomalyDetectionDecideTask0.duplicateOutputFields(anomalyDetectionDecideEvent.getParameterMap()); - anomalyDetectionDecideTask0 - .setTaskLogic(new AxTaskLogic(anomalyDetectionDecideTask0.getKey(), "TaskLogic", "MVEL", logicReader)); + anomalyDetectionDecideTask0.setTaskLogic( + new AxTaskLogic(anomalyDetectionDecideTask0.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask anomalyDetectionDecideTask1 = - new AxTask(new AxArtifactKey("AnomalyDetectionDecideTask1", "0.0.1")); + final AxTask anomalyDetectionDecideTask1 = new AxTask( + new AxArtifactKey("AnomalyDetectionDecideTask1", DEFAULT_VERSION)); anomalyDetectionDecideTask1.duplicateInputFields(anomalyDetectionEstablishEvent.getParameterMap()); anomalyDetectionDecideTask1.duplicateOutputFields(anomalyDetectionDecideEvent.getParameterMap()); - anomalyDetectionDecideTask1 - .setTaskLogic(new AxTaskLogic(anomalyDetectionDecideTask1.getKey(), "TaskLogic", "MVEL", logicReader)); + anomalyDetectionDecideTask1.setTaskLogic( + new AxTaskLogic(anomalyDetectionDecideTask1.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask anomalyDetectionDecideTask2 = - new AxTask(new AxArtifactKey("AnomalyDetectionDecideTask2", "0.0.1")); + final AxTask anomalyDetectionDecideTask2 = new AxTask( + new AxArtifactKey("AnomalyDetectionDecideTask2", DEFAULT_VERSION)); anomalyDetectionDecideTask2.duplicateInputFields(anomalyDetectionEstablishEvent.getParameterMap()); anomalyDetectionDecideTask2.duplicateOutputFields(anomalyDetectionDecideEvent.getParameterMap()); - anomalyDetectionDecideTask2 - .setTaskLogic(new AxTaskLogic(anomalyDetectionDecideTask2.getKey(), "TaskLogic", "MVEL", logicReader)); + anomalyDetectionDecideTask2.setTaskLogic( + new AxTaskLogic(anomalyDetectionDecideTask2.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask anomalyDetectionActTask = new AxTask(new AxArtifactKey("AnomalyDetectionActTask", "0.0.1")); + final AxTask anomalyDetectionActTask = new AxTask( + new AxArtifactKey("AnomalyDetectionActTask", DEFAULT_VERSION)); anomalyDetectionActTask.duplicateInputFields(anomalyDetectionDecideEvent.getParameterMap()); anomalyDetectionActTask.duplicateOutputFields(anomalyDetectionActEvent.getParameterMap()); - anomalyDetectionActTask - .setTaskLogic(new AxTaskLogic(anomalyDetectionActTask.getKey(), "TaskLogic", "MVEL", logicReader)); + anomalyDetectionActTask.setTaskLogic( + new AxTaskLogic(anomalyDetectionActTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTasks anomalyDetectionTasks = new AxTasks(new AxArtifactKey("AnomalyDetectionTasks", "0.0.1")); + final AxTasks anomalyDetectionTasks = new AxTasks(new AxArtifactKey("AnomalyDetectionTasks", DEFAULT_VERSION)); anomalyDetectionTasks.getTaskMap().put(anomalyDetectionMatchTask.getKey(), anomalyDetectionMatchTask); anomalyDetectionTasks.getTaskMap().put(anomalyDetectionEstablishTask.getKey(), anomalyDetectionEstablishTask); anomalyDetectionTasks.getTaskMap().put(anomalyDetectionDecideTask0.getKey(), anomalyDetectionDecideTask0); @@ -192,92 +217,98 @@ public class AdaptiveDomainModelFactory { anomalyDetectionTasks.getTaskMap().put(anomalyDetectionActTask.getKey(), anomalyDetectionActTask); // Policies - logicReader.setDefaultLogic("DefaultState_Logic"); + logicReader.setDefaultLogic(DEFAULT_STATE_LOGIC); - final AxPolicy anomalyDetectionPolicy = new AxPolicy(new AxArtifactKey("AnomalyDetectionPolicy", "0.0.1")); + final AxPolicy anomalyDetectionPolicy = new AxPolicy( + new AxArtifactKey("AnomalyDetectionPolicy", DEFAULT_VERSION)); anomalyDetectionPolicy.setTemplate("MEDA"); - final AxState anomalyDetectionActState = - new AxState(new AxReferenceKey(anomalyDetectionPolicy.getKey(), "Act")); + final AxState anomalyDetectionActState = new AxState( + new AxReferenceKey(anomalyDetectionPolicy.getKey(), "Act")); anomalyDetectionActState.setTrigger(anomalyDetectionDecideEvent.getKey()); final AxStateOutput adAct2Out = new AxStateOutput(anomalyDetectionActState.getKey(), - AxReferenceKey.getNullKey(), anomalyDetectionActEvent.getKey()); + AxReferenceKey.getNullKey(), anomalyDetectionActEvent.getKey()); anomalyDetectionActState.getStateOutputs().put(adAct2Out.getKey().getLocalName(), adAct2Out); - anomalyDetectionActState.setTaskSelectionLogic( - new AxTaskSelectionLogic(anomalyDetectionActState.getKey(), "TaskSelectionLogic", "MVEL", logicReader)); + anomalyDetectionActState.setTaskSelectionLogic(new AxTaskSelectionLogic(anomalyDetectionActState.getKey(), + TASK_SELECTION_LOGIC, "MVEL", logicReader)); anomalyDetectionActState.setDefaultTask(anomalyDetectionActTask.getKey()); anomalyDetectionActState.getTaskReferences().put(anomalyDetectionActTask.getKey(), - new AxStateTaskReference(anomalyDetectionActState.getKey(), anomalyDetectionActTask.getKey(), - AxStateTaskOutputType.DIRECT, adAct2Out.getKey())); + new AxStateTaskReference(anomalyDetectionActState.getKey(), anomalyDetectionActTask.getKey(), + AxStateTaskOutputType.DIRECT, adAct2Out.getKey())); logicReader.setDefaultLogic(null); - final AxState anomalyDetectionDecideState = - new AxState(new AxReferenceKey(anomalyDetectionPolicy.getKey(), "Decide")); + final AxState anomalyDetectionDecideState = new AxState( + new AxReferenceKey(anomalyDetectionPolicy.getKey(), DECIDE)); anomalyDetectionDecideState.setTrigger(anomalyDetectionEstablishEvent.getKey()); final AxStateOutput adDec2Act = new AxStateOutput(anomalyDetectionDecideState.getKey(), - anomalyDetectionActState.getKey(), anomalyDetectionDecideEvent.getKey()); + anomalyDetectionActState.getKey(), anomalyDetectionDecideEvent.getKey()); anomalyDetectionDecideState.getStateOutputs().put(adDec2Act.getKey().getLocalName(), adDec2Act); anomalyDetectionDecideState.setTaskSelectionLogic(new AxTaskSelectionLogic(anomalyDetectionDecideState.getKey(), - "TaskSelectionLogic", "JAVA", logicReader)); + TASK_SELECTION_LOGIC, "JAVA", logicReader)); anomalyDetectionDecideState.setDefaultTask(anomalyDetectionDecideTask0.getKey()); anomalyDetectionDecideState.getContextAlbumReferences().add(anomalyDetectionAlbum.getKey()); anomalyDetectionDecideState.getTaskReferences().put(anomalyDetectionDecideTask0.getKey(), - new AxStateTaskReference(anomalyDetectionDecideState.getKey(), anomalyDetectionDecideTask0.getKey(), - AxStateTaskOutputType.DIRECT, adDec2Act.getKey())); + new AxStateTaskReference(anomalyDetectionDecideState.getKey(), + anomalyDetectionDecideTask0.getKey(), AxStateTaskOutputType.DIRECT, + adDec2Act.getKey())); anomalyDetectionDecideState.getTaskReferences().put(anomalyDetectionDecideTask1.getKey(), - new AxStateTaskReference(anomalyDetectionDecideState.getKey(), anomalyDetectionDecideTask1.getKey(), - AxStateTaskOutputType.DIRECT, adDec2Act.getKey())); + new AxStateTaskReference(anomalyDetectionDecideState.getKey(), + anomalyDetectionDecideTask1.getKey(), AxStateTaskOutputType.DIRECT, + adDec2Act.getKey())); anomalyDetectionDecideState.getTaskReferences().put(anomalyDetectionDecideTask2.getKey(), - new AxStateTaskReference(anomalyDetectionDecideState.getKey(), anomalyDetectionDecideTask2.getKey(), - AxStateTaskOutputType.DIRECT, adDec2Act.getKey())); + new AxStateTaskReference(anomalyDetectionDecideState.getKey(), + anomalyDetectionDecideTask2.getKey(), AxStateTaskOutputType.DIRECT, + adDec2Act.getKey())); - logicReader.setDefaultLogic("DefaultState_Logic"); + logicReader.setDefaultLogic(DEFAULT_STATE_LOGIC); - final AxState anomalyDetectionEstablishState = - new AxState(new AxReferenceKey(anomalyDetectionPolicy.getKey(), "Establish")); + final AxState anomalyDetectionEstablishState = new AxState( + new AxReferenceKey(anomalyDetectionPolicy.getKey(), ESTABLISH)); anomalyDetectionEstablishState.setTrigger(anomalyDetectionMatchEvent.getKey()); final AxStateOutput adEst2Dec = new AxStateOutput(anomalyDetectionEstablishState.getKey(), - anomalyDetectionDecideState.getKey(), anomalyDetectionEstablishEvent.getKey()); + anomalyDetectionDecideState.getKey(), anomalyDetectionEstablishEvent.getKey()); anomalyDetectionEstablishState.getStateOutputs().put(adEst2Dec.getKey().getLocalName(), adEst2Dec); anomalyDetectionEstablishState.setTaskSelectionLogic(new AxTaskSelectionLogic( - anomalyDetectionEstablishState.getKey(), "TaskSelectionLogic", "MVEL", logicReader)); + anomalyDetectionEstablishState.getKey(), TASK_SELECTION_LOGIC, "MVEL", logicReader)); anomalyDetectionEstablishState.setDefaultTask(anomalyDetectionEstablishTask.getKey()); anomalyDetectionEstablishState.getTaskReferences().put(anomalyDetectionEstablishTask.getKey(), - new AxStateTaskReference(anomalyDetectionEstablishState.getKey(), - anomalyDetectionEstablishTask.getKey(), AxStateTaskOutputType.DIRECT, adEst2Dec.getKey())); + new AxStateTaskReference(anomalyDetectionEstablishState.getKey(), + anomalyDetectionEstablishTask.getKey(), AxStateTaskOutputType.DIRECT, + adEst2Dec.getKey())); - final AxState anomalyDetectionMatchState = - new AxState(new AxReferenceKey(anomalyDetectionPolicy.getKey(), "Match")); + final AxState anomalyDetectionMatchState = new AxState( + new AxReferenceKey(anomalyDetectionPolicy.getKey(), MATCH)); anomalyDetectionMatchState.setTrigger(anomalyDetectionTriggerEvent.getKey()); final AxStateOutput adMat2Est = new AxStateOutput(anomalyDetectionMatchState.getKey(), - anomalyDetectionEstablishState.getKey(), anomalyDetectionMatchEvent.getKey()); + anomalyDetectionEstablishState.getKey(), anomalyDetectionMatchEvent.getKey()); anomalyDetectionMatchState.getStateOutputs().put(adMat2Est.getKey().getLocalName(), adMat2Est); anomalyDetectionMatchState.setTaskSelectionLogic(new AxTaskSelectionLogic(anomalyDetectionMatchState.getKey(), - "TaskSelectionLogic", "MVEL", logicReader)); + TASK_SELECTION_LOGIC, "MVEL", logicReader)); anomalyDetectionMatchState.setDefaultTask(anomalyDetectionMatchTask.getKey()); anomalyDetectionMatchState.getTaskReferences().put(anomalyDetectionMatchTask.getKey(), - new AxStateTaskReference(anomalyDetectionMatchState.getKey(), anomalyDetectionMatchTask.getKey(), - AxStateTaskOutputType.DIRECT, adMat2Est.getKey())); + new AxStateTaskReference(anomalyDetectionMatchState.getKey(), + anomalyDetectionMatchTask.getKey(), AxStateTaskOutputType.DIRECT, + adMat2Est.getKey())); anomalyDetectionPolicy.setFirstState(anomalyDetectionMatchState.getKey().getLocalName()); anomalyDetectionPolicy.getStateMap().put(anomalyDetectionMatchState.getKey().getLocalName(), - anomalyDetectionMatchState); + anomalyDetectionMatchState); anomalyDetectionPolicy.getStateMap().put(anomalyDetectionEstablishState.getKey().getLocalName(), - anomalyDetectionEstablishState); + anomalyDetectionEstablishState); anomalyDetectionPolicy.getStateMap().put(anomalyDetectionDecideState.getKey().getLocalName(), - anomalyDetectionDecideState); + anomalyDetectionDecideState); anomalyDetectionPolicy.getStateMap().put(anomalyDetectionActState.getKey().getLocalName(), - anomalyDetectionActState); + anomalyDetectionActState); - final AxPolicies anomalyDetectionPolicies = - new AxPolicies(new AxArtifactKey("AnomalyDetectionPolicies", "0.0.1")); + final AxPolicies anomalyDetectionPolicies = new AxPolicies( + new AxArtifactKey("AnomalyDetectionPolicies", DEFAULT_VERSION)); anomalyDetectionPolicies.getPolicyMap().put(anomalyDetectionPolicy.getKey(), anomalyDetectionPolicy); - final AxKeyInformation keyInformation = - new AxKeyInformation(new AxArtifactKey("AnomalyDetectionKeyInformation", "0.0.1")); - final AxPolicyModel anomalyDetectionPolicyModel = - new AxPolicyModel(new AxArtifactKey("AnomalyDetectionPolicyModel", "0.0.1")); + final AxKeyInformation keyInformation = new AxKeyInformation( + new AxArtifactKey("AnomalyDetectionKeyInformation", DEFAULT_VERSION)); + final AxPolicyModel anomalyDetectionPolicyModel = new AxPolicyModel( + new AxArtifactKey("AnomalyDetectionPolicyModel", DEFAULT_VERSION)); anomalyDetectionPolicyModel.setPolicies(anomalyDetectionPolicies); anomalyDetectionPolicyModel.setEvents(anomalyDetectionEvents); anomalyDetectionPolicyModel.setTasks(anomalyDetectionTasks); @@ -302,58 +333,65 @@ public class AdaptiveDomainModelFactory { public AxPolicyModel getAutoLearnPolicyModel() { // CHECKSTYLE:ON: checkstyle:maximumMethodLength // Data types for event parameters - final AxContextSchema monitoredValue = - new AxContextSchema(new AxArtifactKey("MonitoredValue", "0.0.1"), "Java", "java.lang.Double"); + final AxContextSchema monitoredValue = new AxContextSchema(new AxArtifactKey(MONITORED_VALUE, DEFAULT_VERSION), + "Java", "java.lang.Double"); - final AxContextSchemas alContextSchemas = new AxContextSchemas(new AxArtifactKey("ALDatatypes", "0.0.1")); + final AxContextSchemas alContextSchemas = new AxContextSchemas( + new AxArtifactKey("ALDatatypes", DEFAULT_VERSION)); alContextSchemas.getSchemasMap().put(monitoredValue.getKey(), monitoredValue); - final AxEvent autoLearnTriggerEvent = new AxEvent(new AxArtifactKey("AutoLearnTriggerEvent", "0.0.1"), - "org.onap.policy.apex.examples.adaptive.events"); - autoLearnTriggerEvent.setSource("External"); - autoLearnTriggerEvent.setTarget("Match"); - autoLearnTriggerEvent.getParameterMap().put("MonitoredValue", new AxField( - new AxReferenceKey(autoLearnTriggerEvent.getKey(), "MonitoredValue"), monitoredValue.getKey())); - autoLearnTriggerEvent.getParameterMap().put("LastMonitoredValue", new AxField( - new AxReferenceKey(autoLearnTriggerEvent.getKey(), "LastMonitoredValue"), monitoredValue.getKey())); - - final AxEvent autoLearnMatchEvent = new AxEvent(new AxArtifactKey("AutoLearnMatchEvent", "0.0.1"), - "org.onap.policy.apex.examples.adaptive.events"); - autoLearnMatchEvent.setSource("Match"); - autoLearnMatchEvent.setTarget("Establish"); - autoLearnMatchEvent.getParameterMap().put("MonitoredValue", new AxField( - new AxReferenceKey(autoLearnMatchEvent.getKey(), "MonitoredValue"), monitoredValue.getKey())); - autoLearnMatchEvent.getParameterMap().put("LastMonitoredValue", new AxField( - new AxReferenceKey(autoLearnMatchEvent.getKey(), "LastMonitoredValue"), monitoredValue.getKey())); - - final AxEvent autoLearnEstablishEvent = new AxEvent(new AxArtifactKey("AutoLearnEstablishEvent", "0.0.1"), - "org.onap.policy.apex.examples.adaptive.events"); - autoLearnEstablishEvent.setSource("Establish"); - autoLearnEstablishEvent.setTarget("Decide"); - autoLearnEstablishEvent.getParameterMap().put("MonitoredValue", new AxField( - new AxReferenceKey(autoLearnEstablishEvent.getKey(), "MonitoredValue"), monitoredValue.getKey())); - autoLearnEstablishEvent.getParameterMap().put("LastMonitoredValue", new AxField( - new AxReferenceKey(autoLearnEstablishEvent.getKey(), "LastMonitoredValue"), monitoredValue.getKey())); - - final AxEvent autoLearnDecideEvent = new AxEvent(new AxArtifactKey("AutoLearnDecideEvent", "0.0.1"), - "org.onap.policy.apex.examples.adaptive.events"); - autoLearnDecideEvent.setSource("Decide"); + final AxEvent autoLearnTriggerEvent = new AxEvent(new AxArtifactKey("AutoLearnTriggerEvent", DEFAULT_VERSION), + DEFAULT_NAMESPACE); + autoLearnTriggerEvent.setSource(EXTERNAL); + autoLearnTriggerEvent.setTarget(MATCH); + autoLearnTriggerEvent.getParameterMap().put(MONITORED_VALUE, new AxField( + new AxReferenceKey(autoLearnTriggerEvent.getKey(), MONITORED_VALUE), monitoredValue.getKey())); + autoLearnTriggerEvent.getParameterMap().put(LAST_MONITORED_VALUE, + new AxField(new AxReferenceKey(autoLearnTriggerEvent.getKey(), LAST_MONITORED_VALUE), + monitoredValue.getKey())); + + final AxEvent autoLearnMatchEvent = new AxEvent(new AxArtifactKey("AutoLearnMatchEvent", DEFAULT_VERSION), + DEFAULT_NAMESPACE); + autoLearnMatchEvent.setSource(MATCH); + autoLearnMatchEvent.setTarget(ESTABLISH); + autoLearnMatchEvent.getParameterMap().put(MONITORED_VALUE, new AxField( + new AxReferenceKey(autoLearnMatchEvent.getKey(), MONITORED_VALUE), monitoredValue.getKey())); + autoLearnMatchEvent.getParameterMap().put(LAST_MONITORED_VALUE, + new AxField(new AxReferenceKey(autoLearnMatchEvent.getKey(), LAST_MONITORED_VALUE), + monitoredValue.getKey())); + + final AxEvent autoLearnEstablishEvent = new AxEvent( + new AxArtifactKey("AutoLearnEstablishEvent", DEFAULT_VERSION), + DEFAULT_NAMESPACE); + autoLearnEstablishEvent.setSource(ESTABLISH); + autoLearnEstablishEvent.setTarget(DECIDE); + autoLearnEstablishEvent.getParameterMap().put(MONITORED_VALUE, + new AxField(new AxReferenceKey(autoLearnEstablishEvent.getKey(), MONITORED_VALUE), + monitoredValue.getKey())); + autoLearnEstablishEvent.getParameterMap().put(LAST_MONITORED_VALUE, + new AxField(new AxReferenceKey(autoLearnEstablishEvent.getKey(), LAST_MONITORED_VALUE), + monitoredValue.getKey())); + + final AxEvent autoLearnDecideEvent = new AxEvent(new AxArtifactKey("AutoLearnDecideEvent", DEFAULT_VERSION), + DEFAULT_NAMESPACE); + autoLearnDecideEvent.setSource(DECIDE); autoLearnDecideEvent.setTarget("Act"); - autoLearnDecideEvent.getParameterMap().put("MonitoredValue", new AxField( - new AxReferenceKey(autoLearnDecideEvent.getKey(), "MonitoredValue"), monitoredValue.getKey())); - autoLearnDecideEvent.getParameterMap().put("LastMonitoredValue", new AxField( - new AxReferenceKey(autoLearnDecideEvent.getKey(), "LastMonitoredValue"), monitoredValue.getKey())); - - final AxEvent autoLearnActEvent = new AxEvent(new AxArtifactKey("AutoLearnActEvent", "0.0.1"), - "org.onap.policy.apex.examples.adaptive.events"); + autoLearnDecideEvent.getParameterMap().put(MONITORED_VALUE, new AxField( + new AxReferenceKey(autoLearnDecideEvent.getKey(), MONITORED_VALUE), monitoredValue.getKey())); + autoLearnDecideEvent.getParameterMap().put(LAST_MONITORED_VALUE, + new AxField(new AxReferenceKey(autoLearnDecideEvent.getKey(), LAST_MONITORED_VALUE), + monitoredValue.getKey())); + + final AxEvent autoLearnActEvent = new AxEvent(new AxArtifactKey("AutoLearnActEvent", DEFAULT_VERSION), + DEFAULT_NAMESPACE); autoLearnActEvent.setSource("Act"); - autoLearnActEvent.setTarget("External"); - autoLearnActEvent.getParameterMap().put("MonitoredValue", - new AxField(new AxReferenceKey(autoLearnActEvent.getKey(), "MonitoredValue"), monitoredValue.getKey())); - autoLearnActEvent.getParameterMap().put("LastMonitoredValue", new AxField( - new AxReferenceKey(autoLearnActEvent.getKey(), "LastMonitoredValue"), monitoredValue.getKey())); + autoLearnActEvent.setTarget(EXTERNAL); + autoLearnActEvent.getParameterMap().put(MONITORED_VALUE, new AxField( + new AxReferenceKey(autoLearnActEvent.getKey(), MONITORED_VALUE), monitoredValue.getKey())); + autoLearnActEvent.getParameterMap().put(LAST_MONITORED_VALUE, new AxField( + new AxReferenceKey(autoLearnActEvent.getKey(), LAST_MONITORED_VALUE), monitoredValue.getKey())); - final AxEvents autoLearnEvents = new AxEvents(new AxArtifactKey("AutoLearnEvents", "0.0.1")); + final AxEvents autoLearnEvents = new AxEvents(new AxArtifactKey("AutoLearnEvents", DEFAULT_VERSION)); autoLearnEvents.getEventMap().put(autoLearnTriggerEvent.getKey(), autoLearnTriggerEvent); autoLearnEvents.getEventMap().put(autoLearnMatchEvent.getKey(), autoLearnMatchEvent); autoLearnEvents.getEventMap().put(autoLearnEstablishEvent.getKey(), autoLearnEstablishEvent); @@ -361,84 +399,86 @@ public class AdaptiveDomainModelFactory { autoLearnEvents.getEventMap().put(autoLearnActEvent.getKey(), autoLearnActEvent); // Data types for context - final AxContextSchema autoLearn = new AxContextSchema(new AxArtifactKey("AutoLearn", "0.0.1"), "Java", - "org.onap.policy.apex.examples.adaptive.concepts.AutoLearn"); + final AxContextSchema autoLearn = new AxContextSchema(new AxArtifactKey("AutoLearn", DEFAULT_VERSION), "Java", + "org.onap.policy.apex.examples.adaptive.concepts.AutoLearn"); alContextSchemas.getSchemasMap().put(autoLearn.getKey(), autoLearn); // One context map - final AxContextAlbum autoLearnAlbum = new AxContextAlbum(new AxArtifactKey("AutoLearnAlbum", "0.0.1"), - "APPLICATION", true, autoLearn.getKey()); + final AxContextAlbum autoLearnAlbum = new AxContextAlbum(new AxArtifactKey("AutoLearnAlbum", DEFAULT_VERSION), + "APPLICATION", true, autoLearn.getKey()); - final AxContextAlbums autoLearnAlbums = new AxContextAlbums(new AxArtifactKey("AutoLearnContext", "0.0.1")); + final AxContextAlbums autoLearnAlbums = new AxContextAlbums( + new AxArtifactKey("AutoLearnContext", DEFAULT_VERSION)); autoLearnAlbums.getAlbumsMap().put(autoLearnAlbum.getKey(), autoLearnAlbum); // Tasks final AxLogicReader logicReader = new PolicyLogicReader() - .setLogicPackage(this.getClass().getPackage().getName()).setDefaultLogic("DefaultAutoLearnTask_Logic"); + .setLogicPackage(this.getClass().getPackage().getName()) + .setDefaultLogic("DefaultAutoLearnTask_Logic"); - final AxTask autoLearnMatchTask = new AxTask(new AxArtifactKey("AutoLearnMatchTask", "0.0.1")); + final AxTask autoLearnMatchTask = new AxTask(new AxArtifactKey("AutoLearnMatchTask", DEFAULT_VERSION)); autoLearnMatchTask.duplicateInputFields(autoLearnTriggerEvent.getParameterMap()); autoLearnMatchTask.duplicateOutputFields(autoLearnMatchEvent.getParameterMap()); - autoLearnMatchTask.setTaskLogic(new AxTaskLogic(autoLearnMatchTask.getKey(), "TaskLogic", "MVEL", logicReader)); + autoLearnMatchTask.setTaskLogic(new AxTaskLogic(autoLearnMatchTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask autoLearnEstablishTask = new AxTask(new AxArtifactKey("AutoLearnEstablishTask", "0.0.1")); + final AxTask autoLearnEstablishTask = new AxTask(new AxArtifactKey("AutoLearnEstablishTask", DEFAULT_VERSION)); autoLearnEstablishTask.duplicateInputFields(autoLearnMatchEvent.getParameterMap()); autoLearnEstablishTask.duplicateOutputFields(autoLearnEstablishEvent.getParameterMap()); - autoLearnEstablishTask - .setTaskLogic(new AxTaskLogic(autoLearnEstablishTask.getKey(), "TaskLogic", "MVEL", logicReader)); + autoLearnEstablishTask.setTaskLogic( + new AxTaskLogic(autoLearnEstablishTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); logicReader.setDefaultLogic(null); - final AxTask autoLearnDecideTask0 = new AxTask(new AxArtifactKey("AutoLearnDecideTask0", "0.0.1")); + final AxTask autoLearnDecideTask0 = new AxTask(new AxArtifactKey("AutoLearnDecideTask0", DEFAULT_VERSION)); autoLearnDecideTask0.duplicateInputFields(autoLearnEstablishEvent.getParameterMap()); autoLearnDecideTask0.duplicateOutputFields(autoLearnDecideEvent.getParameterMap()); autoLearnDecideTask0 - .setTaskLogic(new AxTaskLogic(autoLearnDecideTask0.getKey(), "TaskLogic", "MVEL", logicReader)); + .setTaskLogic(new AxTaskLogic(autoLearnDecideTask0.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask autoLearnDecideTask1 = new AxTask(new AxArtifactKey("AutoLearnDecideTask1", "0.0.1")); + final AxTask autoLearnDecideTask1 = new AxTask(new AxArtifactKey("AutoLearnDecideTask1", DEFAULT_VERSION)); autoLearnDecideTask1.duplicateInputFields(autoLearnEstablishEvent.getParameterMap()); autoLearnDecideTask1.duplicateOutputFields(autoLearnDecideEvent.getParameterMap()); autoLearnDecideTask1 - .setTaskLogic(new AxTaskLogic(autoLearnDecideTask1.getKey(), "TaskLogic", "MVEL", logicReader)); + .setTaskLogic(new AxTaskLogic(autoLearnDecideTask1.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask autoLearnDecideTask2 = new AxTask(new AxArtifactKey("AutoLearnDecideTask2", "0.0.1")); + final AxTask autoLearnDecideTask2 = new AxTask(new AxArtifactKey("AutoLearnDecideTask2", DEFAULT_VERSION)); autoLearnDecideTask2.duplicateInputFields(autoLearnEstablishEvent.getParameterMap()); autoLearnDecideTask2.duplicateOutputFields(autoLearnDecideEvent.getParameterMap()); autoLearnDecideTask2 - .setTaskLogic(new AxTaskLogic(autoLearnDecideTask2.getKey(), "TaskLogic", "MVEL", logicReader)); + .setTaskLogic(new AxTaskLogic(autoLearnDecideTask2.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask autoLearnDecideTask3 = new AxTask(new AxArtifactKey("AutoLearnDecideTask3", "0.0.1")); + final AxTask autoLearnDecideTask3 = new AxTask(new AxArtifactKey("AutoLearnDecideTask3", DEFAULT_VERSION)); autoLearnDecideTask3.duplicateInputFields(autoLearnEstablishEvent.getParameterMap()); autoLearnDecideTask3.duplicateOutputFields(autoLearnDecideEvent.getParameterMap()); autoLearnDecideTask3 - .setTaskLogic(new AxTaskLogic(autoLearnDecideTask3.getKey(), "TaskLogic", "MVEL", logicReader)); + .setTaskLogic(new AxTaskLogic(autoLearnDecideTask3.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask autoLearnDecideTask4 = new AxTask(new AxArtifactKey("AutoLearnDecideTask4", "0.0.1")); + final AxTask autoLearnDecideTask4 = new AxTask(new AxArtifactKey("AutoLearnDecideTask4", DEFAULT_VERSION)); autoLearnDecideTask4.duplicateInputFields(autoLearnEstablishEvent.getParameterMap()); autoLearnDecideTask4.duplicateOutputFields(autoLearnDecideEvent.getParameterMap()); autoLearnDecideTask4 - .setTaskLogic(new AxTaskLogic(autoLearnDecideTask4.getKey(), "TaskLogic", "MVEL", logicReader)); + .setTaskLogic(new AxTaskLogic(autoLearnDecideTask4.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask autoLearnDecideTask5 = new AxTask(new AxArtifactKey("AutoLearnDecideTask5", "0.0.1")); + final AxTask autoLearnDecideTask5 = new AxTask(new AxArtifactKey("AutoLearnDecideTask5", DEFAULT_VERSION)); autoLearnDecideTask5.duplicateInputFields(autoLearnEstablishEvent.getParameterMap()); autoLearnDecideTask5.duplicateOutputFields(autoLearnDecideEvent.getParameterMap()); autoLearnDecideTask5 - .setTaskLogic(new AxTaskLogic(autoLearnDecideTask5.getKey(), "TaskLogic", "MVEL", logicReader)); + .setTaskLogic(new AxTaskLogic(autoLearnDecideTask5.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask autoLearnDecideTask6 = new AxTask(new AxArtifactKey("AutoLearnDecideTask6", "0.0.1")); + final AxTask autoLearnDecideTask6 = new AxTask(new AxArtifactKey("AutoLearnDecideTask6", DEFAULT_VERSION)); autoLearnDecideTask6.duplicateInputFields(autoLearnEstablishEvent.getParameterMap()); autoLearnDecideTask6.duplicateOutputFields(autoLearnDecideEvent.getParameterMap()); autoLearnDecideTask6 - .setTaskLogic(new AxTaskLogic(autoLearnDecideTask6.getKey(), "TaskLogic", "MVEL", logicReader)); + .setTaskLogic(new AxTaskLogic(autoLearnDecideTask6.getKey(), TASK_LOGIC, "MVEL", logicReader)); logicReader.setDefaultLogic("DefaultAutoLearnTask_Logic"); - final AxTask autoLearnActTask = new AxTask(new AxArtifactKey("AutoLearnActTask", "0.0.1")); + final AxTask autoLearnActTask = new AxTask(new AxArtifactKey("AutoLearnActTask", DEFAULT_VERSION)); autoLearnActTask.duplicateInputFields(autoLearnDecideEvent.getParameterMap()); autoLearnActTask.duplicateOutputFields(autoLearnActEvent.getParameterMap()); - autoLearnActTask.setTaskLogic(new AxTaskLogic(autoLearnActTask.getKey(), "TaskLogic", "MVEL", logicReader)); + autoLearnActTask.setTaskLogic(new AxTaskLogic(autoLearnActTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTasks autoLearnTasks = new AxTasks(new AxArtifactKey("AutoLearnTasks", "0.0.1")); + final AxTasks autoLearnTasks = new AxTasks(new AxArtifactKey("AutoLearnTasks", DEFAULT_VERSION)); autoLearnTasks.getTaskMap().put(autoLearnMatchTask.getKey(), autoLearnMatchTask); autoLearnTasks.getTaskMap().put(autoLearnEstablishTask.getKey(), autoLearnEstablishTask); autoLearnTasks.getTaskMap().put(autoLearnDecideTask0.getKey(), autoLearnDecideTask0); @@ -451,81 +491,81 @@ public class AdaptiveDomainModelFactory { autoLearnTasks.getTaskMap().put(autoLearnActTask.getKey(), autoLearnActTask); // Policies - logicReader.setDefaultLogic("DefaultState_Logic"); + logicReader.setDefaultLogic(DEFAULT_STATE_LOGIC); - final AxPolicy autoLearnPolicy = new AxPolicy(new AxArtifactKey("AutoLearnPolicy", "0.0.1")); + final AxPolicy autoLearnPolicy = new AxPolicy(new AxArtifactKey("AutoLearnPolicy", DEFAULT_VERSION)); autoLearnPolicy.setTemplate("MEDA"); final AxState autoLearnActState = new AxState(new AxReferenceKey(autoLearnPolicy.getKey(), "Act")); autoLearnActState.setTrigger(autoLearnDecideEvent.getKey()); - final AxStateOutput alAct2Out = - new AxStateOutput(autoLearnActState.getKey(), AxReferenceKey.getNullKey(), autoLearnActEvent.getKey()); + final AxStateOutput alAct2Out = new AxStateOutput(autoLearnActState.getKey(), AxReferenceKey.getNullKey(), + autoLearnActEvent.getKey()); autoLearnActState.getStateOutputs().put(alAct2Out.getKey().getLocalName(), alAct2Out); - autoLearnActState.setTaskSelectionLogic( - new AxTaskSelectionLogic(autoLearnActState.getKey(), "TaskSelectionLogic", "MVEL", logicReader)); + autoLearnActState.setTaskSelectionLogic(new AxTaskSelectionLogic(autoLearnActState.getKey(), + TASK_SELECTION_LOGIC, "MVEL", logicReader)); autoLearnActState.setDefaultTask(autoLearnActTask.getKey()); autoLearnActState.getTaskReferences().put(autoLearnActTask.getKey(), - new AxStateTaskReference(autoLearnActState.getKey(), autoLearnActTask.getKey(), - AxStateTaskOutputType.DIRECT, alAct2Out.getKey())); + new AxStateTaskReference(autoLearnActState.getKey(), autoLearnActTask.getKey(), + AxStateTaskOutputType.DIRECT, alAct2Out.getKey())); logicReader.setDefaultLogic(null); - final AxState autoLearnDecideState = new AxState(new AxReferenceKey(autoLearnPolicy.getKey(), "Decide")); + final AxState autoLearnDecideState = new AxState(new AxReferenceKey(autoLearnPolicy.getKey(), DECIDE)); autoLearnDecideState.setTrigger(autoLearnEstablishEvent.getKey()); final AxStateOutput alDec2Act = new AxStateOutput(autoLearnDecideState.getKey(), autoLearnActState.getKey(), - autoLearnDecideEvent.getKey()); + autoLearnDecideEvent.getKey()); autoLearnDecideState.getStateOutputs().put(alDec2Act.getKey().getLocalName(), alDec2Act); autoLearnDecideState.getContextAlbumReferences().add(autoLearnAlbum.getKey()); - autoLearnDecideState.setTaskSelectionLogic( - new AxTaskSelectionLogic(autoLearnDecideState.getKey(), "TaskSelectionLogic", "JAVA", logicReader)); + autoLearnDecideState.setTaskSelectionLogic(new AxTaskSelectionLogic(autoLearnDecideState.getKey(), + TASK_SELECTION_LOGIC, "JAVA", logicReader)); autoLearnDecideState.setDefaultTask(autoLearnDecideTask0.getKey()); autoLearnDecideState.getTaskReferences().put(autoLearnDecideTask0.getKey(), - new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask0.getKey(), - AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); + new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask0.getKey(), + AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); autoLearnDecideState.getTaskReferences().put(autoLearnDecideTask1.getKey(), - new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask1.getKey(), - AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); + new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask1.getKey(), + AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); autoLearnDecideState.getTaskReferences().put(autoLearnDecideTask2.getKey(), - new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask2.getKey(), - AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); + new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask2.getKey(), + AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); autoLearnDecideState.getTaskReferences().put(autoLearnDecideTask3.getKey(), - new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask3.getKey(), - AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); + new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask3.getKey(), + AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); autoLearnDecideState.getTaskReferences().put(autoLearnDecideTask4.getKey(), - new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask4.getKey(), - AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); + new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask4.getKey(), + AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); autoLearnDecideState.getTaskReferences().put(autoLearnDecideTask5.getKey(), - new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask5.getKey(), - AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); + new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask5.getKey(), + AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); autoLearnDecideState.getTaskReferences().put(autoLearnDecideTask6.getKey(), - new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask6.getKey(), - AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); + new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask6.getKey(), + AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); - logicReader.setDefaultLogic("DefaultState_Logic"); + logicReader.setDefaultLogic(DEFAULT_STATE_LOGIC); - final AxState autoLearnEstablishState = new AxState(new AxReferenceKey(autoLearnPolicy.getKey(), "Establish")); + final AxState autoLearnEstablishState = new AxState(new AxReferenceKey(autoLearnPolicy.getKey(), ESTABLISH)); autoLearnEstablishState.setTrigger(autoLearnMatchEvent.getKey()); final AxStateOutput alEst2Dec = new AxStateOutput(autoLearnEstablishState.getKey(), - autoLearnDecideState.getKey(), autoLearnEstablishEvent.getKey()); + autoLearnDecideState.getKey(), autoLearnEstablishEvent.getKey()); autoLearnEstablishState.getStateOutputs().put(alEst2Dec.getKey().getLocalName(), alEst2Dec); - autoLearnEstablishState.setTaskSelectionLogic( - new AxTaskSelectionLogic(autoLearnEstablishState.getKey(), "TaskSelectionLogic", "MVEL", logicReader)); + autoLearnEstablishState.setTaskSelectionLogic(new AxTaskSelectionLogic(autoLearnEstablishState.getKey(), + TASK_SELECTION_LOGIC, "MVEL", logicReader)); autoLearnEstablishState.setDefaultTask(autoLearnEstablishTask.getKey()); autoLearnEstablishState.getTaskReferences().put(autoLearnEstablishTask.getKey(), - new AxStateTaskReference(autoLearnEstablishState.getKey(), autoLearnEstablishTask.getKey(), - AxStateTaskOutputType.DIRECT, alEst2Dec.getKey())); + new AxStateTaskReference(autoLearnEstablishState.getKey(), autoLearnEstablishTask.getKey(), + AxStateTaskOutputType.DIRECT, alEst2Dec.getKey())); - final AxState autoLearnMatchState = new AxState(new AxReferenceKey(autoLearnPolicy.getKey(), "Match")); + final AxState autoLearnMatchState = new AxState(new AxReferenceKey(autoLearnPolicy.getKey(), MATCH)); autoLearnMatchState.setTrigger(autoLearnTriggerEvent.getKey()); final AxStateOutput alMat2Est = new AxStateOutput(autoLearnMatchState.getKey(), - autoLearnEstablishState.getKey(), autoLearnMatchEvent.getKey()); + autoLearnEstablishState.getKey(), autoLearnMatchEvent.getKey()); autoLearnMatchState.getStateOutputs().put(alMat2Est.getKey().getLocalName(), alMat2Est); - autoLearnMatchState.setTaskSelectionLogic( - new AxTaskSelectionLogic(autoLearnMatchState.getKey(), "TaskSelectionLogic", "MVEL", logicReader)); + autoLearnMatchState.setTaskSelectionLogic(new AxTaskSelectionLogic(autoLearnMatchState.getKey(), + TASK_SELECTION_LOGIC, "MVEL", logicReader)); autoLearnMatchState.setDefaultTask(autoLearnMatchTask.getKey()); autoLearnMatchState.getTaskReferences().put(autoLearnMatchTask.getKey(), - new AxStateTaskReference(autoLearnMatchState.getKey(), autoLearnMatchTask.getKey(), - AxStateTaskOutputType.DIRECT, alMat2Est.getKey())); + new AxStateTaskReference(autoLearnMatchState.getKey(), autoLearnMatchTask.getKey(), + AxStateTaskOutputType.DIRECT, alMat2Est.getKey())); autoLearnPolicy.setFirstState(autoLearnMatchState.getKey().getLocalName()); autoLearnPolicy.getStateMap().put(autoLearnMatchState.getKey().getLocalName(), autoLearnMatchState); @@ -533,13 +573,13 @@ public class AdaptiveDomainModelFactory { autoLearnPolicy.getStateMap().put(autoLearnDecideState.getKey().getLocalName(), autoLearnDecideState); autoLearnPolicy.getStateMap().put(autoLearnActState.getKey().getLocalName(), autoLearnActState); - final AxPolicies autoLearnPolicies = new AxPolicies(new AxArtifactKey("AutoLearnPolicies", "0.0.1")); + final AxPolicies autoLearnPolicies = new AxPolicies(new AxArtifactKey("AutoLearnPolicies", DEFAULT_VERSION)); autoLearnPolicies.getPolicyMap().put(autoLearnPolicy.getKey(), autoLearnPolicy); - final AxKeyInformation keyInformation = - new AxKeyInformation(new AxArtifactKey("AutoLearnKeyInformation", "0.0.1")); - final AxPolicyModel autoLearnPolicyModel = - new AxPolicyModel(new AxArtifactKey("AutoLearnPolicyModel", "0.0.1")); + final AxKeyInformation keyInformation = new AxKeyInformation( + new AxArtifactKey("AutoLearnKeyInformation", DEFAULT_VERSION)); + final AxPolicyModel autoLearnPolicyModel = new AxPolicyModel( + new AxArtifactKey("AutoLearnPolicyModel", DEFAULT_VERSION)); autoLearnPolicyModel.setPolicies(autoLearnPolicies); autoLearnPolicyModel.setEvents(autoLearnEvents); autoLearnPolicyModel.setTasks(autoLearnTasks); |