* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017 Amdocs
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 Amdocs
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.datarouter.entity;
import org.onap.aai.datarouter.util.NodeUtils;
+import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
* The Class SpikeAggregationEntity. Mimics functionality of SPIKEUI's AggregationEntity
*/
public class SpikeAggregationEntity implements DocumentStoreDataEntity, Serializable {
+
+ private Map<String, String> attributes = new HashMap<>();
+
+ @JsonIgnore
+ private ObjectMapper mapper = new ObjectMapper();
+
+
private String id;
private String link;
private String lastmodTimestamp;
}
- Map<String, String> attributes = new HashMap<>();
- ObjectMapper mapper = new ObjectMapper();
/**
* Instantiates a new aggregation entity.
*/
public SpikeAggregationEntity() {}
- public void deriveFields(JsonNode uebPayload) {
+ public void deriveFields(JsonNode entityProperties) {
this.setId(NodeUtils.generateUniqueShaDigest(link));
this.setLastmodTimestamp(Long.toString(System.currentTimeMillis()));
- JsonNode entityNode = uebPayload.get("vertex").get("properties");
- Iterator<Entry<String, JsonNode>> nodes = entityNode.fields();
+ Iterator<Entry<String, JsonNode>> nodes = entityProperties.fields();
while (nodes.hasNext()) {
Map.Entry<String, JsonNode> entry = (Map.Entry<String, JsonNode>) nodes.next();
attributes.put(entry.getKey(), entry.getValue().asText());
}
}
-
-
@Override
public String getAsJson() {
ObjectNode rootNode = mapper.createObjectNode();
@Override
public String toString() {
- return "AggregationEntity [id=" + id + ", link=" + link + ", attributes=" + attributes
- + ", mapper=" + mapper + "]";
+ return "SpikeAggregationEntity ["
+ + (attributes != null ? "attributes=" + attributes + ", " : "")
+ + (id != null ? "id=" + id + ", " : "") + (link != null ? "link=" + link + ", " : "")
+ + (lastmodTimestamp != null ? "lastmodTimestamp=" + lastmodTimestamp : "") + "]";
}
+
+
+
}