changed the header license to new license
[aai/sparky-be.git] / src / main / java / org / onap / aai / sparky / dal / elasticsearch / ElasticSearchEntityStatistics.java
index 42a0fcd..8226a25 100644 (file)
@@ -2,8 +2,8 @@
  * ============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.
@@ -17,8 +17,6 @@
  * 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.sparky.dal.elasticsearch;
 
@@ -29,11 +27,10 @@ import java.util.Set;
 import java.util.TreeMap;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import org.onap.aai.sparky.config.oxm.OxmEntityDescriptor;
-import org.onap.aai.sparky.config.oxm.OxmModelLoader;
+import org.onap.aai.restclient.client.OperationResult;
 import org.onap.aai.sparky.dal.NetworkTransaction;
 import org.onap.aai.sparky.dal.rest.HttpMethod;
-import org.onap.aai.sparky.dal.rest.OperationResult;
+
 
 /**
  * The Class ElasticSearchEntityStatistics.
@@ -48,8 +45,7 @@ public class ElasticSearchEntityStatistics {
   private static final String ERROR = "ERROR";
 
   private Map<String, HashMap<String, AtomicInteger>> entityStatistics;
-  private OxmModelLoader loader;
-
+  
   /**
    * Creates the entity op stats.
    *
@@ -70,19 +66,6 @@ public class ElasticSearchEntityStatistics {
 
   }
 
-  /*
-   * private void createActiveInventoryEntityStatistics() {
-   * 
-   * Map<String,OxmEntityDescriptor> descriptors = loader.getSearchableEntityDescriptors();
-   * 
-   * if(descriptors == null) { return; }
-   * 
-   * OxmEntityDescriptor d = null; for ( String key : descriptors.keySet() ) { d =
-   * descriptors.get(key); entityStatistics.put(d.getEntityName(), createEntityOpStats()); }
-   * 
-   * }
-   */
-
   /**
    * Initializecreate active inventory entity statistics.
    */
@@ -109,10 +92,8 @@ public class ElasticSearchEntityStatistics {
    *
    * @param loader the loader
    */
-  public ElasticSearchEntityStatistics(OxmModelLoader loader) {
-    this.loader = loader;
+  public ElasticSearchEntityStatistics() {
     entityStatistics = new HashMap<String, HashMap<String, AtomicInteger>>();
-    // createActiveInventoryEntityStatistics();
     reset();
   }
 
@@ -121,18 +102,27 @@ public class ElasticSearchEntityStatistics {
    *
    * @param descriptors the descriptors
    */
-  public void initializeCountersFromOxmEntityDescriptors(
-      Map<String, OxmEntityDescriptor> descriptors) {
+  public void intializeEntityCounters(
+      String... entityTypes) {
+
+    if (entityTypes != null && entityTypes.length > 0) {
+      for (String entityType : entityTypes) {
+        entityStatistics.put(entityType, createEntityOpStats());
+      }
 
-    if (descriptors == null) {
-      return;
     }
+    
+  }
+  
+  public void intializeEntityCounters(
+      Set<String> entityTypes) {
 
-    OxmEntityDescriptor descriptor = null;
-    for (String key : descriptors.keySet()) {
-      descriptor = descriptors.get(key);
-      entityStatistics.put(descriptor.getEntityName(), createEntityOpStats());
+    if (entityTypes != null && entityTypes.size() > 0) {
+      for (String entityType : entityTypes) {
+        entityStatistics.put(entityType, createEntityOpStats());
+      }
     }
+    
   }
 
   /**