diff options
3 files changed, 185 insertions, 187 deletions
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 09fd9a105..65dbc688a 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 @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. + * Modifications Copyright (C) 2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -87,60 +88,60 @@ public class AadmDomainModelFactory { public AxPolicyModel getAadmPolicyModel() { // CHECKSTYLE:ON: checkstyle // Data types for event parameters - final AxContextSchema imsi = new AxContextSchema(new AxArtifactKey("IMSI", DEFAULT_VERSION), "Java", + final var imsi = new AxContextSchema(new AxArtifactKey("IMSI", DEFAULT_VERSION), "Java", JAVA_LANG_LONG); - final AxContextSchema ueIpAddress = new AxContextSchema(new AxArtifactKey("UEIPAddress", DEFAULT_VERSION), + final var ueIpAddress = new AxContextSchema(new AxArtifactKey("UEIPAddress", DEFAULT_VERSION), "Java", JAVA_LANG_STRING); - final AxContextSchema nwIpAddress = new AxContextSchema(new AxArtifactKey("NWIPAddress", DEFAULT_VERSION), + final var nwIpAddress = new AxContextSchema(new AxArtifactKey("NWIPAddress", DEFAULT_VERSION), "Java", JAVA_LANG_STRING); - final AxContextSchema dosFlag = new AxContextSchema(new AxArtifactKey("DOSFlag", DEFAULT_VERSION), "Java", + final var dosFlag = new AxContextSchema(new AxArtifactKey("DOSFlag", DEFAULT_VERSION), "Java", JAVA_LANG_BOOLEAN); - final AxContextSchema roundTripTime = new AxContextSchema(new AxArtifactKey("RoundTripTime", DEFAULT_VERSION), + final var roundTripTime = new AxContextSchema(new AxArtifactKey("RoundTripTime", DEFAULT_VERSION), "Java", JAVA_LANG_LONG); - final AxContextSchema applicationName = new AxContextSchema( + final var applicationName = new AxContextSchema( new AxArtifactKey("ApplicationName", DEFAULT_VERSION), "Java", JAVA_LANG_STRING); - final AxContextSchema protocolGroup = new AxContextSchema(new AxArtifactKey("ProtocolGroup", DEFAULT_VERSION), + final var protocolGroup = new AxContextSchema(new AxArtifactKey("ProtocolGroup", DEFAULT_VERSION), "Java", JAVA_LANG_STRING); - final AxContextSchema eNodeBId = new AxContextSchema(new AxArtifactKey("ENodeBID", DEFAULT_VERSION), "Java", + final var eNodeBId = new AxContextSchema(new AxArtifactKey("ENodeBID", DEFAULT_VERSION), "Java", JAVA_LANG_LONG); - final AxContextSchema httpHostClass = new AxContextSchema(new AxArtifactKey("HttpHostClass", DEFAULT_VERSION), + final var httpHostClass = new AxContextSchema(new AxArtifactKey("HttpHostClass", DEFAULT_VERSION), "Java", JAVA_LANG_STRING); - final AxContextSchema tcpOnFlag = new AxContextSchema(new AxArtifactKey("TCPOnFlag", DEFAULT_VERSION), "Java", + final var tcpOnFlag = new AxContextSchema(new AxArtifactKey("TCPOnFlag", DEFAULT_VERSION), "Java", JAVA_LANG_BOOLEAN); - final AxContextSchema probeOnFlag = new AxContextSchema(new AxArtifactKey("ProbeOnFlag", DEFAULT_VERSION), + final var probeOnFlag = new AxContextSchema(new AxArtifactKey("ProbeOnFlag", DEFAULT_VERSION), "Java", JAVA_LANG_BOOLEAN); - final AxContextSchema blacklistOnFlag = new AxContextSchema( + final var blacklistOnFlag = new AxContextSchema( new AxArtifactKey("BlacklistOnFlag", DEFAULT_VERSION), "Java", JAVA_LANG_BOOLEAN); - final AxContextSchema averageThroughput = new AxContextSchema( + final var averageThroughput = new AxContextSchema( new AxArtifactKey("AverageThroughput", DEFAULT_VERSION), "Java", JAVA_LANG_DOUBLE); - final AxContextSchema serviceRequestCount = new AxContextSchema( + final var serviceRequestCount = new AxContextSchema( new AxArtifactKey("ServiceRequestCount", DEFAULT_VERSION), "Java", JAVA_LANG_INTEGER); - final AxContextSchema attchCount = new AxContextSchema(new AxArtifactKey("AttachCount", DEFAULT_VERSION), + final var attchCount = new AxContextSchema(new AxArtifactKey("AttachCount", DEFAULT_VERSION), "Java", JAVA_LANG_INTEGER); - final AxContextSchema subscriberCount = new AxContextSchema( + final var subscriberCount = new AxContextSchema( new AxArtifactKey("SubscriberCount", DEFAULT_VERSION), "Java", JAVA_LANG_INTEGER); - final AxContextSchema averageServiceRequest = new AxContextSchema( + final var averageServiceRequest = new AxContextSchema( new AxArtifactKey("AverageServiceRequest", DEFAULT_VERSION), "Java", JAVA_LANG_DOUBLE); - final AxContextSchema averageAttach = new AxContextSchema(new AxArtifactKey("AverageAttach", DEFAULT_VERSION), + final var averageAttach = new AxContextSchema(new AxArtifactKey("AverageAttach", DEFAULT_VERSION), "Java", JAVA_LANG_DOUBLE); - final AxContextSchema actionTask = new AxContextSchema(new AxArtifactKey("ActionTask", DEFAULT_VERSION), "Java", + final var actionTask = new AxContextSchema(new AxArtifactKey("ActionTask", DEFAULT_VERSION), "Java", JAVA_LANG_STRING); - final AxContextSchema version = new AxContextSchema(new AxArtifactKey("Version", DEFAULT_VERSION), "Java", + final var version = new AxContextSchema(new AxArtifactKey("Version", DEFAULT_VERSION), "Java", JAVA_LANG_STRING); - final AxContextSchema profile = new AxContextSchema(new AxArtifactKey("Profile", DEFAULT_VERSION), "Java", + final var profile = new AxContextSchema(new AxArtifactKey("Profile", DEFAULT_VERSION), "Java", JAVA_LANG_STRING); - final AxContextSchema threshold = new AxContextSchema(new AxArtifactKey("Threshold", DEFAULT_VERSION), "Java", + final var threshold = new AxContextSchema(new AxArtifactKey("Threshold", DEFAULT_VERSION), "Java", JAVA_LANG_LONG); - final AxContextSchema triggerSpec = new AxContextSchema(new AxArtifactKey("TriggerSpec", DEFAULT_VERSION), + final var triggerSpec = new AxContextSchema(new AxArtifactKey("TriggerSpec", DEFAULT_VERSION), "Java", JAVA_LANG_STRING); - final AxContextSchema periodicEventCount = new AxContextSchema( + final var periodicEventCount = new AxContextSchema( new AxArtifactKey("PeriodicEventCount", DEFAULT_VERSION), "Java", JAVA_LANG_LONG); - final AxContextSchema periodicDelay = new AxContextSchema(new AxArtifactKey("PeriodicDelay", DEFAULT_VERSION), + final var periodicDelay = new AxContextSchema(new AxArtifactKey("PeriodicDelay", DEFAULT_VERSION), "Java", JAVA_LANG_LONG); - final AxContextSchema periodicTime = new AxContextSchema(new AxArtifactKey("PeriodicTime", DEFAULT_VERSION), + final var periodicTime = new AxContextSchema(new AxArtifactKey("PeriodicTime", DEFAULT_VERSION), "Java", JAVA_LANG_LONG); - final AxContextSchemas aadmContextSchemas = new AxContextSchemas( + final var aadmContextSchemas = new AxContextSchemas( new AxArtifactKey("AADMDatatypes", DEFAULT_VERSION)); aadmContextSchemas.getSchemasMap().put(imsi.getKey(), imsi); aadmContextSchemas.getSchemasMap().put(ueIpAddress.getKey(), ueIpAddress); @@ -169,7 +170,7 @@ public class AadmDomainModelFactory { aadmContextSchemas.getSchemasMap().put(periodicDelay.getKey(), periodicDelay); aadmContextSchemas.getSchemasMap().put(periodicTime.getKey(), periodicTime); - final AxEvent aadmEvent = new AxEvent(new AxArtifactKey("AADMEvent", DEFAULT_VERSION), + final var aadmEvent = new AxEvent(new AxArtifactKey("AADMEvent", DEFAULT_VERSION), DEFAULT_NAMESPACE); aadmEvent.setSource(DEFAULT_SOURCE); aadmEvent.setTarget("Apex"); @@ -217,7 +218,7 @@ public class AadmDomainModelFactory { aadmEvent.getParameterMap().put(ACTTASK, new AxField(new AxReferenceKey(aadmEvent.getKey(), ACTTASK), actionTask.getKey())); - final AxEvent aadmXStreamActEvent = new AxEvent(new AxArtifactKey("XSTREAM_AADM_ACT_EVENT", DEFAULT_VERSION), + final var aadmXStreamActEvent = new AxEvent(new AxArtifactKey("XSTREAM_AADM_ACT_EVENT", DEFAULT_VERSION), DEFAULT_NAMESPACE); aadmXStreamActEvent.setSource("Apex"); aadmXStreamActEvent.setTarget(DEFAULT_SOURCE); @@ -248,7 +249,7 @@ public class AadmDomainModelFactory { aadmXStreamActEvent.getParameterMap().put(THRESHOLD, new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), THRESHOLD), threshold.getKey())); - final AxEvent vMmeEvent = new AxEvent(new AxArtifactKey("VMMEEvent", DEFAULT_VERSION), + final var vMmeEvent = new AxEvent(new AxArtifactKey("VMMEEvent", DEFAULT_VERSION), DEFAULT_NAMESPACE); vMmeEvent.setSource(DEFAULT_SOURCE); vMmeEvent.setTarget("Apex"); @@ -265,7 +266,7 @@ public class AadmDomainModelFactory { vMmeEvent.getParameterMap().put(THRESHOLD, new AxField(new AxReferenceKey(vMmeEvent.getKey(), THRESHOLD), threshold.getKey())); - final AxEvent sapcEvent = new AxEvent(new AxArtifactKey("SAPCEvent", DEFAULT_VERSION), + final var sapcEvent = new AxEvent(new AxArtifactKey("SAPCEvent", DEFAULT_VERSION), DEFAULT_NAMESPACE); sapcEvent.setSource(DEFAULT_SOURCE); sapcEvent.setTarget("Apex"); @@ -290,7 +291,7 @@ public class AadmDomainModelFactory { sapcEvent.getParameterMap().put(BLACKLIST_ON, new AxField(new AxReferenceKey(sapcEvent.getKey(), BLACKLIST_ON), blacklistOnFlag.getKey())); - final AxEvent sapcBlacklistSubscriberEvent = new AxEvent( + final var sapcBlacklistSubscriberEvent = new AxEvent( new AxArtifactKey("SAPCBlacklistSubscriberEvent", DEFAULT_VERSION), DEFAULT_NAMESPACE); sapcBlacklistSubscriberEvent.setSource("Apex"); @@ -311,7 +312,7 @@ public class AadmDomainModelFactory { sapcBlacklistSubscriberEvent.getParameterMap().put(TCP_ON, new AxField( new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), TCP_ON), tcpOnFlag.getKey())); - final AxEvent periodicEvent = new AxEvent(new AxArtifactKey("PeriodicEvent", DEFAULT_VERSION), + final var periodicEvent = new AxEvent(new AxArtifactKey("PeriodicEvent", DEFAULT_VERSION), DEFAULT_NAMESPACE); periodicEvent.setSource("System"); periodicEvent.setTarget("Apex"); @@ -327,7 +328,7 @@ public class AadmDomainModelFactory { periodicEvent.getParameterMap().put("PERIODIC_LAST_TIME", new AxField( new AxReferenceKey(periodicEvent.getKey(), "PERIODIC_LAST_TIME"), periodicTime.getKey())); - final AxEvents aadmEvents = new AxEvents(new AxArtifactKey("AADMEvents", DEFAULT_VERSION)); + final var aadmEvents = new AxEvents(new AxArtifactKey("AADMEvents", DEFAULT_VERSION)); aadmEvents.getEventMap().put(aadmEvent.getKey(), aadmEvent); aadmEvents.getEventMap().put(aadmXStreamActEvent.getKey(), aadmXStreamActEvent); aadmEvents.getEventMap().put(vMmeEvent.getKey(), vMmeEvent); @@ -336,11 +337,11 @@ public class AadmDomainModelFactory { aadmEvents.getEventMap().put(periodicEvent.getKey(), periodicEvent); // Data types for context - final AxContextSchema eNodeBStatus = new AxContextSchema(new AxArtifactKey("ENodeBStatus", DEFAULT_VERSION), + final var eNodeBStatus = new AxContextSchema(new AxArtifactKey("ENodeBStatus", DEFAULT_VERSION), "Java", "org.onap.policy.apex.examples.aadm.concepts.ENodeBStatus"); - final AxContextSchema imsiStatus = new AxContextSchema(new AxArtifactKey("IMSIStatus", DEFAULT_VERSION), "Java", + final var imsiStatus = new AxContextSchema(new AxArtifactKey("IMSIStatus", DEFAULT_VERSION), "Java", "org.onap.policy.apex.examples.aadm.concepts.ImsiStatus"); - final AxContextSchema ipAddressStatus = new AxContextSchema( + final var ipAddressStatus = new AxContextSchema( new AxArtifactKey("IPAddressStatus", DEFAULT_VERSION), "Java", "org.onap.policy.apex.examples.aadm.concepts.IpAddressStatus"); aadmContextSchemas.getSchemasMap().put(eNodeBStatus.getKey(), eNodeBStatus); @@ -348,16 +349,16 @@ public class AadmDomainModelFactory { aadmContextSchemas.getSchemasMap().put(ipAddressStatus.getKey(), ipAddressStatus); // Three context albums for AADM - final AxContextAlbum eNodeBStatusAlbum = new AxContextAlbum( + final var eNodeBStatusAlbum = new AxContextAlbum( new AxArtifactKey("ENodeBStatusAlbum", DEFAULT_VERSION), APPLICATION, true, eNodeBStatus.getKey()); - final AxContextAlbum imsiStatusAlbum = new AxContextAlbum(new AxArtifactKey("IMSIStatusAlbum", DEFAULT_VERSION), + final var imsiStatusAlbum = new AxContextAlbum(new AxArtifactKey("IMSIStatusAlbum", DEFAULT_VERSION), APPLICATION, true, imsiStatus.getKey()); - final AxContextAlbum ipAddressStatusAlbum = new AxContextAlbum( + final var ipAddressStatusAlbum = new AxContextAlbum( new AxArtifactKey("IPAddressStatusAlbum", DEFAULT_VERSION), APPLICATION, true, ipAddressStatus.getKey()); - final AxContextAlbums aadmAlbums = new AxContextAlbums(new AxArtifactKey("AADMContext", DEFAULT_VERSION)); + final var aadmAlbums = new AxContextAlbums(new AxArtifactKey("AADMContext", DEFAULT_VERSION)); aadmAlbums.getAlbumsMap().put(eNodeBStatusAlbum.getKey(), eNodeBStatusAlbum); aadmAlbums.getAlbumsMap().put(imsiStatusAlbum.getKey(), imsiStatusAlbum); aadmAlbums.getAlbumsMap().put(ipAddressStatusAlbum.getKey(), ipAddressStatusAlbum); @@ -366,87 +367,88 @@ public class AadmDomainModelFactory { final AxLogicReader logicReader = new PolicyLogicReader() .setLogicPackage(this.getClass().getPackage().getName()).setDefaultLogic(null); - final AxTask aadmMatchTask = new AxTask(new AxArtifactKey("AADMMatchTask", DEFAULT_VERSION)); + + final var aadmMatchTask = new AxTask(new AxArtifactKey("AADMMatchTask", DEFAULT_VERSION)); 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)); + final var aadmEstablishTask = new AxTask(new AxArtifactKey("AADMEstablishTask", DEFAULT_VERSION)); 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)); + final var aadmDecideTask = new AxTask(new AxArtifactKey("AADMDecideTask", DEFAULT_VERSION)); aadmDecideTask.setTaskLogic(new AxTaskLogic(aadmDecideTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); logicReader.setDefaultLogic(null); - final AxTask aadmDoSSuggestionActTask = new AxTask( + final var aadmDoSSuggestionActTask = new AxTask( new AxArtifactKey("AADMDoSSuggestionActTask", DEFAULT_VERSION)); 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)); + final var aadmNoActTask = new AxTask(new AxArtifactKey("AADMNoActTask", DEFAULT_VERSION)); aadmNoActTask.setTaskLogic(new AxTaskLogic(aadmNoActTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask aadmDoSProvenActTask = new AxTask(new AxArtifactKey("AADMDoSProvenActTask", DEFAULT_VERSION)); + final var aadmDoSProvenActTask = new AxTask(new AxArtifactKey("AADMDoSProvenActTask", DEFAULT_VERSION)); 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)); + final var vMmeMatchTask = new AxTask(new AxArtifactKey("VMMEMatchTask", DEFAULT_VERSION)); vMmeMatchTask.setTaskLogic(new AxTaskLogic(vMmeMatchTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask vMmeEstablishTask = new AxTask(new AxArtifactKey("VMMEEstablishTask", DEFAULT_VERSION)); + final var vMmeEstablishTask = new AxTask(new AxArtifactKey("VMMEEstablishTask", DEFAULT_VERSION)); 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)); + final var vMmeDecideTask = new AxTask(new AxArtifactKey("VMMEDecideTask", DEFAULT_VERSION)); vMmeDecideTask.setTaskLogic(new AxTaskLogic(vMmeDecideTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask vMmeNoActTask = new AxTask(new AxArtifactKey("VMMENoActTask", DEFAULT_VERSION)); + final var vMmeNoActTask = new AxTask(new AxArtifactKey("VMMENoActTask", DEFAULT_VERSION)); vMmeNoActTask.setTaskLogic(new AxTaskLogic(vMmeNoActTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask vMmeActTask = new AxTask(new AxArtifactKey("VMMEActTask", DEFAULT_VERSION)); + final var vMmeActTask = new AxTask(new AxArtifactKey("VMMEActTask", DEFAULT_VERSION)); logicReader.setDefaultLogic(null); vMmeActTask.setTaskLogic(new AxTaskLogic(vMmeActTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask sapcMatchTask = new AxTask(new AxArtifactKey("SAPCMatchTask", DEFAULT_VERSION)); + final var sapcMatchTask = new AxTask(new AxArtifactKey("SAPCMatchTask", DEFAULT_VERSION)); sapcMatchTask.setTaskLogic(new AxTaskLogic(sapcMatchTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask sapcEstablishTask = new AxTask(new AxArtifactKey("SAPCEstablishTask", DEFAULT_VERSION)); + final var sapcEstablishTask = new AxTask(new AxArtifactKey("SAPCEstablishTask", DEFAULT_VERSION)); 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)); + final var sapcDecideTask = new AxTask(new AxArtifactKey("SAPCDecideTask", DEFAULT_VERSION)); sapcDecideTask.setTaskLogic(new AxTaskLogic(sapcDecideTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask sapcActTask = new AxTask(new AxArtifactKey("SAPCActTask", DEFAULT_VERSION)); + final var sapcActTask = new AxTask(new AxArtifactKey("SAPCActTask", DEFAULT_VERSION)); sapcActTask.getContextAlbumReferences().add(imsiStatusAlbum.getKey()); logicReader.setDefaultLogic(null); sapcActTask.setTaskLogic(new AxTaskLogic(sapcActTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); logicReader.setDefaultLogic(DEFAULT_TASK_LOGIC); - final AxTask periodicMatchTask = new AxTask(new AxArtifactKey("PeriodicMatchTask", DEFAULT_VERSION)); + final var periodicMatchTask = new AxTask(new AxArtifactKey("PeriodicMatchTask", DEFAULT_VERSION)); periodicMatchTask.setTaskLogic(new AxTaskLogic(periodicMatchTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask periodicEstablishTask = new AxTask(new AxArtifactKey("PeriodicEstablishTask", DEFAULT_VERSION)); + final var periodicEstablishTask = new AxTask(new AxArtifactKey("PeriodicEstablishTask", DEFAULT_VERSION)); periodicEstablishTask.setTaskLogic( new AxTaskLogic(periodicEstablishTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask periodicDecideTask = new AxTask(new AxArtifactKey("PeriodicDecideTask", DEFAULT_VERSION)); + final var periodicDecideTask = new AxTask(new AxArtifactKey("PeriodicDecideTask", DEFAULT_VERSION)); periodicDecideTask.setTaskLogic(new AxTaskLogic(periodicDecideTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask periodicActTask = new AxTask(new AxArtifactKey("PeriodicActTask", DEFAULT_VERSION)); + final var periodicActTask = new AxTask(new AxArtifactKey("PeriodicActTask", DEFAULT_VERSION)); periodicActTask.getContextAlbumReferences().add(imsiStatusAlbum.getKey()); logicReader.setDefaultLogic(null); periodicActTask.setTaskLogic(new AxTaskLogic(periodicActTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTasks aadmTasks = new AxTasks(new AxArtifactKey("AADMTasks", DEFAULT_VERSION)); + final var aadmTasks = new AxTasks(new AxArtifactKey("AADMTasks", DEFAULT_VERSION)); aadmTasks.getTaskMap().put(aadmMatchTask.getKey(), aadmMatchTask); aadmTasks.getTaskMap().put(aadmEstablishTask.getKey(), aadmEstablishTask); aadmTasks.getTaskMap().put(aadmDecideTask.getKey(), aadmDecideTask); @@ -470,12 +472,12 @@ public class AadmDomainModelFactory { // Policies logicReader.setDefaultLogic(null); - final AxPolicy aadmPolicy = new AxPolicy(new AxArtifactKey("AADMPolicy", DEFAULT_VERSION)); + final var aadmPolicy = new AxPolicy(new AxArtifactKey("AADMPolicy", DEFAULT_VERSION)); aadmPolicy.setTemplate("MEDA"); - final AxState aadmActState = new AxState(new AxReferenceKey(aadmPolicy.getKey(), "Act")); + final var aadmActState = new AxState(new AxReferenceKey(aadmPolicy.getKey(), "Act")); aadmActState.setTrigger(aadmEvent.getKey()); - final AxStateOutput aadmAct2Out = new AxStateOutput(aadmActState.getKey(), AxReferenceKey.getNullKey(), + final var aadmAct2Out = new AxStateOutput(aadmActState.getKey(), AxReferenceKey.getNullKey(), aadmXStreamActEvent.getKey()); aadmActState.getStateOutputs().put(aadmAct2Out.getKey().getLocalName(), aadmAct2Out); aadmActState.getContextAlbumReferences().add(ipAddressStatusAlbum.getKey()); @@ -495,9 +497,9 @@ public class AadmDomainModelFactory { logicReader.setDefaultLogic("DefaultTaskSelectionLogic"); - final AxState aadmDecideState = new AxState(new AxReferenceKey(aadmPolicy.getKey(), DECIDE)); + final var aadmDecideState = new AxState(new AxReferenceKey(aadmPolicy.getKey(), DECIDE)); aadmDecideState.setTrigger(aadmEvent.getKey()); - final AxStateOutput aadmDec2Act = new AxStateOutput(aadmDecideState.getKey(), aadmActState.getKey(), + final var aadmDec2Act = new AxStateOutput(aadmDecideState.getKey(), aadmActState.getKey(), aadmEvent.getKey()); aadmDecideState.getStateOutputs().put(aadmDec2Act.getKey().getLocalName(), aadmDec2Act); aadmDecideState.setTaskSelectionLogic( @@ -507,9 +509,9 @@ public class AadmDomainModelFactory { new AxStateTaskReference(aadmDecideState.getKey(), aadmDecideTask.getKey(), AxStateTaskOutputType.DIRECT, aadmDec2Act.getKey())); - final AxState aadmEstablishState = new AxState(new AxReferenceKey(aadmPolicy.getKey(), ESTABLISH)); + final var aadmEstablishState = new AxState(new AxReferenceKey(aadmPolicy.getKey(), ESTABLISH)); aadmEstablishState.setTrigger(aadmEvent.getKey()); - final AxStateOutput aadmEst2Dec = new AxStateOutput(aadmEstablishState.getKey(), aadmDecideState.getKey(), + final var aadmEst2Dec = new AxStateOutput(aadmEstablishState.getKey(), aadmDecideState.getKey(), aadmEvent.getKey()); aadmEstablishState.getStateOutputs().put(aadmEst2Dec.getKey().getLocalName(), aadmEst2Dec); aadmEstablishState.setTaskSelectionLogic(new AxTaskSelectionLogic(aadmEstablishState.getKey(), @@ -519,9 +521,9 @@ public class AadmDomainModelFactory { new AxStateTaskReference(aadmEstablishState.getKey(), aadmEstablishTask.getKey(), AxStateTaskOutputType.DIRECT, aadmEst2Dec.getKey())); - final AxState aadmMatchState = new AxState(new AxReferenceKey(aadmPolicy.getKey(), MATCH)); + final var aadmMatchState = new AxState(new AxReferenceKey(aadmPolicy.getKey(), MATCH)); aadmMatchState.setTrigger(aadmEvent.getKey()); - final AxStateOutput aadmMat2Est = new AxStateOutput(aadmMatchState.getKey(), aadmEstablishState.getKey(), + final var aadmMat2Est = new AxStateOutput(aadmMatchState.getKey(), aadmEstablishState.getKey(), aadmEvent.getKey()); aadmMatchState.getStateOutputs().put(aadmMat2Est.getKey().getLocalName(), aadmMat2Est); aadmMatchState.setTaskSelectionLogic( @@ -536,12 +538,12 @@ public class AadmDomainModelFactory { aadmPolicy.getStateMap().put(aadmDecideState.getKey().getLocalName(), aadmDecideState); aadmPolicy.getStateMap().put(aadmActState.getKey().getLocalName(), aadmActState); - final AxPolicy vMmePolicy = new AxPolicy(new AxArtifactKey("VMMEPolicy", DEFAULT_VERSION)); + final var vMmePolicy = new AxPolicy(new AxArtifactKey("VMMEPolicy", DEFAULT_VERSION)); vMmePolicy.setTemplate("MEDA"); - final AxState vMmeActState = new AxState(new AxReferenceKey(vMmePolicy.getKey(), "Act")); + final var vMmeActState = new AxState(new AxReferenceKey(vMmePolicy.getKey(), "Act")); vMmeActState.setTrigger(vMmeEvent.getKey()); - final AxStateOutput vMmeAct2Out = new AxStateOutput(vMmeActState.getKey(), AxReferenceKey.getNullKey(), + final var vMmeAct2Out = new AxStateOutput(vMmeActState.getKey(), AxReferenceKey.getNullKey(), vMmeEvent.getKey()); vMmeActState.getStateOutputs().put(vMmeAct2Out.getKey().getLocalName(), vMmeAct2Out); vMmeActState.setDefaultTask(vMmeActTask.getKey()); @@ -550,9 +552,9 @@ public class AadmDomainModelFactory { vMmeActState.getTaskReferences().put(vMmeNoActTask.getKey(), new AxStateTaskReference(vMmeActState.getKey(), vMmeNoActTask.getKey(), AxStateTaskOutputType.DIRECT, vMmeAct2Out.getKey())); - final AxState vMmeDecideState = new AxState(new AxReferenceKey(vMmePolicy.getKey(), DECIDE)); + final var vMmeDecideState = new AxState(new AxReferenceKey(vMmePolicy.getKey(), DECIDE)); vMmeDecideState.setTrigger(vMmeEvent.getKey()); - final AxStateOutput vMmeDec2Act = new AxStateOutput(vMmeDecideState.getKey(), vMmeActState.getKey(), + final var vMmeDec2Act = new AxStateOutput(vMmeDecideState.getKey(), vMmeActState.getKey(), vMmeEvent.getKey()); vMmeDecideState.getStateOutputs().put(vMmeDec2Act.getKey().getLocalName(), vMmeDec2Act); vMmeDecideState.setDefaultTask(vMmeDecideTask.getKey()); @@ -560,9 +562,9 @@ public class AadmDomainModelFactory { new AxStateTaskReference(vMmeDecideState.getKey(), vMmeDecideTask.getKey(), AxStateTaskOutputType.DIRECT, vMmeDec2Act.getKey())); - final AxState vMmeEstablishState = new AxState(new AxReferenceKey(vMmePolicy.getKey(), ESTABLISH)); + final var vMmeEstablishState = new AxState(new AxReferenceKey(vMmePolicy.getKey(), ESTABLISH)); vMmeEstablishState.setTrigger(vMmeEvent.getKey()); - final AxStateOutput vMmeEst2Dec = new AxStateOutput(vMmeEstablishState.getKey(), vMmeDecideState.getKey(), + final var vMmeEst2Dec = new AxStateOutput(vMmeEstablishState.getKey(), vMmeDecideState.getKey(), vMmeEvent.getKey()); vMmeEstablishState.getStateOutputs().put(vMmeEst2Dec.getKey().getLocalName(), vMmeEst2Dec); vMmeEstablishState.setDefaultTask(vMmeEstablishTask.getKey()); @@ -570,9 +572,9 @@ public class AadmDomainModelFactory { new AxStateTaskReference(vMmeEstablishState.getKey(), vMmeEstablishTask.getKey(), AxStateTaskOutputType.DIRECT, vMmeEst2Dec.getKey())); - final AxState vMmeMatchState = new AxState(new AxReferenceKey(vMmePolicy.getKey(), MATCH)); + final var vMmeMatchState = new AxState(new AxReferenceKey(vMmePolicy.getKey(), MATCH)); vMmeMatchState.setTrigger(vMmeEvent.getKey()); - final AxStateOutput vMmeMat2Est = new AxStateOutput(vMmeMatchState.getKey(), vMmeEstablishState.getKey(), + final var vMmeMat2Est = new AxStateOutput(vMmeMatchState.getKey(), vMmeEstablishState.getKey(), vMmeEvent.getKey()); vMmeMatchState.getStateOutputs().put(vMmeMat2Est.getKey().getLocalName(), vMmeMat2Est); vMmeMatchState.setDefaultTask(vMmeMatchTask.getKey()); @@ -585,21 +587,21 @@ public class AadmDomainModelFactory { vMmePolicy.getStateMap().put(vMmeDecideState.getKey().getLocalName(), vMmeDecideState); vMmePolicy.getStateMap().put(vMmeActState.getKey().getLocalName(), vMmeActState); - final AxPolicy sapcPolicy = new AxPolicy(new AxArtifactKey("SAPCPolicy", DEFAULT_VERSION)); + final var sapcPolicy = new AxPolicy(new AxArtifactKey("SAPCPolicy", DEFAULT_VERSION)); sapcPolicy.setTemplate("MEDA"); - final AxState sapcActState = new AxState(new AxReferenceKey(sapcPolicy.getKey(), "Act")); + final var sapcActState = new AxState(new AxReferenceKey(sapcPolicy.getKey(), "Act")); sapcActState.setTrigger(sapcEvent.getKey()); - final AxStateOutput sapcAct2Out = new AxStateOutput(sapcActState.getKey(), AxReferenceKey.getNullKey(), + final var sapcAct2Out = new AxStateOutput(sapcActState.getKey(), AxReferenceKey.getNullKey(), sapcBlacklistSubscriberEvent.getKey()); sapcActState.getStateOutputs().put(sapcAct2Out.getKey().getLocalName(), sapcAct2Out); sapcActState.setDefaultTask(sapcActTask.getKey()); sapcActState.getTaskReferences().put(sapcActTask.getKey(), new AxStateTaskReference(sapcActState.getKey(), sapcActTask.getKey(), AxStateTaskOutputType.DIRECT, sapcAct2Out.getKey())); - final AxState sapcDecideState = new AxState(new AxReferenceKey(sapcPolicy.getKey(), DECIDE)); + final var sapcDecideState = new AxState(new AxReferenceKey(sapcPolicy.getKey(), DECIDE)); sapcDecideState.setTrigger(sapcEvent.getKey()); - final AxStateOutput sapcDec2Act = new AxStateOutput(sapcDecideState.getKey(), sapcActState.getKey(), + final var sapcDec2Act = new AxStateOutput(sapcDecideState.getKey(), sapcActState.getKey(), sapcEvent.getKey()); sapcDecideState.getStateOutputs().put(sapcDec2Act.getKey().getLocalName(), sapcDec2Act); sapcDecideState.setDefaultTask(sapcDecideTask.getKey()); @@ -607,9 +609,9 @@ public class AadmDomainModelFactory { new AxStateTaskReference(sapcDecideState.getKey(), sapcDecideTask.getKey(), AxStateTaskOutputType.DIRECT, sapcDec2Act.getKey())); - final AxState sapcEstablishState = new AxState(new AxReferenceKey(sapcPolicy.getKey(), ESTABLISH)); + final var sapcEstablishState = new AxState(new AxReferenceKey(sapcPolicy.getKey(), ESTABLISH)); sapcEstablishState.setTrigger(sapcEvent.getKey()); - final AxStateOutput sapcEst2Dec = new AxStateOutput(sapcEstablishState.getKey(), sapcDecideState.getKey(), + final var sapcEst2Dec = new AxStateOutput(sapcEstablishState.getKey(), sapcDecideState.getKey(), sapcEvent.getKey()); sapcEstablishState.getStateOutputs().put(sapcEst2Dec.getKey().getLocalName(), sapcEst2Dec); sapcEstablishState.setDefaultTask(sapcEstablishTask.getKey()); @@ -617,9 +619,9 @@ public class AadmDomainModelFactory { new AxStateTaskReference(sapcEstablishState.getKey(), sapcEstablishTask.getKey(), AxStateTaskOutputType.DIRECT, sapcEst2Dec.getKey())); - final AxState sapcMatchState = new AxState(new AxReferenceKey(sapcPolicy.getKey(), MATCH)); + final var sapcMatchState = new AxState(new AxReferenceKey(sapcPolicy.getKey(), MATCH)); sapcMatchState.setTrigger(aadmXStreamActEvent.getKey()); - final AxStateOutput sapcMat2Est = new AxStateOutput(sapcMatchState.getKey(), sapcEstablishState.getKey(), + final var sapcMat2Est = new AxStateOutput(sapcMatchState.getKey(), sapcEstablishState.getKey(), sapcEvent.getKey()); sapcMatchState.getStateOutputs().put(sapcMat2Est.getKey().getLocalName(), sapcMat2Est); sapcMatchState.setDefaultTask(sapcMatchTask.getKey()); @@ -632,12 +634,12 @@ public class AadmDomainModelFactory { sapcPolicy.getStateMap().put(sapcDecideState.getKey().getLocalName(), sapcDecideState); sapcPolicy.getStateMap().put(sapcActState.getKey().getLocalName(), sapcActState); - final AxPolicy periodicPolicy = new AxPolicy(new AxArtifactKey("PeriodicPolicy", DEFAULT_VERSION)); + final var periodicPolicy = new AxPolicy(new AxArtifactKey("PeriodicPolicy", DEFAULT_VERSION)); periodicPolicy.setTemplate("MEDA"); - final AxState periodicActState = new AxState(new AxReferenceKey(periodicPolicy.getKey(), "Act")); + final var periodicActState = new AxState(new AxReferenceKey(periodicPolicy.getKey(), "Act")); periodicActState.setTrigger(periodicEvent.getKey()); - final AxStateOutput perAct2Out = new AxStateOutput(periodicActState.getKey(), AxReferenceKey.getNullKey(), + final var perAct2Out = new AxStateOutput(periodicActState.getKey(), AxReferenceKey.getNullKey(), sapcBlacklistSubscriberEvent.getKey()); periodicActState.getStateOutputs().put(perAct2Out.getKey().getLocalName(), perAct2Out); periodicActState.setDefaultTask(periodicActTask.getKey()); @@ -645,9 +647,9 @@ public class AadmDomainModelFactory { new AxStateTaskReference(periodicActState.getKey(), periodicActTask.getKey(), AxStateTaskOutputType.DIRECT, perAct2Out.getKey())); - final AxState periodicDecideState = new AxState(new AxReferenceKey(periodicPolicy.getKey(), DECIDE)); + final var periodicDecideState = new AxState(new AxReferenceKey(periodicPolicy.getKey(), DECIDE)); periodicDecideState.setTrigger(periodicEvent.getKey()); - final AxStateOutput perDec2Act = new AxStateOutput(periodicDecideState.getKey(), periodicActState.getKey(), + final var perDec2Act = new AxStateOutput(periodicDecideState.getKey(), periodicActState.getKey(), periodicEvent.getKey()); periodicDecideState.getStateOutputs().put(perDec2Act.getKey().getLocalName(), perDec2Act); periodicDecideState.setDefaultTask(periodicDecideTask.getKey()); @@ -655,9 +657,9 @@ public class AadmDomainModelFactory { new AxStateTaskReference(periodicDecideState.getKey(), periodicDecideTask.getKey(), AxStateTaskOutputType.DIRECT, perDec2Act.getKey())); - final AxState periodicEstablishState = new AxState(new AxReferenceKey(periodicPolicy.getKey(), ESTABLISH)); + final var periodicEstablishState = new AxState(new AxReferenceKey(periodicPolicy.getKey(), ESTABLISH)); periodicEstablishState.setTrigger(periodicEvent.getKey()); - final AxStateOutput perEst2Dec = new AxStateOutput(periodicEstablishState.getKey(), + final var perEst2Dec = new AxStateOutput(periodicEstablishState.getKey(), periodicDecideState.getKey(), periodicEvent.getKey()); periodicEstablishState.getStateOutputs().put(perEst2Dec.getKey().getLocalName(), perEst2Dec); periodicEstablishState.setDefaultTask(periodicEstablishTask.getKey()); @@ -665,9 +667,9 @@ public class AadmDomainModelFactory { new AxStateTaskReference(periodicEstablishState.getKey(), periodicEstablishTask.getKey(), AxStateTaskOutputType.DIRECT, perEst2Dec.getKey())); - final AxState periodicMatchState = new AxState(new AxReferenceKey(periodicPolicy.getKey(), MATCH)); + final var periodicMatchState = new AxState(new AxReferenceKey(periodicPolicy.getKey(), MATCH)); periodicMatchState.setTrigger(periodicEvent.getKey()); - final AxStateOutput perMat2Est = new AxStateOutput(periodicMatchState.getKey(), periodicEstablishState.getKey(), + final var perMat2Est = new AxStateOutput(periodicMatchState.getKey(), periodicEstablishState.getKey(), periodicEvent.getKey()); periodicMatchState.getStateOutputs().put(perMat2Est.getKey().getLocalName(), perMat2Est); periodicMatchState.setDefaultTask(periodicMatchTask.getKey()); @@ -681,15 +683,15 @@ public class AadmDomainModelFactory { periodicPolicy.getStateMap().put(periodicDecideState.getKey().getLocalName(), periodicDecideState); periodicPolicy.getStateMap().put(periodicActState.getKey().getLocalName(), periodicActState); - final AxPolicies aadmPolicies = new AxPolicies(new AxArtifactKey("AADMPolicies", DEFAULT_VERSION)); + final var aadmPolicies = new AxPolicies(new AxArtifactKey("AADMPolicies", DEFAULT_VERSION)); aadmPolicies.getPolicyMap().put(aadmPolicy.getKey(), aadmPolicy); aadmPolicies.getPolicyMap().put(vMmePolicy.getKey(), vMmePolicy); aadmPolicies.getPolicyMap().put(sapcPolicy.getKey(), sapcPolicy); aadmPolicies.getPolicyMap().put(periodicPolicy.getKey(), periodicPolicy); - final AxKeyInformation keyInformation = new AxKeyInformation( + final var keyInformation = new AxKeyInformation( new AxArtifactKey("AADMKeyInformation", DEFAULT_VERSION)); - final AxPolicyModel aadmPolicyModel = new AxPolicyModel(new AxArtifactKey("AADMPolicyModel", DEFAULT_VERSION)); + final var aadmPolicyModel = new AxPolicyModel(new AxArtifactKey("AADMPolicyModel", DEFAULT_VERSION)); aadmPolicyModel.setPolicies(aadmPolicies); aadmPolicyModel.setEvents(aadmEvents); aadmPolicyModel.setTasks(aadmTasks); 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 7dbb4ad23..dda3c2a38 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 @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. + * Modifications Copyright (C) 2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -74,17 +75,17 @@ public class AdaptiveDomainModelFactory { public AxPolicyModel getAnomalyDetectionPolicyModel() { // CHECKSTYLE:ON: checkstyle:maximumMethodLength // Data types for event parameters - final AxContextSchema monitoredValue = new AxContextSchema(new AxArtifactKey(MONITORED_VALUE, DEFAULT_VERSION), + final var monitoredValue = new AxContextSchema(new AxArtifactKey(MONITORED_VALUE, DEFAULT_VERSION), "Java", "java.lang.Double"); - final AxContextSchema iteration = new AxContextSchema(new AxArtifactKey(ITERATION2, DEFAULT_VERSION), "Java", + final var iteration = new AxContextSchema(new AxArtifactKey(ITERATION2, DEFAULT_VERSION), "Java", "java.lang.Integer"); - final AxContextSchemas adContextSchemas = new AxContextSchemas( + final var 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( + final var anomalyDetectionTriggerEvent = new AxEvent( new AxArtifactKey("AnomalyDetectionTriggerEvent", DEFAULT_VERSION), DEFAULT_NAMESPACE); anomalyDetectionTriggerEvent.setSource(EXTERNAL); @@ -95,7 +96,7 @@ public class AdaptiveDomainModelFactory { anomalyDetectionTriggerEvent.getParameterMap().put(ITERATION2, new AxField( new AxReferenceKey(anomalyDetectionTriggerEvent.getKey(), ITERATION2), iteration.getKey())); - final AxEvent anomalyDetectionMatchEvent = new AxEvent( + final var anomalyDetectionMatchEvent = new AxEvent( new AxArtifactKey("AnomalyDetectionMatchEvent", DEFAULT_VERSION), DEFAULT_NAMESPACE); anomalyDetectionMatchEvent.setSource(MATCH); @@ -106,7 +107,7 @@ public class AdaptiveDomainModelFactory { anomalyDetectionMatchEvent.getParameterMap().put(ITERATION2, new AxField( new AxReferenceKey(anomalyDetectionMatchEvent.getKey(), ITERATION2), iteration.getKey())); - final AxEvent anomalyDetectionEstablishEvent = new AxEvent( + final var anomalyDetectionEstablishEvent = new AxEvent( new AxArtifactKey("AnomalyDetectionEstablishEvent", DEFAULT_VERSION), DEFAULT_NAMESPACE); anomalyDetectionEstablishEvent.setSource(ESTABLISH); @@ -117,7 +118,7 @@ public class AdaptiveDomainModelFactory { anomalyDetectionEstablishEvent.getParameterMap().put(ITERATION2, new AxField( new AxReferenceKey(anomalyDetectionEstablishEvent.getKey(), ITERATION2), iteration.getKey())); - final AxEvent anomalyDetectionDecideEvent = new AxEvent( + final var anomalyDetectionDecideEvent = new AxEvent( new AxArtifactKey("AnomalyDetectionDecideEvent", DEFAULT_VERSION), DEFAULT_NAMESPACE); anomalyDetectionDecideEvent.setSource(DECIDE); @@ -128,7 +129,7 @@ public class AdaptiveDomainModelFactory { anomalyDetectionDecideEvent.getParameterMap().put(ITERATION2, new AxField( new AxReferenceKey(anomalyDetectionDecideEvent.getKey(), ITERATION2), iteration.getKey())); - final AxEvent anomalyDetectionActEvent = new AxEvent( + final var anomalyDetectionActEvent = new AxEvent( new AxArtifactKey("AnomalyDetectionActEvent", DEFAULT_VERSION), DEFAULT_NAMESPACE); anomalyDetectionActEvent.setSource("Act"); @@ -139,7 +140,7 @@ public class AdaptiveDomainModelFactory { anomalyDetectionActEvent.getParameterMap().put(ITERATION2, new AxField( new AxReferenceKey(anomalyDetectionActEvent.getKey(), ITERATION2), iteration.getKey())); - final AxEvents anomalyDetectionEvents = new AxEvents( + final var anomalyDetectionEvents = new AxEvents( new AxArtifactKey("AnomalyDetectionEvents", DEFAULT_VERSION)); anomalyDetectionEvents.getEventMap().put(anomalyDetectionTriggerEvent.getKey(), anomalyDetectionTriggerEvent); anomalyDetectionEvents.getEventMap().put(anomalyDetectionMatchEvent.getKey(), anomalyDetectionMatchEvent); @@ -149,16 +150,16 @@ public class AdaptiveDomainModelFactory { anomalyDetectionEvents.getEventMap().put(anomalyDetectionActEvent.getKey(), anomalyDetectionActEvent); // Data types for context - final AxContextSchema anomalyDetection = new AxContextSchema( + final var 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( + final var anomalyDetectionAlbum = new AxContextAlbum( new AxArtifactKey("AnomalyDetectionAlbum", DEFAULT_VERSION), "APPLICATION", true, anomalyDetection.getKey()); - final AxContextAlbums anomalyDetectionAlbums = new AxContextAlbums( + final var anomalyDetectionAlbums = new AxContextAlbums( new AxArtifactKey("AnomalyDetectionAlbums", DEFAULT_VERSION)); anomalyDetectionAlbums.getAlbumsMap().put(anomalyDetectionAlbum.getKey(), anomalyDetectionAlbum); @@ -167,37 +168,37 @@ public class AdaptiveDomainModelFactory { .setLogicPackage(this.getClass().getPackage().getName()) .setDefaultLogic("DefaultAnomalyDetectionTask_Logic"); - final AxTask anomalyDetectionMatchTask = new AxTask( + final var anomalyDetectionMatchTask = new AxTask( new AxArtifactKey("AnomalyDetectionMatchTask", DEFAULT_VERSION)); anomalyDetectionMatchTask.setTaskLogic( new AxTaskLogic(anomalyDetectionMatchTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask anomalyDetectionEstablishTask = new AxTask( + final var anomalyDetectionEstablishTask = new AxTask( new AxArtifactKey("AnomalyDetectionEstablishTask", DEFAULT_VERSION)); anomalyDetectionEstablishTask.setTaskLogic( new AxTaskLogic(anomalyDetectionEstablishTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask anomalyDetectionDecideTask0 = new AxTask( + final var anomalyDetectionDecideTask0 = new AxTask( new AxArtifactKey("AnomalyDetectionDecideTask0", DEFAULT_VERSION)); anomalyDetectionDecideTask0.setTaskLogic( new AxTaskLogic(anomalyDetectionDecideTask0.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask anomalyDetectionDecideTask1 = new AxTask( + final var anomalyDetectionDecideTask1 = new AxTask( new AxArtifactKey("AnomalyDetectionDecideTask1", DEFAULT_VERSION)); anomalyDetectionDecideTask1.setTaskLogic( new AxTaskLogic(anomalyDetectionDecideTask1.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask anomalyDetectionDecideTask2 = new AxTask( + final var anomalyDetectionDecideTask2 = new AxTask( new AxArtifactKey("AnomalyDetectionDecideTask2", DEFAULT_VERSION)); anomalyDetectionDecideTask2.setTaskLogic( new AxTaskLogic(anomalyDetectionDecideTask2.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask anomalyDetectionActTask = new AxTask( + final var anomalyDetectionActTask = new AxTask( new AxArtifactKey("AnomalyDetectionActTask", DEFAULT_VERSION)); anomalyDetectionActTask.setTaskLogic( new AxTaskLogic(anomalyDetectionActTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTasks anomalyDetectionTasks = new AxTasks(new AxArtifactKey("AnomalyDetectionTasks", DEFAULT_VERSION)); + final var 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); @@ -208,14 +209,14 @@ public class AdaptiveDomainModelFactory { // Policies logicReader.setDefaultLogic(DEFAULT_STATE_LOGIC); - final AxPolicy anomalyDetectionPolicy = new AxPolicy( + final var anomalyDetectionPolicy = new AxPolicy( new AxArtifactKey("AnomalyDetectionPolicy", DEFAULT_VERSION)); anomalyDetectionPolicy.setTemplate("MEDA"); - final AxState anomalyDetectionActState = new AxState( + final var anomalyDetectionActState = new AxState( new AxReferenceKey(anomalyDetectionPolicy.getKey(), "Act")); anomalyDetectionActState.setTrigger(anomalyDetectionDecideEvent.getKey()); - final AxStateOutput adAct2Out = new AxStateOutput(anomalyDetectionActState.getKey(), + final var adAct2Out = new AxStateOutput(anomalyDetectionActState.getKey(), AxReferenceKey.getNullKey(), anomalyDetectionActEvent.getKey()); anomalyDetectionActState.getStateOutputs().put(adAct2Out.getKey().getLocalName(), adAct2Out); anomalyDetectionActState.setTaskSelectionLogic(new AxTaskSelectionLogic(anomalyDetectionActState.getKey(), @@ -227,10 +228,10 @@ public class AdaptiveDomainModelFactory { logicReader.setDefaultLogic(null); - final AxState anomalyDetectionDecideState = new AxState( + final var anomalyDetectionDecideState = new AxState( new AxReferenceKey(anomalyDetectionPolicy.getKey(), DECIDE)); anomalyDetectionDecideState.setTrigger(anomalyDetectionEstablishEvent.getKey()); - final AxStateOutput adDec2Act = new AxStateOutput(anomalyDetectionDecideState.getKey(), + final var adDec2Act = new AxStateOutput(anomalyDetectionDecideState.getKey(), anomalyDetectionActState.getKey(), anomalyDetectionDecideEvent.getKey()); anomalyDetectionDecideState.getStateOutputs().put(adDec2Act.getKey().getLocalName(), adDec2Act); anomalyDetectionDecideState.setTaskSelectionLogic(new AxTaskSelectionLogic(anomalyDetectionDecideState.getKey(), @@ -252,10 +253,10 @@ public class AdaptiveDomainModelFactory { logicReader.setDefaultLogic(DEFAULT_STATE_LOGIC); - final AxState anomalyDetectionEstablishState = new AxState( + final var anomalyDetectionEstablishState = new AxState( new AxReferenceKey(anomalyDetectionPolicy.getKey(), ESTABLISH)); anomalyDetectionEstablishState.setTrigger(anomalyDetectionMatchEvent.getKey()); - final AxStateOutput adEst2Dec = new AxStateOutput(anomalyDetectionEstablishState.getKey(), + final var adEst2Dec = new AxStateOutput(anomalyDetectionEstablishState.getKey(), anomalyDetectionDecideState.getKey(), anomalyDetectionEstablishEvent.getKey()); anomalyDetectionEstablishState.getStateOutputs().put(adEst2Dec.getKey().getLocalName(), adEst2Dec); anomalyDetectionEstablishState.setTaskSelectionLogic(new AxTaskSelectionLogic( @@ -266,10 +267,10 @@ public class AdaptiveDomainModelFactory { anomalyDetectionEstablishTask.getKey(), AxStateTaskOutputType.DIRECT, adEst2Dec.getKey())); - final AxState anomalyDetectionMatchState = new AxState( + final var anomalyDetectionMatchState = new AxState( new AxReferenceKey(anomalyDetectionPolicy.getKey(), MATCH)); anomalyDetectionMatchState.setTrigger(anomalyDetectionTriggerEvent.getKey()); - final AxStateOutput adMat2Est = new AxStateOutput(anomalyDetectionMatchState.getKey(), + final var adMat2Est = new AxStateOutput(anomalyDetectionMatchState.getKey(), anomalyDetectionEstablishState.getKey(), anomalyDetectionMatchEvent.getKey()); anomalyDetectionMatchState.getStateOutputs().put(adMat2Est.getKey().getLocalName(), adMat2Est); anomalyDetectionMatchState.setTaskSelectionLogic(new AxTaskSelectionLogic(anomalyDetectionMatchState.getKey(), @@ -290,13 +291,13 @@ public class AdaptiveDomainModelFactory { anomalyDetectionPolicy.getStateMap().put(anomalyDetectionActState.getKey().getLocalName(), anomalyDetectionActState); - final AxPolicies anomalyDetectionPolicies = new AxPolicies( + final var anomalyDetectionPolicies = new AxPolicies( new AxArtifactKey("AnomalyDetectionPolicies", DEFAULT_VERSION)); anomalyDetectionPolicies.getPolicyMap().put(anomalyDetectionPolicy.getKey(), anomalyDetectionPolicy); - final AxKeyInformation keyInformation = new AxKeyInformation( + final var keyInformation = new AxKeyInformation( new AxArtifactKey("AnomalyDetectionKeyInformation", DEFAULT_VERSION)); - final AxPolicyModel anomalyDetectionPolicyModel = new AxPolicyModel( + final var anomalyDetectionPolicyModel = new AxPolicyModel( new AxArtifactKey("AnomalyDetectionPolicyModel", DEFAULT_VERSION)); anomalyDetectionPolicyModel.setPolicies(anomalyDetectionPolicies); anomalyDetectionPolicyModel.setEvents(anomalyDetectionEvents); @@ -322,14 +323,14 @@ public class AdaptiveDomainModelFactory { public AxPolicyModel getAutoLearnPolicyModel() { // CHECKSTYLE:ON: checkstyle:maximumMethodLength // Data types for event parameters - final AxContextSchema monitoredValue = new AxContextSchema(new AxArtifactKey(MONITORED_VALUE, DEFAULT_VERSION), + final var monitoredValue = new AxContextSchema(new AxArtifactKey(MONITORED_VALUE, DEFAULT_VERSION), "Java", "java.lang.Double"); - final AxContextSchemas alContextSchemas = new AxContextSchemas( + final var alContextSchemas = new AxContextSchemas( new AxArtifactKey("ALDatatypes", DEFAULT_VERSION)); alContextSchemas.getSchemasMap().put(monitoredValue.getKey(), monitoredValue); - final AxEvent autoLearnTriggerEvent = new AxEvent(new AxArtifactKey("AutoLearnTriggerEvent", DEFAULT_VERSION), + final var autoLearnTriggerEvent = new AxEvent(new AxArtifactKey("AutoLearnTriggerEvent", DEFAULT_VERSION), DEFAULT_NAMESPACE); autoLearnTriggerEvent.setSource(EXTERNAL); autoLearnTriggerEvent.setTarget(MATCH); @@ -339,7 +340,7 @@ public class AdaptiveDomainModelFactory { new AxField(new AxReferenceKey(autoLearnTriggerEvent.getKey(), LAST_MONITORED_VALUE), monitoredValue.getKey())); - final AxEvent autoLearnMatchEvent = new AxEvent(new AxArtifactKey("AutoLearnMatchEvent", DEFAULT_VERSION), + final var autoLearnMatchEvent = new AxEvent(new AxArtifactKey("AutoLearnMatchEvent", DEFAULT_VERSION), DEFAULT_NAMESPACE); autoLearnMatchEvent.setSource(MATCH); autoLearnMatchEvent.setTarget(ESTABLISH); @@ -349,7 +350,7 @@ public class AdaptiveDomainModelFactory { new AxField(new AxReferenceKey(autoLearnMatchEvent.getKey(), LAST_MONITORED_VALUE), monitoredValue.getKey())); - final AxEvent autoLearnEstablishEvent = new AxEvent( + final var autoLearnEstablishEvent = new AxEvent( new AxArtifactKey("AutoLearnEstablishEvent", DEFAULT_VERSION), DEFAULT_NAMESPACE); autoLearnEstablishEvent.setSource(ESTABLISH); @@ -361,7 +362,7 @@ public class AdaptiveDomainModelFactory { new AxField(new AxReferenceKey(autoLearnEstablishEvent.getKey(), LAST_MONITORED_VALUE), monitoredValue.getKey())); - final AxEvent autoLearnDecideEvent = new AxEvent(new AxArtifactKey("AutoLearnDecideEvent", DEFAULT_VERSION), + final var autoLearnDecideEvent = new AxEvent(new AxArtifactKey("AutoLearnDecideEvent", DEFAULT_VERSION), DEFAULT_NAMESPACE); autoLearnDecideEvent.setSource(DECIDE); autoLearnDecideEvent.setTarget("Act"); @@ -371,7 +372,7 @@ public class AdaptiveDomainModelFactory { new AxField(new AxReferenceKey(autoLearnDecideEvent.getKey(), LAST_MONITORED_VALUE), monitoredValue.getKey())); - final AxEvent autoLearnActEvent = new AxEvent(new AxArtifactKey("AutoLearnActEvent", DEFAULT_VERSION), + final var autoLearnActEvent = new AxEvent(new AxArtifactKey("AutoLearnActEvent", DEFAULT_VERSION), DEFAULT_NAMESPACE); autoLearnActEvent.setSource("Act"); autoLearnActEvent.setTarget(EXTERNAL); @@ -380,7 +381,7 @@ public class AdaptiveDomainModelFactory { 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", DEFAULT_VERSION)); + final var 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); @@ -388,15 +389,15 @@ public class AdaptiveDomainModelFactory { autoLearnEvents.getEventMap().put(autoLearnActEvent.getKey(), autoLearnActEvent); // Data types for context - final AxContextSchema autoLearn = new AxContextSchema(new AxArtifactKey("AutoLearn", DEFAULT_VERSION), "Java", + final var 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", DEFAULT_VERSION), + final var autoLearnAlbum = new AxContextAlbum(new AxArtifactKey("AutoLearnAlbum", DEFAULT_VERSION), "APPLICATION", true, autoLearn.getKey()); - final AxContextAlbums autoLearnAlbums = new AxContextAlbums( + final var autoLearnAlbums = new AxContextAlbums( new AxArtifactKey("AutoLearnContext", DEFAULT_VERSION)); autoLearnAlbums.getAlbumsMap().put(autoLearnAlbum.getKey(), autoLearnAlbum); @@ -405,49 +406,49 @@ public class AdaptiveDomainModelFactory { .setLogicPackage(this.getClass().getPackage().getName()) .setDefaultLogic("DefaultAutoLearnTask_Logic"); - final AxTask autoLearnMatchTask = new AxTask(new AxArtifactKey("AutoLearnMatchTask", DEFAULT_VERSION)); + final var autoLearnMatchTask = new AxTask(new AxArtifactKey("AutoLearnMatchTask", DEFAULT_VERSION)); autoLearnMatchTask.setTaskLogic(new AxTaskLogic(autoLearnMatchTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask autoLearnEstablishTask = new AxTask(new AxArtifactKey("AutoLearnEstablishTask", DEFAULT_VERSION)); + final var autoLearnEstablishTask = new AxTask(new AxArtifactKey("AutoLearnEstablishTask", DEFAULT_VERSION)); autoLearnEstablishTask.setTaskLogic( new AxTaskLogic(autoLearnEstablishTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); logicReader.setDefaultLogic(null); - final AxTask autoLearnDecideTask0 = new AxTask(new AxArtifactKey("AutoLearnDecideTask0", DEFAULT_VERSION)); + final var autoLearnDecideTask0 = new AxTask(new AxArtifactKey("AutoLearnDecideTask0", DEFAULT_VERSION)); autoLearnDecideTask0 .setTaskLogic(new AxTaskLogic(autoLearnDecideTask0.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask autoLearnDecideTask1 = new AxTask(new AxArtifactKey("AutoLearnDecideTask1", DEFAULT_VERSION)); + final var autoLearnDecideTask1 = new AxTask(new AxArtifactKey("AutoLearnDecideTask1", DEFAULT_VERSION)); autoLearnDecideTask1 .setTaskLogic(new AxTaskLogic(autoLearnDecideTask1.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask autoLearnDecideTask2 = new AxTask(new AxArtifactKey("AutoLearnDecideTask2", DEFAULT_VERSION)); + final var autoLearnDecideTask2 = new AxTask(new AxArtifactKey("AutoLearnDecideTask2", DEFAULT_VERSION)); autoLearnDecideTask2 .setTaskLogic(new AxTaskLogic(autoLearnDecideTask2.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask autoLearnDecideTask3 = new AxTask(new AxArtifactKey("AutoLearnDecideTask3", DEFAULT_VERSION)); + final var autoLearnDecideTask3 = new AxTask(new AxArtifactKey("AutoLearnDecideTask3", DEFAULT_VERSION)); autoLearnDecideTask3 .setTaskLogic(new AxTaskLogic(autoLearnDecideTask3.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask autoLearnDecideTask4 = new AxTask(new AxArtifactKey("AutoLearnDecideTask4", DEFAULT_VERSION)); + final var autoLearnDecideTask4 = new AxTask(new AxArtifactKey("AutoLearnDecideTask4", DEFAULT_VERSION)); autoLearnDecideTask4 .setTaskLogic(new AxTaskLogic(autoLearnDecideTask4.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask autoLearnDecideTask5 = new AxTask(new AxArtifactKey("AutoLearnDecideTask5", DEFAULT_VERSION)); + final var autoLearnDecideTask5 = new AxTask(new AxArtifactKey("AutoLearnDecideTask5", DEFAULT_VERSION)); autoLearnDecideTask5 .setTaskLogic(new AxTaskLogic(autoLearnDecideTask5.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask autoLearnDecideTask6 = new AxTask(new AxArtifactKey("AutoLearnDecideTask6", DEFAULT_VERSION)); + final var autoLearnDecideTask6 = new AxTask(new AxArtifactKey("AutoLearnDecideTask6", DEFAULT_VERSION)); autoLearnDecideTask6 .setTaskLogic(new AxTaskLogic(autoLearnDecideTask6.getKey(), TASK_LOGIC, "MVEL", logicReader)); logicReader.setDefaultLogic("DefaultAutoLearnTask_Logic"); - final AxTask autoLearnActTask = new AxTask(new AxArtifactKey("AutoLearnActTask", DEFAULT_VERSION)); + final var autoLearnActTask = new AxTask(new AxArtifactKey("AutoLearnActTask", DEFAULT_VERSION)); autoLearnActTask.setTaskLogic(new AxTaskLogic(autoLearnActTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTasks autoLearnTasks = new AxTasks(new AxArtifactKey("AutoLearnTasks", DEFAULT_VERSION)); + final var 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); @@ -462,12 +463,12 @@ public class AdaptiveDomainModelFactory { // Policies logicReader.setDefaultLogic(DEFAULT_STATE_LOGIC); - final AxPolicy autoLearnPolicy = new AxPolicy(new AxArtifactKey("AutoLearnPolicy", DEFAULT_VERSION)); + final var autoLearnPolicy = new AxPolicy(new AxArtifactKey("AutoLearnPolicy", DEFAULT_VERSION)); autoLearnPolicy.setTemplate("MEDA"); - final AxState autoLearnActState = new AxState(new AxReferenceKey(autoLearnPolicy.getKey(), "Act")); + final var autoLearnActState = new AxState(new AxReferenceKey(autoLearnPolicy.getKey(), "Act")); autoLearnActState.setTrigger(autoLearnDecideEvent.getKey()); - final AxStateOutput alAct2Out = new AxStateOutput(autoLearnActState.getKey(), AxReferenceKey.getNullKey(), + final var alAct2Out = new AxStateOutput(autoLearnActState.getKey(), AxReferenceKey.getNullKey(), autoLearnActEvent.getKey()); autoLearnActState.getStateOutputs().put(alAct2Out.getKey().getLocalName(), alAct2Out); autoLearnActState.setTaskSelectionLogic(new AxTaskSelectionLogic(autoLearnActState.getKey(), @@ -479,9 +480,9 @@ public class AdaptiveDomainModelFactory { logicReader.setDefaultLogic(null); - final AxState autoLearnDecideState = new AxState(new AxReferenceKey(autoLearnPolicy.getKey(), DECIDE)); + final var autoLearnDecideState = new AxState(new AxReferenceKey(autoLearnPolicy.getKey(), DECIDE)); autoLearnDecideState.setTrigger(autoLearnEstablishEvent.getKey()); - final AxStateOutput alDec2Act = new AxStateOutput(autoLearnDecideState.getKey(), autoLearnActState.getKey(), + final var alDec2Act = new AxStateOutput(autoLearnDecideState.getKey(), autoLearnActState.getKey(), autoLearnDecideEvent.getKey()); autoLearnDecideState.getStateOutputs().put(alDec2Act.getKey().getLocalName(), alDec2Act); autoLearnDecideState.getContextAlbumReferences().add(autoLearnAlbum.getKey()); @@ -512,9 +513,9 @@ public class AdaptiveDomainModelFactory { logicReader.setDefaultLogic(DEFAULT_STATE_LOGIC); - final AxState autoLearnEstablishState = new AxState(new AxReferenceKey(autoLearnPolicy.getKey(), ESTABLISH)); + final var autoLearnEstablishState = new AxState(new AxReferenceKey(autoLearnPolicy.getKey(), ESTABLISH)); autoLearnEstablishState.setTrigger(autoLearnMatchEvent.getKey()); - final AxStateOutput alEst2Dec = new AxStateOutput(autoLearnEstablishState.getKey(), + final var alEst2Dec = new AxStateOutput(autoLearnEstablishState.getKey(), autoLearnDecideState.getKey(), autoLearnEstablishEvent.getKey()); autoLearnEstablishState.getStateOutputs().put(alEst2Dec.getKey().getLocalName(), alEst2Dec); autoLearnEstablishState.setTaskSelectionLogic(new AxTaskSelectionLogic(autoLearnEstablishState.getKey(), @@ -524,9 +525,9 @@ public class AdaptiveDomainModelFactory { new AxStateTaskReference(autoLearnEstablishState.getKey(), autoLearnEstablishTask.getKey(), AxStateTaskOutputType.DIRECT, alEst2Dec.getKey())); - final AxState autoLearnMatchState = new AxState(new AxReferenceKey(autoLearnPolicy.getKey(), MATCH)); + final var autoLearnMatchState = new AxState(new AxReferenceKey(autoLearnPolicy.getKey(), MATCH)); autoLearnMatchState.setTrigger(autoLearnTriggerEvent.getKey()); - final AxStateOutput alMat2Est = new AxStateOutput(autoLearnMatchState.getKey(), + final var alMat2Est = new AxStateOutput(autoLearnMatchState.getKey(), autoLearnEstablishState.getKey(), autoLearnMatchEvent.getKey()); autoLearnMatchState.getStateOutputs().put(alMat2Est.getKey().getLocalName(), alMat2Est); autoLearnMatchState.setTaskSelectionLogic(new AxTaskSelectionLogic(autoLearnMatchState.getKey(), @@ -542,12 +543,12 @@ 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", DEFAULT_VERSION)); + final var autoLearnPolicies = new AxPolicies(new AxArtifactKey("AutoLearnPolicies", DEFAULT_VERSION)); autoLearnPolicies.getPolicyMap().put(autoLearnPolicy.getKey(), autoLearnPolicy); - final AxKeyInformation keyInformation = new AxKeyInformation( + final var keyInformation = new AxKeyInformation( new AxArtifactKey("AutoLearnKeyInformation", DEFAULT_VERSION)); - final AxPolicyModel autoLearnPolicyModel = new AxPolicyModel( + final var autoLearnPolicyModel = new AxPolicyModel( new AxArtifactKey("AutoLearnPolicyModel", DEFAULT_VERSION)); autoLearnPolicyModel.setPolicies(autoLearnPolicies); autoLearnPolicyModel.setEvents(autoLearnEvents); diff --git a/examples/examples-onap-bbs/src/main/java/org/onap/policy/apex/examples/bbs/WebClient.java b/examples/examples-onap-bbs/src/main/java/org/onap/policy/apex/examples/bbs/WebClient.java index e01e997fd..6dfd2b5f2 100644 --- a/examples/examples-onap-bbs/src/main/java/org/onap/policy/apex/examples/bbs/WebClient.java +++ b/examples/examples-onap-bbs/src/main/java/org/onap/policy/apex/examples/bbs/WebClient.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Huawei. All rights reserved. - * Modifications Copyright (C) 2019-2020 Nordix Foundation. + * Modifications Copyright (C) 2019-2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,6 @@ package org.onap.policy.apex.examples.bbs; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.InputStreamReader; -import java.io.OutputStream; import java.io.StringWriter; import java.net.HttpURLConnection; import java.net.URL; @@ -37,19 +36,15 @@ import javax.net.ssl.TrustManager; import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; -import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathFactory; import org.onap.policy.apex.model.basicmodel.concepts.ApexRuntimeException; import org.onap.policy.common.utils.network.NetworkUtil; import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; -import org.w3c.dom.Document; -import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.InputSource; @@ -80,13 +75,13 @@ public class WebClient { */ public String httpRequest(String requestUrl, String requestMethod, String outputStr, String username, String pass, String contentType) { - String result = ""; - StringBuilder builder = new StringBuilder(); + var result = ""; + var builder = new StringBuilder(); try { LOGGER.info("httpsRequest starts {} method {}", requestUrl, requestMethod); disableCertificateValidation(); - URL url = new URL(requestUrl); + var url = new URL(requestUrl); HttpURLConnection httpUrlConn = (HttpURLConnection) url.openConnection(); httpUrlConn.setDoOutput(true); @@ -110,12 +105,12 @@ public class WebClient { } if (null != outputStr) { - OutputStream outputStream = httpUrlConn.getOutputStream(); + var outputStream = httpUrlConn.getOutputStream(); outputStream.write(outputStr.getBytes(StandardCharsets.UTF_8)); outputStream.close(); } - try (BufferedReader bufferedReader = new BufferedReader( + try (var bufferedReader = new BufferedReader( new InputStreamReader(httpUrlConn.getInputStream(), StandardCharsets.UTF_8))) { String str; while ((str = bufferedReader.readLine()) != null) { @@ -140,34 +135,34 @@ public class WebClient { */ public String toPrettyString(String xml, int indent) { try { - try (ByteArrayInputStream br = new ByteArrayInputStream(xml.getBytes(StandardCharsets.UTF_8))) { + try (var br = new ByteArrayInputStream(xml.getBytes(StandardCharsets.UTF_8))) { - DocumentBuilderFactory df = DocumentBuilderFactory.newInstance(); + var df = DocumentBuilderFactory.newInstance(); df.setFeature(XML_DISALLOW_DOCTYPE_FEATURE, true); df.setFeature(XML_EXTERNAL_ENTITY_FEATURE, false); - Document document = df.newDocumentBuilder().parse(new InputSource(br)); + var document = df.newDocumentBuilder().parse(new InputSource(br)); document.normalize(); - XPath path = XPathFactory.newInstance().newXPath(); - NodeList nodeList = (NodeList) path + var path = XPathFactory.newInstance().newXPath(); + var nodeList = (NodeList) path .evaluate("//text()[normalize-space()='']", document, XPathConstants.NODESET); - for (int i = 0; i < nodeList.getLength(); ++i) { - Node node = nodeList.item(i); + for (var i = 0; i < nodeList.getLength(); ++i) { + var node = nodeList.item(i); node.getParentNode().removeChild(node); } - TransformerFactory transformerFactory = TransformerFactory.newInstance(); + var transformerFactory = TransformerFactory.newInstance(); transformerFactory.setAttribute("indent-number", indent); transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, ""); transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, ""); - Transformer transformer = transformerFactory.newTransformer(); + var transformer = transformerFactory.newTransformer(); transformer.setOutputProperty(OutputKeys.ENCODING, StandardCharsets.UTF_8.name()); transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); - StringWriter stringWriter = new StringWriter(); + var stringWriter = new StringWriter(); transformer.transform(new DOMSource(document), new StreamResult(stringWriter)); return stringWriter.toString(); } @@ -183,7 +178,7 @@ public class WebClient { try { TrustManager[] trustAllCerts = NetworkUtil.getAlwaysTrustingManager(); - SSLContext sc = SSLContext.getInstance("TLS"); + var sc = SSLContext.getInstance("TLS"); sc.init(null, trustAllCerts, new java.security.SecureRandom()); HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); HttpsURLConnection.setDefaultHostnameVerifier((String hostname, SSLSession session) -> { |