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.schemagen.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() {
43 if (this.tag != null) {
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);
57 if (this.tag == null) {
65 public String toString() {
66 return "Api{" + "path='" + path + '\'' + ", httpMethods=" + httpMethods + '}';
69 public void setPath(String path) {
73 public String getPath() {
77 public String getOperation() {
79 if (this.path != null) {
80 return this.path.replaceAll("[^a-zA-Z0-9\\-]", "-") + "-";
86 public static class HttpVerb {
88 private List<String> tags;
92 private String summary;
94 private String operationId;
96 private List<String> consumes;
98 private boolean consumerEnabled;
100 private List<String> produces;
102 private List<Response> responses;
104 private List<Map<String, Object>> parameters;
106 private Map<String, Object> bodyParameters;
108 private boolean bodyParametersEnabled;
110 private boolean parametersEnabled;
112 private String schemaLink;
114 private String schemaType;
116 private boolean hasReturnSchema;
118 private String returnSchemaLink;
120 private String returnSchemaObject;
122 public void setConsumerEnabled(boolean consumerEnabled) {
123 this.consumerEnabled = consumerEnabled;
126 public boolean isConsumerEnabled() {
127 return consumerEnabled;
130 public List<String> getTags() {
134 public void setTags(List<String> tags) {
138 public String getType() {
142 public void setType(String type) {
146 public String getSummary() {
150 public void setSummary(String summary) {
151 this.summary = summary;
154 public String getOperationId() {
158 public void setOperationId(String operationId) {
159 this.operationId = operationId;
162 public List<String> getConsumes() {
166 public void setConsumes(List<String> consumes) {
167 this.consumes = consumes;
170 public List<String> getProduces() {
174 public void setProduces(List<String> produces) {
175 this.produces = produces;
178 public List<Response> getResponses() {
182 public void setResponses(List<Response> responses) {
183 this.responses = responses;
186 public List<Map<String, Object>> getParameters() {
190 public void setParameters(List<Map<String, Object>> parameters) {
191 this.parameters = parameters;
195 public String toString() {
196 return "HttpVerb{" + "tags=" + getTags() + ", type='" + getType() + '\'' + ", summary='"
197 + getSummary() + '\'' + ", operationId='" + getOperationId() + '\'' + ", consumes="
198 + getConsumes() + ", produces=" + getProduces() + ", responses=" + getResponses()
199 + ", parameters=" + getParameters() + '}';
202 public void setParametersEnabled(boolean b) {
203 this.parametersEnabled = b;
206 public boolean isParametersEnabled() {
207 return parametersEnabled;
210 public boolean isBodyParametersEnabled() {
211 return bodyParametersEnabled;
214 public boolean isOpNotPatch() {
215 return type.equalsIgnoreCase("patch") ? false : true;
218 public void setBodyParametersEnabled(boolean bodyParametersEnabled) {
219 this.bodyParametersEnabled = bodyParametersEnabled;
222 public Map<String, Object> getBodyParameters() {
223 return bodyParameters;
226 public void setBodyParameters(Map<String, Object> bodyParameters) {
227 this.bodyParameters = bodyParameters;
230 public String getSchemaLink() {
234 public void setSchemaLink(String schemaLink) {
235 this.schemaLink = schemaLink;
238 public String getSchemaType() {
242 public void setSchemaType(String schemaType) {
243 this.schemaType = schemaType;
246 public boolean isHasReturnSchema() {
247 return hasReturnSchema;
250 public void setHasReturnSchema(boolean hasReturnSchema) {
251 this.hasReturnSchema = hasReturnSchema;
254 public String getReturnSchemaLink() {
255 return returnSchemaLink;
258 public void setReturnSchemaLink(String returnSchemaLink) {
259 this.returnSchemaLink = returnSchemaLink;
262 public String getReturnSchemaObject() {
263 return returnSchemaObject;
266 public void setReturnSchemaObject(String returnSchemaObject) {
267 this.returnSchemaObject = returnSchemaObject;
270 public static class Response {
272 private String responseCode;
274 private String description;
276 private String version;
278 public String getResponseCode() {
282 public void setResponseCode(String responseCode) {
283 this.responseCode = responseCode;
286 public String getDescription() {
290 public void setDescription(String description) {
291 this.description = description;
295 public String toString() {
296 return "Response{" + "responseCode='" + getResponseCode() + '\'' + ", description='"
297 + getDescription() + '\'' + '}';
300 public void setVersion(String version) {
301 this.version = version;