Merge "Fix logic in Schema Generator to properly"
authorJames Forsyth <jf2512@att.com>
Tue, 9 Apr 2019 15:19:26 +0000 (15:19 +0000)
committerGerrit Code Review <gerrit@onap.org>
Tue, 9 Apr 2019 15:19:26 +0000 (15:19 +0000)
1  2 
aai-core/src/main/java/org/onap/aai/dbgen/SchemaGenerator.java

@@@ -30,7 -30,10 +30,7 @@@ import org.onap.aai.config.SpringContex
  import org.onap.aai.db.props.AAIProperties;
  import org.onap.aai.edges.EdgeIngestor;
  import org.onap.aai.edges.exceptions.EdgeRuleNotFoundException;
 -import org.onap.aai.introspection.Introspector;
 -import org.onap.aai.introspection.Loader;
 -import org.onap.aai.introspection.LoaderFactory;
 -import org.onap.aai.introspection.ModelType;
 +import org.onap.aai.introspection.*;
  import org.onap.aai.logging.LogFormatTools;
  import org.onap.aai.schema.enums.PropertyMetadata;
  import org.onap.aai.edges.EdgeRule;
@@@ -108,8 -111,16 +108,8 @@@ public class SchemaGenerator 
                        }
                }
  
 -              // ApplicationContext ctx = SpringContextAware.getApplicationContext();
 -              // Loader loader =
 -              // ctx.getBean(LoaderFactory.class).createLoaderForVersion(ModelType.MOXY,
 -              // AAIProperties.LATEST);
 -              LoaderFactory loaderFactory   = SpringContextAware.getBean(LoaderFactory.class);
 -              SchemaVersions schemaVersions = SpringContextAware.getBean(SchemaVersions.class);
 +              Loader loader = LoaderUtil.getLatestVersion();
  
 -              Loader loader = loaderFactory.createLoaderForVersion(ModelType.MOXY, schemaVersions.getDefaultVersion());
 -              // Loader loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY,
 -              // AAIProperties.LATEST);
                Map<String, Introspector> objs = loader.getAllObjects();
                Map<String, PropertyKey> seenProps = new HashMap<>();
  
                                                        String dmsg = " Index  [" + dbPropName + "] already existed in the DB. ";
                                                        LOGGER.debug(dmsg);
                                                } else {
-                                                       if (obj.getIndexedProperties().contains(dbPropName)) {
-                                                               if (obj.getUniqueProperties().contains(dbPropName)) {
+                                                       if (obj.getIndexedProperties().contains(propName)) {
+                                                               if (obj.getUniqueProperties().contains(propName)) {
                                                                        imsg = "Add Unique index for PropertyKey: [" + dbPropName + "]";
                                                                        LOGGER.info(imsg);
                                                                        graphMgmt.buildIndex(dbPropName, Vertex.class).addKey(propK).unique()