AT&T 1712 and 1802 release code
[so.git] / mso-api-handlers / mso-api-handler-infra / src / main / java / org / openecomp / mso / apihandlerinfra / tenantisolation / helpers / AAIClientObjectBuilder.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.helpers;
22
23 import org.openecomp.mso.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
24 import org.openecomp.mso.client.aai.objects.AAIOperationalEnvironment;
25
26 public class AAIClientObjectBuilder {
27         
28         private CloudOrchestrationRequest cloudOrchestrationRequest;
29         
30     public AAIClientObjectBuilder(CloudOrchestrationRequest request) {
31         this.cloudOrchestrationRequest = request;
32         }
33
34         /**
35      * Create an AAIOperationalEnvironment object.
36      * @param environmentId
37      * @param environmentName
38      * @param environmentType
39      * @param envrionmentStatus
40      * @param tenantContext
41      * @param workloadContext
42      * @return
43      * @throws JsonProcessingException
44      */
45     @Deprecated
46         public static AAIOperationalEnvironment createAAIOperationalEnvironment(
47                         String environmentId,
48                         String environmentName,
49                         String environmentType,
50                         String envrionmentStatus,
51                         String tenantContext,
52                         String workloadContext) {
53                 
54                 AAIOperationalEnvironment oe = new AAIOperationalEnvironment();
55                 oe.setOperationalEnvironmentId(environmentId);
56                 oe.setOperationalEnvironmentName(environmentName);
57                 oe.setOperationalEnvironmentType(environmentType);
58                 oe.setOperationalEnvironmentStatus(envrionmentStatus);
59                 oe.setTenantContext(tenantContext);
60                 oe.setWorkloadContext(workloadContext);
61                 
62                 return oe;
63         }
64
65     
66         public AAIOperationalEnvironment buildAAIOperationalEnvironment(String status) {
67                 AAIOperationalEnvironment env = new AAIOperationalEnvironment();
68                 env.setOperationalEnvironmentId(this.cloudOrchestrationRequest.getOperationalEnvironmentId());
69                 env.setOperationalEnvironmentName(this.cloudOrchestrationRequest.getRequestDetails().getRequestInfo().getInstanceName());
70                 env.setOperationalEnvironmentType(this.cloudOrchestrationRequest.getRequestDetails().getRequestParameters().getOperationalEnvironmentType().toString());
71                 env.setOperationalEnvironmentStatus(status);
72                 env.setTenantContext(this.cloudOrchestrationRequest.getRequestDetails().getRequestParameters().getTenantContext());
73                 env.setWorkloadContext(this.cloudOrchestrationRequest.getRequestDetails().getRequestParameters().getWorkloadContext());
74                 return env;     
75         }
76
77
78 }