summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openecomp/sparky/synchronizer/entity
diff options
context:
space:
mode:
authorArul.Nambi <arul.nambi@amdocs.com>2017-09-26 14:00:57 -0400
committerArul.Nambi <arul.nambi@amdocs.com>2017-09-26 14:01:41 -0400
commitc593dfe4c59d37d5d4ea14e3ac31da3318029562 (patch)
tree76cc5a494f02e14b809caad9c050fbfd6cd61a51 /src/main/java/org/openecomp/sparky/synchronizer/entity
parent6777c6092050a0271c5d7de9c239cf1580d41fa8 (diff)
Renaming openecomp to onap
Issue-ID: AAI-208 Change-Id: I2bd02287bed376111156aca0100e2b7b74e368e3 Signed-off-by: Arul.Nambi <arul.nambi@amdocs.com>
Diffstat (limited to 'src/main/java/org/openecomp/sparky/synchronizer/entity')
-rw-r--r--src/main/java/org/openecomp/sparky/synchronizer/entity/AggregationEntity.java113
-rw-r--r--src/main/java/org/openecomp/sparky/synchronizer/entity/AggregationSuggestionEntity.java83
-rw-r--r--src/main/java/org/openecomp/sparky/synchronizer/entity/IndexDocument.java42
-rw-r--r--src/main/java/org/openecomp/sparky/synchronizer/entity/IndexableCrossEntityReference.java116
-rw-r--r--src/main/java/org/openecomp/sparky/synchronizer/entity/IndexableEntity.java103
-rw-r--r--src/main/java/org/openecomp/sparky/synchronizer/entity/MergableEntity.java57
-rw-r--r--src/main/java/org/openecomp/sparky/synchronizer/entity/ObjectIdCollection.java76
-rw-r--r--src/main/java/org/openecomp/sparky/synchronizer/entity/SearchableEntity.java149
-rw-r--r--src/main/java/org/openecomp/sparky/synchronizer/entity/SelfLinkDescriptor.java88
-rw-r--r--src/main/java/org/openecomp/sparky/synchronizer/entity/SuggestionSearchEntity.java277
-rw-r--r--src/main/java/org/openecomp/sparky/synchronizer/entity/TransactionStorageType.java54
11 files changed, 0 insertions, 1158 deletions
diff --git a/src/main/java/org/openecomp/sparky/synchronizer/entity/AggregationEntity.java b/src/main/java/org/openecomp/sparky/synchronizer/entity/AggregationEntity.java
deleted file mode 100644
index 8e2f725..0000000
--- a/src/main/java/org/openecomp/sparky/synchronizer/entity/AggregationEntity.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017 Amdocs
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * 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.openecomp.sparky.synchronizer.entity;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.openecomp.sparky.config.oxm.OxmModelLoader;
-import org.openecomp.sparky.util.NodeUtils;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * The Class AggregationEntity.
- */
-public class AggregationEntity extends IndexableEntity implements IndexDocument {
- private Map<String, String> attributes = new HashMap<String, String>();
- protected ObjectMapper mapper = new ObjectMapper();
-
- /**
- * Instantiates a new aggregation entity.
- */
- public AggregationEntity() {
- super();
- }
-
- /**
- * Instantiates a new aggregation entity.
- *
- * @param loader the loader
- */
- public AggregationEntity(OxmModelLoader loader) {
- super(loader);
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.sparky.synchronizer.entity.IndexDocument#deriveFields()
- */
- @Override
- public void deriveFields() {
-
- /*
- * We'll try and create a unique identity key that we can use for differencing the previously
- * imported record sets as we won't have granular control of what is created/removed and when.
- * The best we can hope for is identification of resources by generated Id until the
- * Identity-Service UUID is tagged against all resources, then we can use that instead.
- */
- this.id =
- NodeUtils.generateUniqueShaDigest(link);
- }
-
- public void copyAttributeKeyValuePair(Map<String, Object> map){
- for(String key: map.keySet()){
- if (!key.equalsIgnoreCase("relationship-list")){ // ignore relationship data which is not required in aggregation
- this.attributes.put(key, map.get(key).toString()); // not sure if entity attribute can contain an object as value
- }
- }
- }
-
- public void addAttributeKeyValuePair(String key, String value){
- this.attributes.put(key, value);
- }
-
- @Override
- public String getIndexDocumentJson() {
- ObjectNode rootNode = mapper.createObjectNode();
- rootNode.put("link", this.getLink());
- rootNode.put("lastmodTimestamp", this.getEntityTimeStamp());
- for (String key: this.attributes.keySet()){
- rootNode.put(key, this.attributes.get(key));
- }
- return rootNode.toString();
- }
-
- @Override
- public ObjectNode getBulkImportEntity() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "IndexDocument [" + (entityType != null ? "entityType=" + entityType + ", " : "")
- + (entityPrimaryKeyValue != null ? "entityPrimaryKeyValue=" + entityPrimaryKeyValue + ", "
- : "")
- + (mapper != null ? "mapper=" + mapper + ", " : "") + (id != null ? "id=" + id + ", " : "")
- + (lastmodTimestamp != null ? "lastmodTimestamp=" + lastmodTimestamp + ", " : "") + "]";
- }
-}
diff --git a/src/main/java/org/openecomp/sparky/synchronizer/entity/AggregationSuggestionEntity.java b/src/main/java/org/openecomp/sparky/synchronizer/entity/AggregationSuggestionEntity.java
deleted file mode 100644
index 9f6a2c3..0000000
--- a/src/main/java/org/openecomp/sparky/synchronizer/entity/AggregationSuggestionEntity.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017 Amdocs
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * 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.openecomp.sparky.synchronizer.entity;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.json.JSONArray;
-import org.json.JSONObject;
-import org.openecomp.sparky.util.NodeUtils;
-
-public class AggregationSuggestionEntity extends IndexableEntity implements IndexDocument {
-
- private List<String> inputs = new ArrayList<String>();
- private final String outputString = "VNFs";
- protected ObjectMapper mapper = new ObjectMapper();
-
- public AggregationSuggestionEntity() {
- super();
- inputs.add("VNFs");
- inputs.add("generic-vnfs");
- }
-
- @Override
- public void deriveFields() {
- this.id = NodeUtils.generateUniqueShaDigest(this.outputString);
- }
-
- @Override
- public String getIndexDocumentJson() {
-
- JSONArray inputArray = new JSONArray();
- for (String input: inputs) {
- input = input.replace(",","" );
- input = input.replace("[","" );
- input = input.replace("]","" );
- inputArray.put(input);
- }
-
- JSONObject entitySuggest = new JSONObject();
- entitySuggest.put("input", inputArray);
- entitySuggest.put("output", this.outputString);
- entitySuggest.put("weight", 100);
-
- JSONObject payloadNode = new JSONObject();
- entitySuggest.put("payload", payloadNode);
-
- JSONObject rootNode = new JSONObject();
- rootNode.put("entity_suggest", entitySuggest);
-
- return rootNode.toString();
- }
-
- @Override
- public ObjectNode getBulkImportEntity() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/src/main/java/org/openecomp/sparky/synchronizer/entity/IndexDocument.java b/src/main/java/org/openecomp/sparky/synchronizer/entity/IndexDocument.java
deleted file mode 100644
index f1de89d..0000000
--- a/src/main/java/org/openecomp/sparky/synchronizer/entity/IndexDocument.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017 Amdocs
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * 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.openecomp.sparky.synchronizer.entity;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * The Interface IndexDocument.
- */
-public interface IndexDocument {
-
- /**
- * Derive fields.
- */
- public void deriveFields();
-
- public String getIndexDocumentJson();
-
- public String getId();
-
- public ObjectNode getBulkImportEntity();
-}
diff --git a/src/main/java/org/openecomp/sparky/synchronizer/entity/IndexableCrossEntityReference.java b/src/main/java/org/openecomp/sparky/synchronizer/entity/IndexableCrossEntityReference.java
deleted file mode 100644
index 76ef5c0..0000000
--- a/src/main/java/org/openecomp/sparky/synchronizer/entity/IndexableCrossEntityReference.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017 Amdocs
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * 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.openecomp.sparky.synchronizer.entity;
-
-import java.util.ArrayList;
-
-import org.openecomp.sparky.config.oxm.OxmModelLoader;
-import org.openecomp.sparky.util.NodeUtils;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-
-/**
- * The Class IndexableCrossEntityReference.
- */
-
-public class IndexableCrossEntityReference extends IndexableEntity implements IndexDocument {
-
- protected String crossReferenceEntityValues;
- protected ArrayList<String> crossEntityReferenceCollection = new ArrayList<String>();
- protected ObjectMapper mapper = new ObjectMapper();
-
- /**
- * Instantiates a new indexable cross entity reference.
- */
- public IndexableCrossEntityReference() {
- super();
- }
-
- /**
- * Instantiates a new indexable cross entity reference.
- *
- * @param loader the loader
- */
- public IndexableCrossEntityReference(OxmModelLoader loader) {
- super(loader);
- }
-
- /**
- * Adds the cross entity reference value.
- *
- * @param crossEntityReferenceValue the cross entity reference value
- */
- public void addCrossEntityReferenceValue(String crossEntityReferenceValue) {
- if (!crossEntityReferenceCollection.contains(crossEntityReferenceValue)) {
- crossEntityReferenceCollection.add(crossEntityReferenceValue);
- }
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.sparky.synchronizer.entity.IndexDocument#deriveFields()
- */
- @Override
- public void deriveFields() {
- this.id = NodeUtils.generateUniqueShaDigest(link);
- this.crossReferenceEntityValues = NodeUtils.concatArray(crossEntityReferenceCollection, ";");
- }
-
- @Override
- public String getIndexDocumentJson() {
- ObjectNode rootNode = mapper.createObjectNode();
- rootNode.put("entityType", this.getEntityType());
- rootNode.put("entityPrimaryKeyValue", this.getEntityPrimaryKeyValue());
- rootNode.put("crossEntityReferenceValues", crossReferenceEntityValues);
- rootNode.put("link", link);
- rootNode.put("lastmodTimestamp", this.getEntityTimeStamp());
- return rootNode.toString();
- }
-
- @Override
- public ObjectNode getBulkImportEntity() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "IndexableCrossEntityReference ["
- + (crossReferenceEntityValues != null
- ? "crossReferenceEntityValues=" + crossReferenceEntityValues + ", " : "")
- + (crossEntityReferenceCollection != null
- ? "crossEntityReferenceCollection=" + crossEntityReferenceCollection + ", " : "")
- + (mapper != null ? "mapper=" + mapper + ", " : "") + (id != null ? "id=" + id + ", " : "")
- + (entityType != null ? "entityType=" + entityType + ", " : "")
- + (entityPrimaryKeyValue != null ? "entityPrimaryKeyValue=" + entityPrimaryKeyValue + ", "
- : "")
- + (lastmodTimestamp != null ? "lastmodTimestamp=" + lastmodTimestamp + ", " : "")
- + (link != null ? "link=" + link + ", " : "") + (loader != null ? "loader=" + loader : "")
- + "]";
- }
-
-}
diff --git a/src/main/java/org/openecomp/sparky/synchronizer/entity/IndexableEntity.java b/src/main/java/org/openecomp/sparky/synchronizer/entity/IndexableEntity.java
deleted file mode 100644
index 4999b3e..0000000
--- a/src/main/java/org/openecomp/sparky/synchronizer/entity/IndexableEntity.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017 Amdocs
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * 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.openecomp.sparky.synchronizer.entity;
-
-import java.sql.Timestamp;
-import java.text.SimpleDateFormat;
-
-import org.openecomp.sparky.config.oxm.OxmModelLoader;
-
-/**
- * The Class IndexableEntity.
- */
-public abstract class IndexableEntity {
- protected String id; // generated, SHA-256 digest
- protected String entityType;
- protected String entityPrimaryKeyValue;
- protected String lastmodTimestamp;
- protected String link;
- protected OxmModelLoader loader;
-
- private static final String TIMESTAMP_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
-
- /**
- * Instantiates a new indexable entity.
- */
- public IndexableEntity() {
- SimpleDateFormat dateFormat = new SimpleDateFormat(TIMESTAMP_FORMAT);
- Timestamp timestamp = new Timestamp(System.currentTimeMillis());
- String currentFormattedTimeStamp = dateFormat.format(timestamp);
- this.setEntityTimeStamp(currentFormattedTimeStamp);
- }
-
- /**
- * Instantiates a new indexable entity.
- *
- * @param loader the loader
- */
- public IndexableEntity(OxmModelLoader loader) {
- this();
- this.loader = loader;
- }
-
- public String getId() {
- return id;
- }
-
- public String getEntityType() {
- return entityType;
- }
-
- public String getEntityPrimaryKeyValue() {
- return entityPrimaryKeyValue;
- }
-
- public String getEntityTimeStamp() {
- return lastmodTimestamp;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public void setEntityType(String entityType) {
- this.entityType = entityType;
- }
-
- public void setEntityPrimaryKeyValue(String fieldValue) {
- this.entityPrimaryKeyValue = fieldValue;
- }
-
- public void setEntityTimeStamp(String lastmodTimestamp) {
- this.lastmodTimestamp = lastmodTimestamp;
- }
-
- public String getLink() {
- return link;
- }
-
- public void setLink(String link) {
- this.link = link;
- }
-
-}
diff --git a/src/main/java/org/openecomp/sparky/synchronizer/entity/MergableEntity.java b/src/main/java/org/openecomp/sparky/synchronizer/entity/MergableEntity.java
deleted file mode 100644
index e40383a..0000000
--- a/src/main/java/org/openecomp/sparky/synchronizer/entity/MergableEntity.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017 Amdocs
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * 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.openecomp.sparky.synchronizer.entity;
-
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * The Class MergableEntity.
- */
-public class MergableEntity {
- private Map<String, String> other = new HashMap<String, String>();
-
- /**
- * Any.
- *
- * @return the map
- */
- @JsonAnyGetter
- public Map<String, String> any() {
- return other;
- }
-
- /**
- * Sets the.
- *
- * @param name the name
- * @param value the value
- */
- @JsonAnySetter
- public void set(String name, String value) {
- other.put(name, value);
- }
-}
diff --git a/src/main/java/org/openecomp/sparky/synchronizer/entity/ObjectIdCollection.java b/src/main/java/org/openecomp/sparky/synchronizer/entity/ObjectIdCollection.java
deleted file mode 100644
index ee79eb8..0000000
--- a/src/main/java/org/openecomp/sparky/synchronizer/entity/ObjectIdCollection.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017 Amdocs
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * 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.openecomp.sparky.synchronizer.entity;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * The Class ObjectIdCollection.
- */
-public class ObjectIdCollection {
-
- protected ConcurrentHashMap<String, String> importedObjectIds =
- new ConcurrentHashMap<String, String>();
-
- public Collection<String> getImportedObjectIds() {
- return importedObjectIds.values();
- }
-
- /**
- * Adds the object id.
- *
- * @param id the id
- */
- public void addObjectId(String id) {
- importedObjectIds.putIfAbsent(id, id);
- }
-
- public int getSize() {
- return importedObjectIds.values().size();
- }
-
- /**
- * Adds the all.
- *
- * @param items the items
- */
- public void addAll(List<String> items) {
- if (items == null) {
- return;
- }
-
- items.stream().forEach((item) -> {
- importedObjectIds.putIfAbsent(item, item);
- });
-
- }
-
- /**
- * Clear.
- */
- public void clear() {
- importedObjectIds.clear();
- }
-}
diff --git a/src/main/java/org/openecomp/sparky/synchronizer/entity/SearchableEntity.java b/src/main/java/org/openecomp/sparky/synchronizer/entity/SearchableEntity.java
deleted file mode 100644
index d80ced2..0000000
--- a/src/main/java/org/openecomp/sparky/synchronizer/entity/SearchableEntity.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017 Amdocs
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * 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.openecomp.sparky.synchronizer.entity;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.openecomp.sparky.config.oxm.OxmModelLoader;
-import org.openecomp.sparky.util.NodeUtils;
-
-/**
- * The Class SearchableEntity.
- */
-public class SearchableEntity extends IndexableEntity implements IndexDocument {
- protected List<String> searchTagCollection = new ArrayList<String>();
- protected List<String> searchTagIdCollection = new ArrayList<String>();
- protected ObjectMapper mapper = new ObjectMapper();
-
- /**
- * Instantiates a new searchable entity.
- */
- public SearchableEntity() {
- super();
- }
-
- /**
- * Instantiates a new searchable entity.
- *
- * @param loader the loader
- */
- public SearchableEntity(OxmModelLoader loader) {
- super(loader);
- }
-
- /*
- * Generated fields, leave the settings for junit overrides
- */
- protected String searchTags; // generated based on searchTagCollection values
- protected String searchTagIDs;
-
- /**
- * Generates the sha based id.
- */
- public void generateId() {
- this.id = NodeUtils.generateUniqueShaDigest(link);
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.sparky.synchronizer.entity.IndexDocument#deriveFields()
- */
- @Override
- public void deriveFields() {
-
- /*
- * We'll try and create a unique identity key that we can use for differencing the previously
- * imported record sets as we won't have granular control of what is created/removed and when.
- * The best we can hope for is identification of resources by generated Id until the
- * Identity-Service UUID is tagged against all resources, then we can use that instead.
- */
- generateId();
- this.searchTags = NodeUtils.concatArray(searchTagCollection, ";");
- this.searchTagIDs = NodeUtils.concatArray(this.searchTagIdCollection, ";");
- }
-
- /**
- * Adds the search tag with key.
- *
- * @param searchTag the search tag
- * @param searchTagKey the key associated with the search tag (key:value)
- */
- public void addSearchTagWithKey(String searchTag, String searchTagKey) {
- searchTagIdCollection.add(searchTagKey);
- searchTagCollection.add(searchTag);
- }
-
- public List<String> getSearchTagCollection() {
- return searchTagCollection;
- }
-
- public String getSearchTags() {
- return searchTags;
- }
-
- public String getSearchTagIDs() {
- return searchTagIDs;
- }
-
- public List<String> getSearchTagIdCollection() {
- return searchTagIdCollection;
- }
-
- @Override
- public String getIndexDocumentJson() {
- ObjectNode rootNode = mapper.createObjectNode();
- rootNode.put("entityType", this.getEntityType());
- rootNode.put("entityPrimaryKeyValue", this.getEntityPrimaryKeyValue());
- rootNode.put("searchTagIDs", this.getSearchTagIDs());
- rootNode.put("searchTags", this.getSearchTags());
- rootNode.put("link", this.getLink());
- rootNode.put("lastmodTimestamp", this.getEntityTimeStamp());
- return rootNode.toString();
- }
-
- @Override
- public ObjectNode getBulkImportEntity() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "IndexDocument [" + (entityType != null ? "entityType=" + entityType + ", " : "")
- + (entityPrimaryKeyValue != null ? "entityPrimaryKeyValue=" + entityPrimaryKeyValue + ", "
- : "")
- + (searchTagCollection != null ? "searchTagCollection=" + searchTagCollection + ", " : "")
- + (searchTagIdCollection != null ? "searchTagIDCollection=" + searchTagIdCollection + ", "
- : "")
- + (mapper != null ? "mapper=" + mapper + ", " : "") + (id != null ? "id=" + id + ", " : "")
- + (lastmodTimestamp != null ? "lastmodTimestamp=" + lastmodTimestamp + ", " : "")
- + (searchTags != null ? "searchTags=" + searchTags + ", " : "")
- + (searchTagIDs != null ? "searchTagIDs=" + searchTagIDs : "") + "]";
- }
-}
diff --git a/src/main/java/org/openecomp/sparky/synchronizer/entity/SelfLinkDescriptor.java b/src/main/java/org/openecomp/sparky/synchronizer/entity/SelfLinkDescriptor.java
deleted file mode 100644
index a2a2ba3..0000000
--- a/src/main/java/org/openecomp/sparky/synchronizer/entity/SelfLinkDescriptor.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017 Amdocs
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * 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.openecomp.sparky.synchronizer.entity;
-
-/**
- * The Class SelfLinkDescriptor.
- */
-public class SelfLinkDescriptor {
- private String selfLink;
- private String entityType;
- private String depthModifier;
-
- public String getDepthModifier() {
- return depthModifier;
- }
-
- public void setDepthModifier(String depthModifier) {
- this.depthModifier = depthModifier;
- }
-
- public String getSelfLink() {
- return selfLink;
- }
-
- public void setSelfLink(String selfLink) {
- this.selfLink = selfLink;
- }
-
- public String getEntityType() {
- return entityType;
- }
-
- public void setEntityType(String entityType) {
- this.entityType = entityType;
- }
-
- public SelfLinkDescriptor(String selfLink) {
- this(selfLink, null, null);
- }
-
- /**
- * Instantiates a new self link descriptor.
- *
- * @param selfLink the self link
- * @param entityType the entity type
- */
- public SelfLinkDescriptor(String selfLink, String entityType) {
- this(selfLink, null, entityType);
- }
-
- public SelfLinkDescriptor(String selfLink, String depthModifier, String entityType) {
- this.selfLink = selfLink;
- this.entityType = entityType;
- this.depthModifier = depthModifier;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "SelfLinkDescriptor [" + (selfLink != null ? "selfLink=" + selfLink + ", " : "")
- + (entityType != null ? "entityType=" + entityType + ", " : "")
- + (depthModifier != null ? "depthModifier=" + depthModifier : "") + "]";
- }
-
-}
-
diff --git a/src/main/java/org/openecomp/sparky/synchronizer/entity/SuggestionSearchEntity.java b/src/main/java/org/openecomp/sparky/synchronizer/entity/SuggestionSearchEntity.java
deleted file mode 100644
index 0f06322..0000000
--- a/src/main/java/org/openecomp/sparky/synchronizer/entity/SuggestionSearchEntity.java
+++ /dev/null
@@ -1,277 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017 Amdocs
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * 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.openecomp.sparky.synchronizer.entity;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.json.JSONArray;
-import org.json.JSONObject;
-import org.openecomp.sparky.config.oxm.OxmModelLoader;
-import org.openecomp.sparky.util.NodeUtils;
-
-public class SuggestionSearchEntity extends IndexableEntity implements IndexDocument {
-
- private String entityType;
- private List<String> suggestionConnectorWords = new ArrayList<String>();
- private List<String> suggestionAttributeTypes = new ArrayList<String>();
- private List<String> suggestionAttributeValues = new ArrayList<String>();
- private List<String> suggestionTypeAliases = new ArrayList<String>();
- private List<String> suggestionInputPermutations = new ArrayList<String>();
- private List<String> suggestableAttr = new ArrayList<String>();
- private Map<String, String> payload = new HashMap<String, String>();
- private JSONObject payloadJsonNode = new JSONObject();
- private StringBuffer outputString = new StringBuffer();
- private String aliasToUse;
-
- public Map<String, String> getPayload() {
- return payload;
- }
-
- public void setPayload(Map<String, String> payload) {
- this.payload = payload;
- }
-
-
- public JSONObject getPayloadJsonNode() {
- return payloadJsonNode;
- }
-
- public void setPayloadJsonNode(JSONObject payloadJsonNode) {
- this.payloadJsonNode = payloadJsonNode;
- }
-
-
- protected ObjectMapper mapper = new ObjectMapper();
-
- public SuggestionSearchEntity() {
- super();
- }
-
- public void setSuggestableAttr(ArrayList<String> attributes) {
- for (String attribute : attributes) {
- this.suggestableAttr.add(attribute);
- }
- }
-
- public void setPayloadFromResponse(JsonNode node) {
- Map<String, String> nodePayload = new HashMap<String, String>();
- if (suggestableAttr != null) {
- for (String attribute : suggestableAttr) {
- if (node.get(attribute) != null) {
- nodePayload.put(attribute, node.get(attribute).asText());
- }
- }
- this.setPayload(nodePayload);
- }
- }
-
-
- public SuggestionSearchEntity(OxmModelLoader loader) {
- super(loader);
- }
-
- @Override
- public String getEntityType() {
- return entityType;
- }
-
- @Override
- public void setEntityType(String entityType) {
- this.entityType = entityType;
- }
-
- public List<String> getSuggestionConnectorWords() {
- return suggestionConnectorWords;
- }
-
- public void setSuggestionConnectorWords(List<String> suggestionConnectorWords) {
- this.suggestionConnectorWords = suggestionConnectorWords;
- }
-
- public List<String> getSuggestionPropertyTypes() {
- return this.suggestionAttributeTypes;
- }
-
- public void setSuggestionPropertyTypes(List<String> suggestionPropertyTypes) {
- this.suggestionAttributeTypes = suggestionPropertyTypes;
- }
-
- public List<String> getSuggestionAttributeValues() {
- return this.suggestionAttributeValues;
- }
-
- public void setSuggestionAttributeValues(List<String> suggestionAttributeValues) {
- this.suggestionAttributeValues = suggestionAttributeValues;
- }
-
- public List<String> getSuggestionAliases() {
- return this.suggestionTypeAliases;
- }
-
- public void setSuggestionAliases(List<String> suggestionAliases) {
- this.suggestionTypeAliases = suggestionAliases;
- }
-
- public List<String> getSuggestionInputPermutations() {
- return this.suggestionInputPermutations;
- }
-
- public void setSuggestionInputPermutations(List<String> permutations) {
- this.suggestionInputPermutations = permutations;
- }
-
- public void generateSuggestionInputPermutations() {
-
-
- List<String> entityNames = new ArrayList<>();
- entityNames.add(entityType);
- HashMap<String, String> desc = loader.getOxmModel().get(this.entityType);
- String attr = desc.get("suggestionAliases");
- String[] suggestionAliasesArray = attr.split(",");
- suggestionTypeAliases = Arrays.asList(suggestionAliasesArray);
- this.setAliasToUse(suggestionAliasesArray[suggestionAliasesArray.length - 1]);
- for (String alias : suggestionTypeAliases) {
- entityNames.add(alias);
- }
- ArrayList<String> listOfSearchSuggestionPermutations = new ArrayList<>();
-
- ArrayList<String> listToPermutate = new ArrayList<>(payload.values());
-
- for (String entityName : entityNames) {
- listToPermutate.add(entityName);
- permutateList(listToPermutate, new ArrayList<String>(), listToPermutate.size(),
- listOfSearchSuggestionPermutations);
- listToPermutate.remove(entityName);
- }
- suggestionInputPermutations = listOfSearchSuggestionPermutations;
- }
-
- /**
- * Generate all permutations of a list of Strings
- *
- * @param list
- * @param permutation
- * @param size
- */
- private void permutateList(List<String> list, List<String> permutation, int size,
- List<String> listOfSearchSuggestionPermutationList) {
- if (permutation.size() == size) {
- StringBuilder newPermutation = new StringBuilder();
-
- for (int i = 0; i < permutation.size(); i++) {
- newPermutation.append(permutation.get(i)).append(" ");
- }
-
- listOfSearchSuggestionPermutationList.add(newPermutation.toString().trim());
-
- return;
- }
-
- String[] availableItems = list.toArray(new String[0]);
-
- for (String i : availableItems) {
- permutation.add(i);
- list.remove(i);
- permutateList(list, permutation, size, listOfSearchSuggestionPermutationList);
- list.add(i);
- permutation.remove(i);
- }
- }
-
- public boolean isSuggestableDoc() {
- return this.getPayload().size() != 0;
- }
-
-
- @Override
- public void deriveFields() {
-
- int payloadEntryCounter = 1;
- for (Map.Entry<String, String> payload : getPayload().entrySet()) {
- // Add the payload(status) only if a valid value is present
- if (payload.getValue() != null &&payload.getValue().length() > 0) {
- this.getPayloadJsonNode().put(payload.getKey(), payload.getValue());
- this.outputString.append(payload.getValue());
- if (payloadEntryCounter < getPayload().entrySet().size()) {
- this.outputString.append(" and ");
- } else{
- this.outputString.append(" ");
- }
- }
- payloadEntryCounter++;
- }
-
- this.outputString.append(this.getAliasToUse());
- this.id = NodeUtils.generateUniqueShaDigest(outputString.toString());
- }
-
- @Override
- public String getIndexDocumentJson() {
- // TODO Auto-generated method stub
- JSONObject rootNode = new JSONObject();
-
- JSONArray suggestionsArray = new JSONArray();
- for (String suggestion : suggestionInputPermutations) {
- suggestionsArray.put(suggestion);
- }
-
- JSONObject entitySuggest = new JSONObject();
-
- entitySuggest.put("input", suggestionsArray);
- entitySuggest.put("output", this.outputString);
- entitySuggest.put("payload", this.payloadJsonNode);
- rootNode.put("entity_suggest", entitySuggest);
-
- return rootNode.toString();
- }
-
- @Override
- public ObjectNode getBulkImportEntity() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getAliasToUse() {
- return aliasToUse;
- }
-
- public void setAliasToUse(String aliasToUse) {
- this.aliasToUse = aliasToUse;
- }
-
- @Override
- public String toString() {
- return "SuggestionSearchEntity [entityType=" + entityType + ", suggestionConnectorWords="
- + suggestionConnectorWords + ", suggestionAttributeTypes=" + suggestionAttributeTypes
- + ", suggestionAttributeValues=" + suggestionAttributeValues + ", suggestionTypeAliases="
- + suggestionTypeAliases + ", mapper=" + mapper + "]";
- }
-}
diff --git a/src/main/java/org/openecomp/sparky/synchronizer/entity/TransactionStorageType.java b/src/main/java/org/openecomp/sparky/synchronizer/entity/TransactionStorageType.java
deleted file mode 100644
index b7557f3..0000000
--- a/src/main/java/org/openecomp/sparky/synchronizer/entity/TransactionStorageType.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017 Amdocs
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * 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.openecomp.sparky.synchronizer.entity;
-
-/**
- * The Enum TransactionStorageType.
- */
-public enum TransactionStorageType {
- EDGE_TAG_QUERY(0, "aaiOffline/edge-tag-query"), ACTIVE_INVENTORY_QUERY(1,
- "aaiOffline/active-inventory-query");
-
- private Integer index;
- private String outputFolder;
-
- /**
- * Instantiates a new transaction storage type.
- *
- * @param index the index
- * @param outputFolder the output folder
- */
- TransactionStorageType(Integer index, String outputFolder) {
- this.index = index;
- this.outputFolder = outputFolder;
- }
-
- public Integer getIndex() {
- return index;
- }
-
- public String getOutputFolder() {
- return outputFolder;
- }
-
-}