2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.aai.serialization.engines;
23 import java.util.ArrayList;
24 import java.util.Iterator;
25 import java.util.List;
27 import org.apache.tinkerpop.gremlin.structure.Vertex;
28 import org.apache.tinkerpop.gremlin.structure.VertexProperty;
29 import org.openecomp.aai.dbmap.DBConnectionType;
30 import org.openecomp.aai.introspection.Loader;
31 import org.openecomp.aai.serialization.db.TitanGraphSingleton;
33 public class TitanDBEngine extends TransactionalGraphEngine {
36 * Instantiates a new titan DB engine.
38 * @param style the style
39 * @param loader the loader
41 public TitanDBEngine(QueryStyle style, DBConnectionType connectionType, Loader loader) {
42 super(style, loader, connectionType, TitanGraphSingleton.getInstance());
46 * Instantiates a new titan DB engine.
48 * @param style the style
49 * @param loader the loader
50 * @param connect the connect
52 public TitanDBEngine(QueryStyle style, Loader loader, boolean connect) {
55 this.singleton = TitanGraphSingleton.getInstance();
63 public boolean setListProperty(Vertex v, String name, List<?> objs) {
65 //clear out list full replace style
67 Iterator<VertexProperty<Object>> iterator = v.properties(name);
68 while (iterator.hasNext()) {
69 iterator.next().remove();
72 for (Object obj : objs) {
73 v.property(name, obj);
83 public List<Object> getListProperty(Vertex v, String name) {
85 List<Object> result = new ArrayList<Object>();
87 Iterator<VertexProperty<Object>> iterator = v.properties(name);
89 while (iterator.hasNext()) {
90 result.add(iterator.next().value());
93 if (result.size() == 0) {