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.extensions;
22 import org.apache.tinkerpop.gremlin.structure.Graph;
23 import org.apache.tinkerpop.gremlin.structure.Vertex;
24 import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
25 import org.onap.aai.domain.responseMessage.AAIResponseMessages;
26 import org.onap.aai.introspection.Loader;
27 import org.onap.aai.rest.db.DBRequest;
28 import org.onap.aai.rest.db.HttpEntry;
29 import org.onap.aai.serialization.engines.TransactionalGraphEngine;
31 import javax.servlet.http.HttpServletRequest;
32 import javax.ws.rs.core.HttpHeaders;
33 import javax.ws.rs.core.UriInfo;
34 import java.lang.reflect.Method;
35 import java.util.ArrayList;
36 import java.util.HashMap;
38 public class AAIExtensionMap {
39 // =======================================================================
41 // =======================================================================
42 // message | java.lang.String (RW)
43 // ----------------------------------------------------------------------
44 // templateVars | java.lang.ArrayList<String> (RW)
45 // -----------------------------------------------------------------------
46 // preExtException | java.lang.Exception (RW)
47 // -----------------------------------------------------------------------
48 // preExtErrorCallback | java.lang.reflect.Method (RW)
49 // -----------------------------------------------------------------------
50 // postExtException | java.lang.Exception (RW)
51 // -----------------------------------------------------------------------
52 // postExtErrorCallback | java.lang.reflect.Method (RW)
53 // -----------------------------------------------------------------------
54 // servletRequest | javax.servlet.http.HttpServletRequest (RO)
55 // -----------------------------------------------------------------------
56 // headers | javax.ws.rs.core.HttpHeaders (RO)
57 // -----------------------------------------------------------------------
58 // objFromRequestType | String (ex. ?org.onap.aai.domain.yang.Vce?) (RO)
59 // -----------------------------------------------------------------------
60 // objFromRequest | $TYPE {ObjFromRequestType) (RO)
61 // -----------------------------------------------------------------------
62 // preExtFailOnError | java.lang.Boolean (RW)
63 // -----------------------------------------------------------------------
64 // postExtFailOnError | java.lang.Boolean (RW)
65 // -----------------------------------------------------------------------
66 // preExtSkipErrorCallback | java.lang.Boolean (RW)
67 // -----------------------------------------------------------------------
68 // postExtSkipErrorCallback | java.lang.Boolean (RW)
69 // -----------------------------------------------------------------------
70 // graph | com.thinkaurelius.titan.core.TitanGraph (RW)
71 // -----------------------------------------------------------------------
72 // objectFromResponse | Object
73 // -----------------------------------------------------------------------
74 // precheckAddedList | java.util.HashMap
75 // -----------------------------------------------------------------------
76 // precheckResponseMessages | org.onap.aai.extensions.AAIResponseMessages
77 // =======================================================================
79 private String message;
80 private ArrayList<String> templateVars;
81 private Exception preExtException;
82 private Exception postExtException;
83 private Method preExtErrorCallback;
84 private Method postExtErrorCallback;
85 private HttpServletRequest servletRequest;
86 private HttpHeaders httpHeaders;
87 private String objectFromRequestType;
88 private Object objectFromRequest;
89 private boolean preExtFailOnError = true;
90 private boolean postExtFailOnError = true;
91 private boolean preExtSkipErrorCallback = true;
92 private boolean postExtSkipErrorCallback = true;
93 private String fromAppId;
94 private String transId;
96 private Object objectFromResponse;
97 private HashMap<String, Object> lookupHashMap;
98 private HashMap<String, ArrayList<String>> precheckAddedList;
99 private AAIResponseMessages precheckResponseMessages;
100 private HashMap<String, Object> topology;
101 private HashMap<String, Vertex> vertexCache;
102 private String baseObject;
103 private String namespace;
104 private String fullResourceName;
105 private String topObjectFullResourceName;
107 private String notificationUri;
108 private String apiVersion;
109 private long startTime;
110 private long checkpointTime;
111 private DynamicJAXBContext jaxbContext;
112 private String objectFromResponseType;
113 private String eventAction;
114 private TransactionalGraphEngine dbEngine;
115 private Loader loader;
116 private UriInfo uriInfo;
117 private DBRequest dbRequest;
118 private HttpEntry httpEntry;
122 * @param _message the new message
124 public void setMessage(String _message) {
125 this.message = _message;
129 * Sets the template vars.
131 * @param _templateVars the new template vars
133 public void setTemplateVars(ArrayList<String> _templateVars) {
134 this.templateVars = _templateVars;
138 * Sets the pre ext exception.
140 * @param _exception the new pre ext exception
142 public void setPreExtException(Exception _exception) {
143 this.preExtException = _exception;
147 * Sets the pre ext error callback.
149 * @param _errorCallback the new pre ext error callback
151 public void setPreExtErrorCallback(Method _errorCallback) {
152 this.preExtErrorCallback = _errorCallback;
156 * Sets the post ext exception.
158 * @param _exception the new post ext exception
160 public void setPostExtException(Exception _exception) {
161 this.postExtException = _exception;
165 * Sets the post ext error callback.
167 * @param _errorCallback the new post ext error callback
169 public void setPostExtErrorCallback(Method _errorCallback) {
170 this.postExtErrorCallback = _errorCallback;
174 * Sets the servlet request.
176 * @param _httpServletRequest the new servlet request
178 public void setServletRequest(HttpServletRequest _httpServletRequest) {
179 this.servletRequest = _httpServletRequest;
183 * Sets the http headers.
185 * @param _httpHeaders the new http headers
187 public void setHttpHeaders(HttpHeaders _httpHeaders) {
188 this.httpHeaders = _httpHeaders;
192 * Sets the object from request type.
194 * @param _objectFromRequestType the new object from request type
196 public void setObjectFromRequestType(String _objectFromRequestType) {
197 this.objectFromRequestType = _objectFromRequestType;
201 * Sets the object from request.
203 * @param _objectFromRequest the new object from request
205 public void setObjectFromRequest(Object _objectFromRequest) {
206 this.objectFromRequest = _objectFromRequest;
210 * Sets the object from response type.
212 * @param resourceClassName the new object from response type
214 public void setObjectFromResponseType(String resourceClassName) {
215 // TODO Auto-generated method stub
216 this.objectFromResponseType = resourceClassName;
220 * Gets the object from response type.
222 * @return the object from response type
224 public String getObjectFromResponseType() {
225 // TODO Auto-generated method stub
226 return this.objectFromResponseType;
230 * Sets the pre ext fail on error.
232 * @param _failOnError the new pre ext fail on error
234 public void setPreExtFailOnError(boolean _failOnError) {
235 this.preExtFailOnError = _failOnError;
239 * Sets the post ext fail on error.
241 * @param _failOnError the new post ext fail on error
243 public void setPostExtFailOnError(boolean _failOnError) {
244 this.postExtFailOnError = _failOnError;
250 * @return the message
252 public String getMessage() {
257 * Gets the template vars.
259 * @return the template vars
261 public ArrayList<String> getTemplateVars() {
262 if (this.templateVars == null) {
263 this.templateVars = new ArrayList<String>();
265 return this.templateVars;
269 * Gets the pre ext exception.
271 * @return the pre ext exception
273 public Exception getPreExtException() {
274 return this.preExtException;
278 * Gets the pre ext error callback.
280 * @return the pre ext error callback
282 public Method getPreExtErrorCallback() {
283 return this.preExtErrorCallback;
287 * Gets the post ext exception.
289 * @return the post ext exception
291 public Exception getPostExtException() {
292 return this.postExtException;
296 * Gets the post ext error callback.
298 * @return the post ext error callback
300 public Method getPostExtErrorCallback() {
301 return this.postExtErrorCallback;
305 * Gets the http servlet request.
307 * @return the http servlet request
309 public HttpServletRequest getHttpServletRequest() {
310 return this.servletRequest;
314 * Gets the http headers.
316 * @return the http headers
318 public HttpHeaders getHttpHeaders() {
319 return this.httpHeaders;
323 * Gets the object from request type.
325 * @return the object from request type
327 public String getObjectFromRequestType() {
328 return this.objectFromRequestType;
332 * Gets the object from request.
334 * @return the object from request
336 public Object getObjectFromRequest() {
337 return this.objectFromRequest;
341 * Gets the pre ext fail on error.
343 * @return the pre ext fail on error
345 public boolean getPreExtFailOnError() {
346 return this.preExtFailOnError;
350 * Gets the post ext fail on error.
352 * @return the post ext fail on error
354 public boolean getPostExtFailOnError() {
355 return this.postExtFailOnError;
359 * Gets the from app id.
361 * @return the from app id
363 public String getFromAppId() {
364 return this.fromAppId;
368 * Sets the from app id.
370 * @param fromAppId the new from app id
372 public void setFromAppId(String fromAppId) {
373 this.fromAppId = fromAppId;
379 * @return the trans id
381 public String getTransId() {
388 * @param transId the new trans id
390 public void setTransId(String transId) {
391 this.transId = transId;
395 * Gets the pre ext skip error callback.
397 * @return the pre ext skip error callback
399 public boolean getPreExtSkipErrorCallback() {
400 return preExtSkipErrorCallback;
404 * Sets the pre ext skip error callback.
406 * @param preExtSkipErrorCallback the new pre ext skip error callback
408 public void setPreExtSkipErrorCallback(boolean preExtSkipErrorCallback) {
409 this.preExtSkipErrorCallback = preExtSkipErrorCallback;
413 * Gets the post ext skip error callback.
415 * @return the post ext skip error callback
417 public boolean getPostExtSkipErrorCallback() {
418 return postExtSkipErrorCallback;
422 * Sets the post ext skip error callback.
424 * @param postExtSkipErrorCallback the new post ext skip error callback
426 public void setPostExtSkipErrorCallback(boolean postExtSkipErrorCallback) {
427 this.postExtSkipErrorCallback = postExtSkipErrorCallback;
435 public Graph getGraph() {
442 * @param graph the new graph
444 public void setGraph(Graph graph) {
449 * Gets the object from response.
451 * @return the object from response
453 public Object getObjectFromResponse() {
454 return objectFromResponse;
458 * Sets the object from response.
460 * @param objectFromResponse the new object from response
462 public void setObjectFromResponse(Object objectFromResponse) {
463 this.objectFromResponse = objectFromResponse;
467 * Gets the lookup hash map.
469 * @return the lookup hash map
471 public HashMap<String, Object> getLookupHashMap() {
472 if (this.lookupHashMap == null) {
473 this.lookupHashMap = new HashMap<String, Object>();
475 return this.lookupHashMap;
479 * Sets the lookup hash map.
481 * @param lookupHashMap the lookup hash map
483 public void setLookupHashMap(HashMap<String, Object> lookupHashMap) {
484 this.lookupHashMap = lookupHashMap;
488 * Gets the precheck added list.
490 * @return the precheck added list
492 public HashMap<String, ArrayList<String>> getPrecheckAddedList() {
493 if (this.precheckAddedList == null) {
494 this.precheckAddedList = new HashMap<String, ArrayList<String>>();
496 return precheckAddedList;
500 * Sets the precheck added list.
502 * @param precheckAddedList the precheck added list
504 public void setPrecheckAddedList(HashMap<String, ArrayList<String>> precheckAddedList) {
505 this.precheckAddedList = precheckAddedList;
509 * Gets the precheck response messages.
511 * @return the precheck response messages
513 public AAIResponseMessages getPrecheckResponseMessages() {
514 if (this.precheckResponseMessages == null) {
515 this.precheckResponseMessages = new AAIResponseMessages();
517 return precheckResponseMessages;
521 * Sets the precheck response messages.
523 * @param precheckResponseData the new precheck response messages
525 public void setPrecheckResponseMessages(AAIResponseMessages precheckResponseData) {
526 this.precheckResponseMessages = precheckResponseData;
532 * @return the topology
534 public HashMap<String, Object> getTopology() {
535 if (this.topology == null) {
536 this.topology = new HashMap<String, Object>();
542 * Gets the vertex cache.
544 * @return the vertex cache
546 public HashMap<String, Vertex> getVertexCache() {
547 if (this.vertexCache == null) {
548 this.vertexCache = new HashMap<String, Vertex>();
554 * Gets the base object.
556 * @return the base object
558 public String getBaseObject() {
563 * Sets the base object.
565 * @param baseObject the new base object
567 public void setBaseObject(String baseObject) {
568 this.baseObject = baseObject;
572 * Gets the namespace.
574 * @return the namespace
576 public String getNamespace() {
581 * Sets the namespace.
583 * @param namespace the new namespace
585 public void setNamespace(String namespace) {
586 this.namespace = namespace;
590 * Gets the full resource name.
592 * @return the full resource name
594 public String getFullResourceName() {
595 return fullResourceName;
599 * Sets the full resource name.
601 * @param fullResourceName the new full resource name
603 public void setFullResourceName(String fullResourceName) {
604 this.fullResourceName = fullResourceName;
608 * Gets the top object full resource name.
610 * @return the top object full resource name
612 public String getTopObjectFullResourceName() {
613 return topObjectFullResourceName;
617 * Sets the top object full resource name.
619 * @param topObjectFullResourceName the new top object full resource name
621 public void setTopObjectFullResourceName(String topObjectFullResourceName) {
622 this.topObjectFullResourceName = topObjectFullResourceName;
630 public String getUri() {
637 * @param uri the new uri
639 public void setUri(String uri) {
644 * Gets the api version.
646 * @return the api version
648 public String getApiVersion() {
653 * Sets the api version.
655 * @param apiVersion the new api version
657 public void setApiVersion(String apiVersion) {
658 this.apiVersion = apiVersion;
662 * Sets the notification uri.
664 * @param uri the new notification uri
666 public void setNotificationUri(String uri) {
667 this.notificationUri = uri;
672 * Gets the notification uri.
674 * @return the notification uri
676 public String getNotificationUri() {
677 return this.notificationUri;
682 * Gets the start time.
684 * @return the start time
686 public long getStartTime() {
691 * Sets the start time.
693 * @param startTime the new start time
695 public void setStartTime(long startTime) {
696 this.startTime = startTime;
700 * Gets the checkpoint time.
702 * @return the checkpoint time
704 public long getCheckpointTime() {
705 return checkpointTime;
709 * Sets the checkpoint time.
711 * @param checkpointTime the new checkpoint time
713 public void setCheckpointTime(long checkpointTime) {
714 this.checkpointTime = checkpointTime;
718 * Gets the jaxb context.
720 * @return the jaxb context
722 public DynamicJAXBContext getJaxbContext() {
727 * Sets the jaxb context.
729 * @param jaxbContext the new jaxb context
731 public void setJaxbContext(DynamicJAXBContext jaxbContext) {
732 this.jaxbContext = jaxbContext;
736 * Sets the event action.
738 * @param eventAction the new event action
740 public void setEventAction(String eventAction) {
741 this.eventAction = eventAction;
745 * Gets the event action.
747 * @return the event action
749 public String getEventAction() {
750 return this.eventAction;
754 * Gets the transactional graph engine.
756 * @return the transactional graph engine
758 public TransactionalGraphEngine getTransactionalGraphEngine() {
759 return this.dbEngine;
764 * Sets the transactional graph engine.
766 * @param dbEngine the new transactional graph engine
768 public void setTransactionalGraphEngine(TransactionalGraphEngine dbEngine) {
769 this.dbEngine = dbEngine;
778 public Loader getLoader() {
785 * @param loader the new loader
787 public void setLoader(Loader loader) {
788 this.loader = loader;
794 * @return the uri info
796 public UriInfo getUriInfo() {
803 * @param uriInfo the new uri info
805 public void setUriInfo(UriInfo uriInfo) {
806 this.uriInfo = uriInfo;
809 public DBRequest getDbRequest() {
813 public void setDbRequest(DBRequest dbRequest) {
814 this.dbRequest = dbRequest;
817 public HttpEntry getHttpEntry() {
821 public void setHttpEntry(HttpEntry httpEntry) {
822 this.httpEntry = httpEntry;