Improve the performance of resoures microservice
[aai/aai-common.git] / aai-core / src / main / java / org / onap / aai / introspection / JSONStrategy.java
index 09ff7d3..d54a983 100644 (file)
  */
 package org.onap.aai.introspection;
 
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
 import org.json.simple.JSONObject;
 import org.onap.aai.schema.enums.ObjectMetadata;
 import org.onap.aai.schema.enums.PropertyMetadata;
+import org.onap.aai.setup.SchemaVersion;
 
 import java.io.UnsupportedEncodingException;
 import java.util.List;
@@ -32,7 +31,6 @@ import java.util.Set;
 import java.util.UUID;
 
 public class JSONStrategy extends Introspector {
-       private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(JSONStrategy.class);
 
        private JSONObject json = null;
        private String namedType = "";
@@ -48,47 +46,47 @@ public class JSONStrategy extends Introspector {
                        throw new IllegalArgumentException("This object has no named type.");
                }
        }
-       
+
        protected JSONStrategy(Object o, String namedType) {
                super(o);
                json = (JSONObject)o;
                this.namedType = namedType;
-               
+
        }
-       
+
        @Override
        public boolean hasProperty(String name) {
-               //TODO 
+               //TODO
                return true;
        }
        @Override
        public Object getValue(String name) {
                Object result = "";
                result = json.get(name);
-               
+
                return result;
        }
 
        @Override
        public void setValue(String name, Object obj) {
                json.put(name, obj);
-               
+
        }
        @Override
        public Object getUnderlyingObject() {
                return this.json;
        }
-       
+
        @Override
        public Set<String> getProperties() {
                Set<String> result = json.keySet();
                return result;
        }
-       
+
        @Override
        public Set<String> getRequiredProperties() {
                //unknowable
-               
+
                return this.getProperties();
        }
 
@@ -111,11 +109,11 @@ public class JSONStrategy extends Introspector {
                if (resultClass != null) {
                        result = resultClass.getName();
                }
-               
+
                if (result.equals("org.json.simple.JSONArray")) {
                        result = "java.util.List";
                }
-               
+
                return result;
        }
 
@@ -138,7 +136,7 @@ public class JSONStrategy extends Introspector {
        public Class<?> getClass(String name) {
                Class<?> result = null;
                result = json.get(name).getClass();
-               
+
                return result;
        }
 
@@ -150,7 +148,7 @@ public class JSONStrategy extends Introspector {
                if (resultObject.getClass().getName().equals("org.json.simple.JSONArray")) {
                        resultClass = ((List)resultObject).get(0).getClass();
                }
-               
+
                return resultClass;
        }
 
@@ -159,7 +157,6 @@ public class JSONStrategy extends Introspector {
                try {
                        return this.getClass(name).newInstance();
                } catch (InstantiationException | IllegalAccessException e) {
-            LOGGER.error(e.getMessage(),e);
                        return null;
                }
        }
@@ -169,47 +166,46 @@ public class JSONStrategy extends Introspector {
                try {
                        return this.getGenericTypeClass(name).newInstance();
                } catch (InstantiationException | IllegalAccessException e) {
-            LOGGER.error(e.getMessage(),e);
                        return null;
                }
        }
-       
+
        @Override
        public boolean isComplexType(String name) {
                String result = this.getType(name);
-               
+
                if (result.contains("JSONObject")) {
                        return true;
                } else {
                        return false;
                }
-               
+
        }
-       
+
        @Override
        public boolean isComplexGenericType(String name) {
                String result = this.getGenericType(name);
-               
+
                if (result.contains("JSONObject")) {
                        return true;
                } else {
                        return false;
                }
-               
+
        }
-       
+
        @Override
        public boolean isListType(String name) {
                String result = this.getType(name);
-               
+
                if (result.contains("java.util.List")) {
                        return true;
                } else {
                        return false;
                }
-               
+
        }
-       
+
        @Override
        public boolean isContainer() {
                Set<String> props = this.getProperties();
@@ -217,66 +213,66 @@ public class JSONStrategy extends Introspector {
                if (props.size() == 1 && this.isListType(props.iterator().next())) {
                        result = true;
                }
-               
+
                return result;
        }
        @Override
        protected String findKey() {
                return "";
        }
-       
+
        @Override
        public String getName() {
                return this.namedType;
        }
-       
+
        @Override
        public String getDbName() {
                return this.getName();
        }
-       
+
        @Override
        public String getURI() {
-               
-               // use a UUID for now 
+
+               // use a UUID for now
                return UUID.randomUUID().toString();
        }
-       
+
        @Override
        public String getGenericURI() {
-               
+
                //there is none defined for this
                return "";
        }
-       
+
        @Override
        public String preProcessKey (String key) {
-               
+
                // don't do anything with it
                return key;
-               
+
        }
-       
+
        @Override
        public String marshal(MarshallerProperties properties) {
                //TODO
                return null;
        }
-       
+
        @Override
        public Object clone() {
                //TODO
                return null;
        }
-       
+
        /*@Override
        public String findEdgeName(String parent, String child) {
-               
+
                // Always has for now
                return "has";
-               
+
        }*/
-       
+
        @Override
        public ModelType getModelType() {
                return ModelType.JSON;
@@ -345,7 +341,7 @@ public class JSONStrategy extends Introspector {
        @Override
        protected void set(String name, Object value) {
                // TODO Auto-generated method stub
-               
+
        }
 
        @Override
@@ -355,7 +351,7 @@ public class JSONStrategy extends Introspector {
        }
 
        @Override
-       public Version getVersion() {
+       public SchemaVersion getVersion() {
                // TODO Auto-generated method stub
                return null;
        }