2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017-2018 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 package org.onap.aai.util.swagger;
22 import java.util.List;
29 private List<HttpVerb> httpMethods;
33 public List<HttpVerb> getHttpMethods() {
37 public void setHttpMethods(List<HttpVerb> httpMethods) {
38 this.httpMethods = httpMethods;
41 public String getTag(){
47 if(this.httpMethods != null){
48 if(this.httpMethods.size() != 0){
49 if(this.httpMethods.get(0).getTags() != null){
50 if(this.httpMethods.get(0).getTags().size() != 0){
51 this.tag = this.httpMethods.get(0).getTags().get(0);
65 public String toString() {
67 "path='" + path + '\'' +
68 ", httpMethods=" + httpMethods +
72 public void setPath(String path) {
76 public String getPath() {
80 public String getOperation(){
82 if(this.path != null){
83 return this.path.replaceAll("[^a-zA-Z0-9\\-]", "-") + "-";
89 public static class HttpVerb {
91 private List<String> tags;
95 private String summary;
97 private String operationId;
99 private List<String> consumes;
101 private boolean consumerEnabled;
103 private List<String> produces;
105 private List<Response> responses;
107 private List<Map<String, Object>> parameters;
109 private Map<String, Object> bodyParameters;
111 private boolean bodyParametersEnabled;
113 private boolean parametersEnabled;
115 private String schemaLink;
117 private String schemaType;
119 private boolean hasReturnSchema;
121 private String returnSchemaLink;
123 private String returnSchemaObject;
125 public void setConsumerEnabled(boolean consumerEnabled){
126 this.consumerEnabled = consumerEnabled;
129 public boolean isConsumerEnabled() {
130 return consumerEnabled;
134 public List<String> getTags() {
138 public void setTags(List<String> tags) {
142 public String getType() {
146 public void setType(String type) {
150 public String getSummary() {
154 public void setSummary(String summary) {
155 this.summary = summary;
158 public String getOperationId() {
162 public void setOperationId(String operationId) {
163 this.operationId = operationId;
166 public List<String> getConsumes() {
170 public void setConsumes(List<String> consumes) {
171 this.consumes = consumes;
174 public List<String> getProduces() {
178 public void setProduces(List<String> produces) {
179 this.produces = produces;
182 public List<Response> getResponses() {
186 public void setResponses(List<Response> responses) {
187 this.responses = responses;
190 public List<Map<String, Object>> getParameters() {
194 public void setParameters(List<Map<String, Object>> parameters) {
195 this.parameters = parameters;
199 public String toString() {
202 ", type='" + type + '\'' +
203 ", summary='" + summary + '\'' +
204 ", operationId='" + operationId + '\'' +
205 ", consumes=" + consumes +
206 ", produces=" + produces +
207 ", responses=" + responses +
208 ", parameters=" + parameters +
212 public void setParametersEnabled(boolean b) {
213 this.parametersEnabled = b;
216 public boolean isParametersEnabled() {
217 return parametersEnabled;
220 public boolean isBodyParametersEnabled() {
221 return bodyParametersEnabled;
223 public boolean isOpNotPatch() {
224 return type.equalsIgnoreCase("patch") ? false : true;
227 public void setBodyParametersEnabled(boolean bodyParametersEnabled) {
228 this.bodyParametersEnabled = bodyParametersEnabled;
231 public Map<String, Object> getBodyParameters() {
232 return bodyParameters;
235 public void setBodyParameters(Map<String, Object> bodyParameters) {
236 this.bodyParameters = bodyParameters;
239 public String getSchemaLink() {
243 public void setSchemaLink(String schemaLink) {
244 this.schemaLink = schemaLink;
247 public String getSchemaType() {
251 public void setSchemaType(String schemaType) {
252 this.schemaType = schemaType;
255 public boolean isHasReturnSchema() {
256 return hasReturnSchema;
259 public void setHasReturnSchema(boolean hasReturnSchema) {
260 this.hasReturnSchema = hasReturnSchema;
263 public String getReturnSchemaLink() {
264 return returnSchemaLink;
267 public void setReturnSchemaLink(String returnSchemaLink) {
268 this.returnSchemaLink = returnSchemaLink;
271 public String getReturnSchemaObject() {
272 return returnSchemaObject;
275 public void setReturnSchemaObject(String returnSchemaObject) {
276 this.returnSchemaObject = returnSchemaObject;
279 public static class Response {
281 private String responseCode;
283 private String description;
285 private String version;
287 public String getResponseCode() {
291 public void setResponseCode(String responseCode) {
292 this.responseCode = responseCode;
295 public String getDescription() {
299 public void setDescription(String description) {
300 this.description = description;
304 public String toString() {
306 "responseCode='" + responseCode + '\'' +
307 ", description='" + description + '\'' +
311 public void setVersion(String version) {
312 this.version = version;