2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 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=========================================================
20 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 package org.onap.aai.serialization.engines;
24 import java.util.ArrayList;
25 import java.util.Iterator;
26 import java.util.List;
28 import org.apache.tinkerpop.gremlin.structure.Vertex;
29 import org.apache.tinkerpop.gremlin.structure.VertexProperty;
30 import org.onap.aai.dbmap.DBConnectionType;
31 import org.onap.aai.introspection.Loader;
32 import org.onap.aai.serialization.db.TitanGraphSingleton;
34 public class TitanDBEngine extends TransactionalGraphEngine {
37 * Instantiates a new titan DB engine.
39 * @param style the style
40 * @param loader the loader
42 public TitanDBEngine(QueryStyle style, DBConnectionType connectionType, Loader loader) {
43 super(style, loader, connectionType, TitanGraphSingleton.getInstance());
47 * Instantiates a new titan DB engine.
49 * @param style the style
50 * @param loader the loader
51 * @param connect the connect
53 public TitanDBEngine(QueryStyle style, Loader loader, boolean connect) {
56 this.singleton = TitanGraphSingleton.getInstance();
64 public boolean setListProperty(Vertex v, String name, List<?> objs) {
66 //clear out list full replace style
68 Iterator<VertexProperty<Object>> iterator = v.properties(name);
69 while (iterator.hasNext()) {
70 iterator.next().remove();
73 for (Object obj : objs) {
74 v.property(name, obj);
84 public List<Object> getListProperty(Vertex v, String name) {
86 List<Object> result = new ArrayList<Object>();
88 Iterator<VertexProperty<Object>> iterator = v.properties(name);
90 while (iterator.hasNext()) {
91 result.add(iterator.next().value());
94 if (result.size() == 0) {