diff options
6 files changed, 184 insertions, 46 deletions
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<String, Rule> 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<String, Rule> 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<String, Rule> { + private Rules(){} + private Rules(Map<String,Rule> 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; |