Merge "Support resource parameters generated"
[so.git] / mso-api-handlers / mso-api-handler-infra / src / main / java / org / openecomp / mso / apihandlerinfra / tenantisolation / process / OperationalEnvironmentProcess.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 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
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
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=========================================================
19  */
20
21 package org.openecomp.mso.apihandlerinfra.tenantisolation.process;
22
23 import org.openecomp.mso.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
24 import org.openecomp.mso.apihandlerinfra.tenantisolation.helpers.AAIClientHelper;
25 import org.openecomp.mso.apihandlerinfra.tenantisolation.helpers.AAIClientObjectBuilder;
26 import org.openecomp.mso.requestsdb.RequestsDBHelper;
27
28 public abstract class OperationalEnvironmentProcess {
29
30     protected String requestId;
31     protected CloudOrchestrationRequest request;
32     protected AAIClientObjectBuilder aaiClientObjectBuilder;
33     protected AAIClientHelper aaiHelper;
34     protected RequestsDBHelper requestDb;
35     
36         public OperationalEnvironmentProcess(CloudOrchestrationRequest request, String requestId) {
37                 this.requestId = requestId;
38                 this.request = request;
39                 this.aaiClientObjectBuilder = new AAIClientObjectBuilder(getRequest());
40         }
41
42         protected String getRequestId() {
43                 return this.requestId;
44         }
45
46         protected CloudOrchestrationRequest getRequest() {
47                 return this.request;
48         }
49
50         protected AAIClientHelper getAaiHelper() {
51                 if(this.aaiHelper == null) {
52                         this.aaiHelper = new AAIClientHelper(getServiceName(), getRequestId());
53                 }
54                 return this.aaiHelper;
55         }
56
57         protected void setAaiHelper(AAIClientHelper helper) {
58                 this.aaiHelper = helper;
59         }
60         
61         protected AAIClientObjectBuilder getAaiClientObjectBuilder() {
62                 return this.aaiClientObjectBuilder;
63         }
64
65         protected RequestsDBHelper getRequestDb() {
66                 if(requestDb == null) {
67                         requestDb = new RequestsDBHelper();
68                 }
69                 return requestDb;
70         }
71         
72         protected void setRequestsDBHelper(RequestsDBHelper helper) {
73                 this.requestDb = helper;
74         }
75         
76         protected abstract String getServiceName();
77         public abstract void execute();
78 }