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;
30 import org.openecomp.aai.dbmap.DBConnectionType;
31 import org.openecomp.aai.introspection.Loader;
32 import org.openecomp.aai.serialization.db.TitanGraphSingleton;
33 import com.thinkaurelius.titan.core.TitanVertex;
35 public class TitanDBEngine extends TransactionalGraphEngine {
38 * Instantiates a new titan DB engine.
40 * @param style the style
41 * @param loader the loader
43 public TitanDBEngine(QueryStyle style, DBConnectionType connectionType, Loader loader) {
44 super(style, loader, connectionType, TitanGraphSingleton.getInstance());
48 * Instantiates a new titan DB engine.
50 * @param style the style
51 * @param loader the loader
52 * @param connect the connect
54 public TitanDBEngine(QueryStyle style, Loader loader, boolean connect) {
57 this.singleton = TitanGraphSingleton.getInstance();
65 public boolean setListProperty(Vertex v, String name, List<?> objs) {
67 //clear out list full replace style
69 Iterator<VertexProperty<Object>> iterator = v.properties(name);
70 while (iterator.hasNext()) {
71 iterator.next().remove();
74 for (Object obj : objs) {
75 v.property(name, obj);
85 public List<Object> getListProperty(Vertex v, String name) {
87 List<Object> result = new ArrayList<Object>();
89 Iterator<VertexProperty<Object>> iterator = v.properties(name);
91 while (iterator.hasNext()) {
92 result.add(iterator.next().value());
95 if (result.size() == 0) {