From 66f7f66366dc48298ded0f3b012f57eedb126055 Mon Sep 17 00:00:00 2001 From: "Manor, Yanir (ym903w)" Date: Thu, 20 Sep 2018 14:17:22 +0300 Subject: update code to latest update code to latest Change-Id: I6a519ef3308c565b4a6648225ad01ec79f6fc68b Issue-ID: DCAEGEN2-820 Signed-off-by: Manor, Yanir (ym903w) --- .../restmodels/ruleeditor/ApplyFilterRequest.java | 38 ++++++++++++++ .../restmodels/ruleeditor/ImportPhaseRequest.java | 61 ++++++++++++++++++++++ .../restmodels/ruleeditor/MappingRules.java | 32 ++++++++++-- .../restmodels/ruleeditor/RuleEditorRequest.java | 51 ++++++++++++++++++ .../restmodels/ruleeditor/TopoSearchAction.java | 1 - .../restmodels/ruleeditor/TranslateRequest.java | 47 +++-------------- 6 files changed, 184 insertions(+), 46 deletions(-) create mode 100644 src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ApplyFilterRequest.java create mode 100644 src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ImportPhaseRequest.java create mode 100644 src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/RuleEditorRequest.java (limited to 'src/main/java/org/onap') diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ApplyFilterRequest.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ApplyFilterRequest.java new file mode 100644 index 0000000..eba446e --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ApplyFilterRequest.java @@ -0,0 +1,38 @@ +package org.onap.sdc.dcae.composition.restmodels.ruleeditor; + + +public class ApplyFilterRequest extends TranslateRequest { + + private String version; + private String eventType; + private BaseCondition filter; + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getEventType() { + return eventType; + } + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + public BaseCondition getFilter() { + return filter; + } + + public void setFilter(BaseCondition filter) { + this.filter = filter; + } + + public ApplyFilterRequest(String vfcmtUuid, String dcaeCompLabel, String nid, String configParam, String notifyId, String entryPhase, String publishPhase, BaseCondition filter) { + super(vfcmtUuid, dcaeCompLabel, nid, configParam, notifyId, entryPhase, publishPhase); + this.filter = filter; + } +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ImportPhaseRequest.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ImportPhaseRequest.java new file mode 100644 index 0000000..985b53d --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ImportPhaseRequest.java @@ -0,0 +1,61 @@ +package org.onap.sdc.dcae.composition.restmodels.ruleeditor; + +public class ImportPhaseRequest extends RuleEditorRequest { + + private String groupId; + private String phase; + private String version; + private String eventType; + private MappingRulesResponse payload; + +// public ImportPhaseRequest(String vfcmtUuid, String dcaeCompLabel, String nid, String configParam, String groupId, String phase, String version, String eventType) { +// super(vfcmtUuid, dcaeCompLabel, nid, configParam); +// this.groupId = groupId; +// this.phase = phase; +// // validation performed against selected VES version/eventType +// this.version = version; +// this.eventType = eventType; +// } + + public String getGroupId() { + return groupId; + } + + public void setGroupId(String groupId) { + this.groupId = groupId; + } + + public String getPhase() { + return phase; + } + + public void setPhase(String phase) { + this.phase = phase; + } + + public MappingRulesResponse getPayload() { + return payload; + } + + public void setPayload(MappingRulesResponse payload) { + this.payload = payload; + } + + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getEventType() { + return eventType; + } + + public void setEventType(String eventType) { + this.eventType = eventType; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/MappingRules.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/MappingRules.java index 2fc8258..a284293 100644 --- a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/MappingRules.java +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/MappingRules.java @@ -16,7 +16,9 @@ public class MappingRules { //US420764 support phases configuration private String entryPhase; private String publishPhase; - private Map rules = new LinkedHashMap<>(); + //US441901 global filtering + private BaseCondition filter; + private Rules rules = new Rules(); public String getEntryPhase() { return entryPhase; @@ -39,7 +41,7 @@ public class MappingRules { } public void setRules(Map rules) { - this.rules = rules; + this.rules = new Rules(rules); } public String getVersion() { @@ -66,12 +68,27 @@ public class MappingRules { this.notifyId = notifyId; } + public BaseCondition getFilter() { + return filter; + } + + public void setFilter(BaseCondition filter) { + this.filter = filter; + } + + public MappingRules(Rule rule) { version = rule.getVersion(); eventType = rule.getEventType(); addOrReplaceRule(rule); } + public MappingRules(ApplyFilterRequest request) { + version = request.getVersion(); + eventType = request.getEventType(); + filter = request.getFilter(); + } + protected MappingRules(){} public void addOrReplaceRule(Rule rule) { @@ -120,11 +137,18 @@ public class MappingRules { } private boolean globalTranslationFieldsEqual(MappingRules other) { - return Objects.equals(notifyId, other.notifyId) && Objects.equals(entryPhase, other.entryPhase) && Objects.equals(publishPhase, other.publishPhase); + return Objects.equals(notifyId, other.notifyId) && Objects.equals(entryPhase, other.entryPhase) && Objects.equals(publishPhase, other.publishPhase) && Objects.equals(filter, other.filter); } @Override public int hashCode() { - return Objects.hash(version, notifyId, eventType, rules, entryPhase, publishPhase); + return Objects.hash(version, notifyId, eventType, rules, entryPhase, publishPhase, filter); + } + + private static class Rules extends LinkedHashMap { + private Rules(){} + private Rules(Map rules) { + this.putAll(rules); + } } } diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/RuleEditorRequest.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/RuleEditorRequest.java new file mode 100644 index 0000000..6e20abd --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/RuleEditorRequest.java @@ -0,0 +1,51 @@ +package org.onap.sdc.dcae.composition.restmodels.ruleeditor; + +public class RuleEditorRequest { + + private String vfcmtUuid; + private String dcaeCompLabel; + private String nid; + private String configParam; + + public RuleEditorRequest(){} + + public RuleEditorRequest(String vfcmtUuid, String dcaeCompLabel, String nid, String configParam) { + this.vfcmtUuid = vfcmtUuid; + this.dcaeCompLabel = dcaeCompLabel; + this.nid = nid; + this.configParam = configParam; + } + + public String getVfcmtUuid() { + return vfcmtUuid; + } + + public void setVfcmtUuid(String vfcmtUuid) { + this.vfcmtUuid = vfcmtUuid; + } + + public String getDcaeCompLabel() { + return dcaeCompLabel; + } + + public void setDcaeCompLabel(String dcaeCompLabel) { + this.dcaeCompLabel = dcaeCompLabel; + } + + public String getNid() { + return nid; + } + + public void setNid(String nid) { + this.nid = nid; + } + + public String getConfigParam() { + return configParam; + } + + public void setConfigParam(String configParam) { + this.configParam = configParam; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/TopoSearchAction.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/TopoSearchAction.java index b2a3960..9045ae4 100644 --- a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/TopoSearchAction.java +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/TopoSearchAction.java @@ -173,7 +173,6 @@ public class TopoSearchAction extends BaseAction { return null != strippedReference && strippedReference.equals(strippedTarget) || conditionalSearch() && searchFilter().referencesTarget(strippedTarget); } - //TODO enhance to targets plural @Override public String strippedTarget() { return ""; diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/TranslateRequest.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/TranslateRequest.java index b363c6d..4d3bef8 100644 --- a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/TranslateRequest.java +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/TranslateRequest.java @@ -1,57 +1,22 @@ package org.onap.sdc.dcae.composition.restmodels.ruleeditor; -public class TranslateRequest { +public class TranslateRequest extends RuleEditorRequest { - private String vfcmtUuid; - private String dcaeCompLabel; - private String nid; - private String configParam; private String notifyId; //US420764 support phases configuration private String entryPhase; private String publishPhase; - public TranslateRequest(String vfcmtUuid, String dcaeCompLabel, String nid, String configParam, String notifyId) { - this.vfcmtUuid = vfcmtUuid; - this.dcaeCompLabel = dcaeCompLabel; - this.nid = nid; - this.configParam = configParam; + public TranslateRequest(String vfcmtUuid, String dcaeCompLabel, String nid, String configParam, String notifyId, String entryPhase, String publishPhase) { + super(vfcmtUuid, dcaeCompLabel, nid, configParam); this.notifyId = notifyId; + this.entryPhase = entryPhase; + this.publishPhase = publishPhase; } - public String getVfcmtUuid() { - return vfcmtUuid; - } - - public void setVfcmtUuid(String vfcmtUuid) { - this.vfcmtUuid = vfcmtUuid; - } - - public String getDcaeCompLabel() { - return dcaeCompLabel; - } - - public void setDcaeCompLabel(String dcaeCompLabel) { - this.dcaeCompLabel = dcaeCompLabel; - } - - public String getNid() { - return nid; - } - - public void setNid(String nid) { - this.nid = nid; - } - - public String getConfigParam() { - return configParam; - } - - public void setConfigParam(String configParam) { - this.configParam = configParam; - } + TranslateRequest(){} public String getNotifyId() { return notifyId; -- cgit 1.2.3-korg