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.extensions;
24 import org.apache.tinkerpop.gremlin.structure.Graph;
25 import org.apache.tinkerpop.gremlin.structure.Vertex;
26 import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
27 import org.onap.aai.domain.responseMessage.AAIResponseMessages;
28 import org.onap.aai.introspection.Loader;
29 import org.onap.aai.rest.db.DBRequest;
30 import org.onap.aai.rest.db.HttpEntry;
31 import org.onap.aai.serialization.engines.TransactionalGraphEngine;
33 import javax.servlet.http.HttpServletRequest;
34 import javax.ws.rs.core.HttpHeaders;
35 import javax.ws.rs.core.UriInfo;
36 import java.lang.reflect.Method;
37 import java.util.ArrayList;
38 import java.util.HashMap;
40 public class AAIExtensionMap {
41 // =======================================================================
43 // =======================================================================
44 // message | java.lang.String (RW)
45 // ----------------------------------------------------------------------
46 // templateVars | java.lang.ArrayList<String> (RW)
47 // -----------------------------------------------------------------------
48 // preExtException | java.lang.Exception (RW)
49 // -----------------------------------------------------------------------
50 // preExtErrorCallback | java.lang.reflect.Method (RW)
51 // -----------------------------------------------------------------------
52 // postExtException | java.lang.Exception (RW)
53 // -----------------------------------------------------------------------
54 // postExtErrorCallback | java.lang.reflect.Method (RW)
55 // -----------------------------------------------------------------------
56 // servletRequest | javax.servlet.http.HttpServletRequest (RO)
57 // -----------------------------------------------------------------------
58 // headers | javax.ws.rs.core.HttpHeaders (RO)
59 // -----------------------------------------------------------------------
60 // objFromRequestType | String (ex. ?org.onap.aai.domain.yang.Vce?) (RO)
61 // -----------------------------------------------------------------------
62 // objFromRequest | $TYPE {ObjFromRequestType) (RO)
63 // -----------------------------------------------------------------------
64 // preExtFailOnError | java.lang.Boolean (RW)
65 // -----------------------------------------------------------------------
66 // postExtFailOnError | java.lang.Boolean (RW)
67 // -----------------------------------------------------------------------
68 // preExtSkipErrorCallback | java.lang.Boolean (RW)
69 // -----------------------------------------------------------------------
70 // postExtSkipErrorCallback | java.lang.Boolean (RW)
71 // -----------------------------------------------------------------------
72 // graph | com.thinkaurelius.titan.core.TitanGraph (RW)
73 // -----------------------------------------------------------------------
74 // objectFromResponse | Object
75 // -----------------------------------------------------------------------
76 // precheckAddedList | java.util.HashMap
77 // -----------------------------------------------------------------------
78 // precheckResponseMessages | org.onap.aai.extensions.AAIResponseMessages
79 // =======================================================================
81 private String message;
82 private ArrayList<String> templateVars;
83 private Exception preExtException;
84 private Exception postExtException;
85 private Method preExtErrorCallback;
86 private Method postExtErrorCallback;
87 private HttpServletRequest servletRequest;
88 private HttpHeaders httpHeaders;
89 private String objectFromRequestType;
90 private Object objectFromRequest;
91 private boolean preExtFailOnError = true;
92 private boolean postExtFailOnError = true;
93 private boolean preExtSkipErrorCallback = true;
94 private boolean postExtSkipErrorCallback = true;
95 private String fromAppId;
96 private String transId;
98 private Object objectFromResponse;
99 private HashMap<String, Object> lookupHashMap;
100 private HashMap<String, ArrayList<String>> precheckAddedList;
101 private AAIResponseMessages precheckResponseMessages;
102 private HashMap<String, Object> topology;
103 private HashMap<String, Vertex> vertexCache;
104 private String baseObject;
105 private String namespace;
106 private String fullResourceName;
107 private String topObjectFullResourceName;
109 private String notificationUri;
110 private String apiVersion;
111 private long startTime;
112 private long checkpointTime;
113 private DynamicJAXBContext jaxbContext;
114 private String objectFromResponseType;
115 private String eventAction;
116 private TransactionalGraphEngine dbEngine;
117 private Loader loader;
118 private UriInfo uriInfo;
119 private DBRequest dbRequest;
120 private HttpEntry httpEntry;
124 * @param _message the new message
126 public void setMessage(String _message) {
127 this.message = _message;
131 * Sets the template vars.
133 * @param _templateVars the new template vars
135 public void setTemplateVars(ArrayList<String> _templateVars) {
136 this.templateVars = _templateVars;
140 * Sets the pre ext exception.
142 * @param _exception the new pre ext exception
144 public void setPreExtException(Exception _exception) {
145 this.preExtException = _exception;
149 * Sets the pre ext error callback.
151 * @param _errorCallback the new pre ext error callback
153 public void setPreExtErrorCallback(Method _errorCallback) {
154 this.preExtErrorCallback = _errorCallback;
158 * Sets the post ext exception.
160 * @param _exception the new post ext exception
162 public void setPostExtException(Exception _exception) {
163 this.postExtException = _exception;
167 * Sets the post ext error callback.
169 * @param _errorCallback the new post ext error callback
171 public void setPostExtErrorCallback(Method _errorCallback) {
172 this.postExtErrorCallback = _errorCallback;
176 * Sets the servlet request.
178 * @param _httpServletRequest the new servlet request
180 public void setServletRequest(HttpServletRequest _httpServletRequest) {
181 this.servletRequest = _httpServletRequest;
185 * Sets the http headers.
187 * @param _httpHeaders the new http headers
189 public void setHttpHeaders(HttpHeaders _httpHeaders) {
190 this.httpHeaders = _httpHeaders;
194 * Sets the object from request type.
196 * @param _objectFromRequestType the new object from request type
198 public void setObjectFromRequestType(String _objectFromRequestType) {
199 this.objectFromRequestType = _objectFromRequestType;
203 * Sets the object from request.
205 * @param _objectFromRequest the new object from request
207 public void setObjectFromRequest(Object _objectFromRequest) {
208 this.objectFromRequest = _objectFromRequest;
212 * Sets the object from response type.
214 * @param resourceClassName the new object from response type
216 public void setObjectFromResponseType(String resourceClassName) {
217 // TODO Auto-generated method stub
218 this.objectFromResponseType = resourceClassName;
222 * Gets the object from response type.
224 * @return the object from response type
226 public String getObjectFromResponseType() {
227 // TODO Auto-generated method stub
228 return this.objectFromResponseType;
232 * Sets the pre ext fail on error.
234 * @param _failOnError the new pre ext fail on error
236 public void setPreExtFailOnError(boolean _failOnError) {
237 this.preExtFailOnError = _failOnError;
241 * Sets the post ext fail on error.
243 * @param _failOnError the new post ext fail on error
245 public void setPostExtFailOnError(boolean _failOnError) {
246 this.postExtFailOnError = _failOnError;
252 * @return the message
254 public String getMessage() {
259 * Gets the template vars.
261 * @return the template vars
263 public ArrayList<String> getTemplateVars() {
264 if (this.templateVars == null) {
265 this.templateVars = new ArrayList<String>();
267 return this.templateVars;
271 * Gets the pre ext exception.
273 * @return the pre ext exception
275 public Exception getPreExtException() {
276 return this.preExtException;
280 * Gets the pre ext error callback.
282 * @return the pre ext error callback
284 public Method getPreExtErrorCallback() {
285 return this.preExtErrorCallback;
289 * Gets the post ext exception.
291 * @return the post ext exception
293 public Exception getPostExtException() {
294 return this.postExtException;
298 * Gets the post ext error callback.
300 * @return the post ext error callback
302 public Method getPostExtErrorCallback() {
303 return this.postExtErrorCallback;
307 * Gets the http servlet request.
309 * @return the http servlet request
311 public HttpServletRequest getHttpServletRequest() {
312 return this.servletRequest;
316 * Gets the http headers.
318 * @return the http headers
320 public HttpHeaders getHttpHeaders() {
321 return this.httpHeaders;
325 * Gets the object from request type.
327 * @return the object from request type
329 public String getObjectFromRequestType() {
330 return this.objectFromRequestType;
334 * Gets the object from request.
336 * @return the object from request
338 public Object getObjectFromRequest() {
339 return this.objectFromRequest;
343 * Gets the pre ext fail on error.
345 * @return the pre ext fail on error
347 public boolean getPreExtFailOnError() {
348 return this.preExtFailOnError;
352 * Gets the post ext fail on error.
354 * @return the post ext fail on error
356 public boolean getPostExtFailOnError() {
357 return this.postExtFailOnError;
361 * Gets the from app id.
363 * @return the from app id
365 public String getFromAppId() {
366 return this.fromAppId;
370 * Sets the from app id.
372 * @param fromAppId the new from app id
374 public void setFromAppId(String fromAppId) {
375 this.fromAppId = fromAppId;
381 * @return the trans id
383 public String getTransId() {
390 * @param transId the new trans id
392 public void setTransId(String transId) {
393 this.transId = transId;
397 * Gets the pre ext skip error callback.
399 * @return the pre ext skip error callback
401 public boolean getPreExtSkipErrorCallback() {
402 return preExtSkipErrorCallback;
406 * Sets the pre ext skip error callback.
408 * @param preExtSkipErrorCallback the new pre ext skip error callback
410 public void setPreExtSkipErrorCallback(boolean preExtSkipErrorCallback) {
411 this.preExtSkipErrorCallback = preExtSkipErrorCallback;
415 * Gets the post ext skip error callback.
417 * @return the post ext skip error callback
419 public boolean getPostExtSkipErrorCallback() {
420 return postExtSkipErrorCallback;
424 * Sets the post ext skip error callback.
426 * @param postExtSkipErrorCallback the new post ext skip error callback
428 public void setPostExtSkipErrorCallback(boolean postExtSkipErrorCallback) {
429 this.postExtSkipErrorCallback = postExtSkipErrorCallback;
437 public Graph getGraph() {
444 * @param graph the new graph
446 public void setGraph(Graph graph) {
451 * Gets the object from response.
453 * @return the object from response
455 public Object getObjectFromResponse() {
456 return objectFromResponse;
460 * Sets the object from response.
462 * @param objectFromResponse the new object from response
464 public void setObjectFromResponse(Object objectFromResponse) {
465 this.objectFromResponse = objectFromResponse;
469 * Gets the lookup hash map.
471 * @return the lookup hash map
473 public HashMap<String, Object> getLookupHashMap() {
474 if (this.lookupHashMap == null) {
475 this.lookupHashMap = new HashMap<String, Object>();
477 return this.lookupHashMap;
481 * Sets the lookup hash map.
483 * @param lookupHashMap the lookup hash map
485 public void setLookupHashMap(HashMap<String, Object> lookupHashMap) {
486 this.lookupHashMap = lookupHashMap;
490 * Gets the precheck added list.
492 * @return the precheck added list
494 public HashMap<String, ArrayList<String>> getPrecheckAddedList() {
495 if (this.precheckAddedList == null) {
496 this.precheckAddedList = new HashMap<String, ArrayList<String>>();
498 return precheckAddedList;
502 * Sets the precheck added list.
504 * @param precheckAddedList the precheck added list
506 public void setPrecheckAddedList(HashMap<String, ArrayList<String>> precheckAddedList) {
507 this.precheckAddedList = precheckAddedList;
511 * Gets the precheck response messages.
513 * @return the precheck response messages
515 public AAIResponseMessages getPrecheckResponseMessages() {
516 if (this.precheckResponseMessages == null) {
517 this.precheckResponseMessages = new AAIResponseMessages();
519 return precheckResponseMessages;
523 * Sets the precheck response messages.
525 * @param precheckResponseData the new precheck response messages
527 public void setPrecheckResponseMessages(AAIResponseMessages precheckResponseData) {
528 this.precheckResponseMessages = precheckResponseData;
534 * @return the topology
536 public HashMap<String, Object> getTopology() {
537 if (this.topology == null) {
538 this.topology = new HashMap<String, Object>();
544 * Gets the vertex cache.
546 * @return the vertex cache
548 public HashMap<String, Vertex> getVertexCache() {
549 if (this.vertexCache == null) {
550 this.vertexCache = new HashMap<String, Vertex>();
556 * Gets the base object.
558 * @return the base object
560 public String getBaseObject() {
565 * Sets the base object.
567 * @param baseObject the new base object
569 public void setBaseObject(String baseObject) {
570 this.baseObject = baseObject;
574 * Gets the namespace.
576 * @return the namespace
578 public String getNamespace() {
583 * Sets the namespace.
585 * @param namespace the new namespace
587 public void setNamespace(String namespace) {
588 this.namespace = namespace;
592 * Gets the full resource name.
594 * @return the full resource name
596 public String getFullResourceName() {
597 return fullResourceName;
601 * Sets the full resource name.
603 * @param fullResourceName the new full resource name
605 public void setFullResourceName(String fullResourceName) {
606 this.fullResourceName = fullResourceName;
610 * Gets the top object full resource name.
612 * @return the top object full resource name
614 public String getTopObjectFullResourceName() {
615 return topObjectFullResourceName;
619 * Sets the top object full resource name.
621 * @param topObjectFullResourceName the new top object full resource name
623 public void setTopObjectFullResourceName(String topObjectFullResourceName) {
624 this.topObjectFullResourceName = topObjectFullResourceName;
632 public String getUri() {
639 * @param uri the new uri
641 public void setUri(String uri) {
646 * Gets the api version.
648 * @return the api version
650 public String getApiVersion() {
655 * Sets the api version.
657 * @param apiVersion the new api version
659 public void setApiVersion(String apiVersion) {
660 this.apiVersion = apiVersion;
664 * Sets the notification uri.
666 * @param uri the new notification uri
668 public void setNotificationUri(String uri) {
669 this.notificationUri = uri;
674 * Gets the notification uri.
676 * @return the notification uri
678 public String getNotificationUri() {
679 return this.notificationUri;
684 * Gets the start time.
686 * @return the start time
688 public long getStartTime() {
693 * Sets the start time.
695 * @param startTime the new start time
697 public void setStartTime(long startTime) {
698 this.startTime = startTime;
702 * Gets the checkpoint time.
704 * @return the checkpoint time
706 public long getCheckpointTime() {
707 return checkpointTime;
711 * Sets the checkpoint time.
713 * @param checkpointTime the new checkpoint time
715 public void setCheckpointTime(long checkpointTime) {
716 this.checkpointTime = checkpointTime;
720 * Gets the jaxb context.
722 * @return the jaxb context
724 public DynamicJAXBContext getJaxbContext() {
729 * Sets the jaxb context.
731 * @param jaxbContext the new jaxb context
733 public void setJaxbContext(DynamicJAXBContext jaxbContext) {
734 this.jaxbContext = jaxbContext;
738 * Sets the event action.
740 * @param eventAction the new event action
742 public void setEventAction(String eventAction) {
743 this.eventAction = eventAction;
747 * Gets the event action.
749 * @return the event action
751 public String getEventAction() {
752 return this.eventAction;
756 * Gets the transactional graph engine.
758 * @return the transactional graph engine
760 public TransactionalGraphEngine getTransactionalGraphEngine() {
761 return this.dbEngine;
766 * Sets the transactional graph engine.
768 * @param dbEngine the new transactional graph engine
770 public void setTransactionalGraphEngine(TransactionalGraphEngine dbEngine) {
771 this.dbEngine = dbEngine;
780 public Loader getLoader() {
787 * @param loader the new loader
789 public void setLoader(Loader loader) {
790 this.loader = loader;
796 * @return the uri info
798 public UriInfo getUriInfo() {
805 * @param uriInfo the new uri info
807 public void setUriInfo(UriInfo uriInfo) {
808 this.uriInfo = uriInfo;
811 public DBRequest getDbRequest() {
815 public void setDbRequest(DBRequest dbRequest) {
816 this.dbRequest = dbRequest;
819 public HttpEntry getHttpEntry() {
823 public void setHttpEntry(HttpEntry httpEntry) {
824 this.httpEntry = httpEntry;