1 package org.onap.sdc.dcae.catalog.engine;
4 import java.util.Collections;
6 import org.json.JSONObject;
7 import org.onap.sdc.dcae.catalog.engine.CatalogRequest;
9 import com.fasterxml.jackson.annotation.JsonIgnore;
13 public class ElementsLookup extends CatalogRequest {
15 private String annotation;
16 private Map<String,Object> selector;
18 public void setAnnotation(String theAnnon) {
19 this.annotation = theAnnon;
22 public String getAnnotation() {
23 return this.annotation;
26 public Map<String,Object> getSelector() {
27 return this.selector == null ? Collections.EMPTY_MAP : this.selector;
30 public void setSelector(Map<String,Object> theSelector) {
31 this.selector = theSelector;
34 public Object getSelectorEntry(String theName) {
35 return getSelector().get(theName);
39 * Because the JSONObject(Map) constructor would not copy entries wth null values.
42 public JSONObject getJSONSelector() {
43 JSONObject jsonSelector = new JSONObject();
44 for (Map.Entry<String, Object> entry: this.selector.entrySet()) {
45 jsonSelector.put(entry.getKey(), entry.getValue() != null ? entry.getValue() : JSONObject.NULL);