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=========================================================
21 package org.onap.aai.extensions;
23 import java.lang.reflect.Method;
24 import java.util.ArrayList;
25 import java.util.HashMap;
27 import javax.servlet.http.HttpServletRequest;
28 import javax.ws.rs.core.HttpHeaders;
29 import javax.ws.rs.core.UriInfo;
31 import org.apache.tinkerpop.gremlin.structure.Graph;
32 import org.apache.tinkerpop.gremlin.structure.Vertex;
33 import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
34 import org.onap.aai.domain.responseMessage.AAIResponseMessages;
35 import org.onap.aai.introspection.Loader;
36 import org.onap.aai.rest.db.DBRequest;
37 import org.onap.aai.rest.db.HttpEntry;
38 import org.onap.aai.serialization.engines.TransactionalGraphEngine;
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 | org.janusgraph.core.JanusGraph (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;
125 * @param _message the new message
127 public void setMessage(String _message) {
128 this.message = _message;
132 * Sets the template vars.
134 * @param _templateVars the new template vars
136 public void setTemplateVars(ArrayList<String> _templateVars) {
137 this.templateVars = _templateVars;
141 * Sets the pre ext exception.
143 * @param _exception the new pre ext exception
145 public void setPreExtException(Exception _exception) {
146 this.preExtException = _exception;
150 * Sets the pre ext error callback.
152 * @param _errorCallback the new pre ext error callback
154 public void setPreExtErrorCallback(Method _errorCallback) {
155 this.preExtErrorCallback = _errorCallback;
159 * Sets the post ext exception.
161 * @param _exception the new post ext exception
163 public void setPostExtException(Exception _exception) {
164 this.postExtException = _exception;
168 * Sets the post ext error callback.
170 * @param _errorCallback the new post ext error callback
172 public void setPostExtErrorCallback(Method _errorCallback) {
173 this.postExtErrorCallback = _errorCallback;
177 * Sets the servlet request.
179 * @param _httpServletRequest the new servlet request
181 public void setServletRequest(HttpServletRequest _httpServletRequest) {
182 this.servletRequest = _httpServletRequest;
186 * Sets the http headers.
188 * @param _httpHeaders the new http headers
190 public void setHttpHeaders(HttpHeaders _httpHeaders) {
191 this.httpHeaders = _httpHeaders;
195 * Sets the object from request type.
197 * @param _objectFromRequestType the new object from request type
199 public void setObjectFromRequestType(String _objectFromRequestType) {
200 this.objectFromRequestType = _objectFromRequestType;
204 * Sets the object from request.
206 * @param _objectFromRequest the new object from request
208 public void setObjectFromRequest(Object _objectFromRequest) {
209 this.objectFromRequest = _objectFromRequest;
213 * Sets the object from response type.
215 * @param resourceClassName the new object from response type
217 public void setObjectFromResponseType(String resourceClassName) {
218 // TODO Auto-generated method stub
219 this.objectFromResponseType = resourceClassName;
223 * Gets the object from response type.
225 * @return the object from response type
227 public String getObjectFromResponseType() {
228 // TODO Auto-generated method stub
229 return this.objectFromResponseType;
233 * Sets the pre ext fail on error.
235 * @param _failOnError the new pre ext fail on error
237 public void setPreExtFailOnError(boolean _failOnError) {
238 this.preExtFailOnError = _failOnError;
242 * Sets the post ext fail on error.
244 * @param _failOnError the new post ext fail on error
246 public void setPostExtFailOnError(boolean _failOnError) {
247 this.postExtFailOnError = _failOnError;
253 * @return the message
255 public String getMessage() {
260 * Gets the template vars.
262 * @return the template vars
264 public ArrayList<String> getTemplateVars() {
265 if (this.templateVars == null) {
266 this.templateVars = new ArrayList<String>();
268 return this.templateVars;
272 * Gets the pre ext exception.
274 * @return the pre ext exception
276 public Exception getPreExtException() {
277 return this.preExtException;
281 * Gets the pre ext error callback.
283 * @return the pre ext error callback
285 public Method getPreExtErrorCallback() {
286 return this.preExtErrorCallback;
290 * Gets the post ext exception.
292 * @return the post ext exception
294 public Exception getPostExtException() {
295 return this.postExtException;
299 * Gets the post ext error callback.
301 * @return the post ext error callback
303 public Method getPostExtErrorCallback() {
304 return this.postExtErrorCallback;
308 * Gets the http servlet request.
310 * @return the http servlet request
312 public HttpServletRequest getHttpServletRequest() {
313 return this.servletRequest;
317 * Gets the http headers.
319 * @return the http headers
321 public HttpHeaders getHttpHeaders() {
322 return this.httpHeaders;
326 * Gets the object from request type.
328 * @return the object from request type
330 public String getObjectFromRequestType() {
331 return this.objectFromRequestType;
335 * Gets the object from request.
337 * @return the object from request
339 public Object getObjectFromRequest() {
340 return this.objectFromRequest;
344 * Gets the pre ext fail on error.
346 * @return the pre ext fail on error
348 public boolean getPreExtFailOnError() {
349 return this.preExtFailOnError;
353 * Gets the post ext fail on error.
355 * @return the post ext fail on error
357 public boolean getPostExtFailOnError() {
358 return this.postExtFailOnError;
362 * Gets the from app id.
364 * @return the from app id
366 public String getFromAppId() {
367 return this.fromAppId;
371 * Sets the from app id.
373 * @param fromAppId the new from app id
375 public void setFromAppId(String fromAppId) {
376 this.fromAppId = fromAppId;
382 * @return the trans id
384 public String getTransId() {
391 * @param transId the new trans id
393 public void setTransId(String transId) {
394 this.transId = transId;
398 * Gets the pre ext skip error callback.
400 * @return the pre ext skip error callback
402 public boolean getPreExtSkipErrorCallback() {
403 return preExtSkipErrorCallback;
407 * Sets the pre ext skip error callback.
409 * @param preExtSkipErrorCallback the new pre ext skip error callback
411 public void setPreExtSkipErrorCallback(boolean preExtSkipErrorCallback) {
412 this.preExtSkipErrorCallback = preExtSkipErrorCallback;
416 * Gets the post ext skip error callback.
418 * @return the post ext skip error callback
420 public boolean getPostExtSkipErrorCallback() {
421 return postExtSkipErrorCallback;
425 * Sets the post ext skip error callback.
427 * @param postExtSkipErrorCallback the new post ext skip error callback
429 public void setPostExtSkipErrorCallback(boolean postExtSkipErrorCallback) {
430 this.postExtSkipErrorCallback = postExtSkipErrorCallback;
438 public Graph getGraph() {
445 * @param graph the new graph
447 public void setGraph(Graph graph) {
452 * Gets the object from response.
454 * @return the object from response
456 public Object getObjectFromResponse() {
457 return objectFromResponse;
461 * Sets the object from response.
463 * @param objectFromResponse the new object from response
465 public void setObjectFromResponse(Object objectFromResponse) {
466 this.objectFromResponse = objectFromResponse;
470 * Gets the lookup hash map.
472 * @return the lookup hash map
474 public HashMap<String, Object> getLookupHashMap() {
475 if (this.lookupHashMap == null) {
476 this.lookupHashMap = new HashMap<String, Object>();
478 return this.lookupHashMap;
482 * Sets the lookup hash map.
484 * @param lookupHashMap the lookup hash map
486 public void setLookupHashMap(HashMap<String, Object> lookupHashMap) {
487 this.lookupHashMap = lookupHashMap;
491 * Gets the precheck added list.
493 * @return the precheck added list
495 public HashMap<String, ArrayList<String>> getPrecheckAddedList() {
496 if (this.precheckAddedList == null) {
497 this.precheckAddedList = new HashMap<String, ArrayList<String>>();
499 return precheckAddedList;
503 * Sets the precheck added list.
505 * @param precheckAddedList the precheck added list
507 public void setPrecheckAddedList(HashMap<String, ArrayList<String>> precheckAddedList) {
508 this.precheckAddedList = precheckAddedList;
512 * Gets the precheck response messages.
514 * @return the precheck response messages
516 public AAIResponseMessages getPrecheckResponseMessages() {
517 if (this.precheckResponseMessages == null) {
518 this.precheckResponseMessages = new AAIResponseMessages();
520 return precheckResponseMessages;
524 * Sets the precheck response messages.
526 * @param precheckResponseData the new precheck response messages
528 public void setPrecheckResponseMessages(AAIResponseMessages precheckResponseData) {
529 this.precheckResponseMessages = precheckResponseData;
535 * @return the topology
537 public HashMap<String, Object> getTopology() {
538 if (this.topology == null) {
539 this.topology = new HashMap<String, Object>();
545 * Gets the vertex cache.
547 * @return the vertex cache
549 public HashMap<String, Vertex> getVertexCache() {
550 if (this.vertexCache == null) {
551 this.vertexCache = new HashMap<String, Vertex>();
557 * Gets the base object.
559 * @return the base object
561 public String getBaseObject() {
566 * Sets the base object.
568 * @param baseObject the new base object
570 public void setBaseObject(String baseObject) {
571 this.baseObject = baseObject;
575 * Gets the namespace.
577 * @return the namespace
579 public String getNamespace() {
584 * Sets the namespace.
586 * @param namespace the new namespace
588 public void setNamespace(String namespace) {
589 this.namespace = namespace;
593 * Gets the full resource name.
595 * @return the full resource name
597 public String getFullResourceName() {
598 return fullResourceName;
602 * Sets the full resource name.
604 * @param fullResourceName the new full resource name
606 public void setFullResourceName(String fullResourceName) {
607 this.fullResourceName = fullResourceName;
611 * Gets the top object full resource name.
613 * @return the top object full resource name
615 public String getTopObjectFullResourceName() {
616 return topObjectFullResourceName;
620 * Sets the top object full resource name.
622 * @param topObjectFullResourceName the new top object full resource name
624 public void setTopObjectFullResourceName(String topObjectFullResourceName) {
625 this.topObjectFullResourceName = topObjectFullResourceName;
633 public String getUri() {
640 * @param uri the new uri
642 public void setUri(String uri) {
647 * Gets the api version.
649 * @return the api version
651 public String getApiVersion() {
656 * Sets the api version.
658 * @param apiVersion the new api version
660 public void setApiVersion(String apiVersion) {
661 this.apiVersion = apiVersion;
665 * Sets the notification uri.
667 * @param uri the new notification uri
669 public void setNotificationUri(String uri) {
670 this.notificationUri = uri;
675 * Gets the notification uri.
677 * @return the notification uri
679 public String getNotificationUri() {
680 return this.notificationUri;
685 * Gets the start time.
687 * @return the start time
689 public long getStartTime() {
694 * Sets the start time.
696 * @param startTime the new start time
698 public void setStartTime(long startTime) {
699 this.startTime = startTime;
703 * Gets the checkpoint time.
705 * @return the checkpoint time
707 public long getCheckpointTime() {
708 return checkpointTime;
712 * Sets the checkpoint time.
714 * @param checkpointTime the new checkpoint time
716 public void setCheckpointTime(long checkpointTime) {
717 this.checkpointTime = checkpointTime;
721 * Gets the jaxb context.
723 * @return the jaxb context
725 public DynamicJAXBContext getJaxbContext() {
730 * Sets the jaxb context.
732 * @param jaxbContext the new jaxb context
734 public void setJaxbContext(DynamicJAXBContext jaxbContext) {
735 this.jaxbContext = jaxbContext;
739 * Sets the event action.
741 * @param eventAction the new event action
743 public void setEventAction(String eventAction) {
744 this.eventAction = eventAction;
748 * Gets the event action.
750 * @return the event action
752 public String getEventAction() {
753 return this.eventAction;
757 * Gets the transactional graph engine.
759 * @return the transactional graph engine
761 public TransactionalGraphEngine getTransactionalGraphEngine() {
762 return this.dbEngine;
767 * Sets the transactional graph engine.
769 * @param dbEngine the new transactional graph engine
771 public void setTransactionalGraphEngine(TransactionalGraphEngine dbEngine) {
772 this.dbEngine = dbEngine;
781 public Loader getLoader() {
788 * @param loader the new loader
790 public void setLoader(Loader loader) {
791 this.loader = loader;
797 * @return the uri info
799 public UriInfo getUriInfo() {
806 * @param uriInfo the new uri info
808 public void setUriInfo(UriInfo uriInfo) {
809 this.uriInfo = uriInfo;
812 public DBRequest getDbRequest() {
816 public void setDbRequest(DBRequest dbRequest) {
817 this.dbRequest = dbRequest;
820 public HttpEntry getHttpEntry() {
824 public void setHttpEntry(HttpEntry httpEntry) {
825 this.httpEntry = httpEntry;