Create vertex and edge indicies on startup
[aai/champ.git] / champ-lib / champ-core / src / main / java / org / onap / aai / champcore / ie / GraphMLImporterExporter.java
index a41f159..36a3da0 100644 (file)
@@ -23,6 +23,7 @@ package org.onap.aai.champcore.ie;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -97,6 +98,7 @@ public class GraphMLImporterExporter implements Importer, Exporter {
 
                try {
                        final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+                       factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); 
                        final DocumentBuilder builder = factory.newDocumentBuilder();
                        final InputSource inputSource = new InputSource(is);
                    final Document doc = builder.parse(inputSource);
@@ -150,10 +152,12 @@ public class GraphMLImporterExporter implements Importer, Exporter {
                                final String graphName = graph.getAttributes().getNamedItem("id").getNodeValue();
                                final NodeList nodesAndEdges = graph.getChildNodes();
 
+                               List<String> fields = new ArrayList<String>();
+                           fields.add("importAssignedId");     
                                api.getGraph(graphName).storeObjectIndex(ChampObjectIndex.create()
                                                                                                                                                        .ofName("importAssignedId")
                                                                                                                                                        .onAnyType()
-                                                                                                                                                       .forField("importAssignedId")
+                                                                                                                                                       .forFields(fields)
                                                                                                                                                        .build());
 
                                for (int j = 0; j < nodesAndEdges.getLength(); j++) {