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.mso.client.aai.entities;
23 import java.io.UnsupportedEncodingException;
24 import java.util.ArrayList;
25 import java.util.List;
27 import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
29 import com.fasterxml.jackson.annotation.JsonInclude;
32 @JsonInclude(JsonInclude.Include.NON_NULL)
33 public class CustomQuery {
35 private List<String> start;
37 private String gremlin;
39 public String getGremlin() {
43 public void setGremlin(String gremlin) {
44 this.gremlin = gremlin;
48 public CustomQuery(List<AAIResourceUri> start){
52 public CustomQuery(List<AAIResourceUri> start, String query){
54 this.query= "query/" + query;
57 public CustomQuery(String gremlin) throws UnsupportedEncodingException{
61 public List<String> getStart() {
65 public void setStart(List<AAIResourceUri> start) {
66 this.start = this.mapUris(start);
69 public String getQuery() {
73 public void setQuery(String query) {
77 private List<String> mapUris(List<AAIResourceUri> uris) {
78 final List<String> result = new ArrayList<>();
79 uris.stream().map(item -> item.build().toString()).forEach(result::add);