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 71292ce..36a3da0 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.
  * 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.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;
@@ -98,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);
@@ -151,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++) {