2 * ============LICENSE_START=======================================================
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
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.openecomp.mso.apihandlerinfra.tenantisolation.helpers;
23 import org.openecomp.mso.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
24 import org.openecomp.mso.client.aai.objects.AAIOperationalEnvironment;
26 public class AAIClientObjectBuilder {
28 private CloudOrchestrationRequest cloudOrchestrationRequest;
30 public AAIClientObjectBuilder(CloudOrchestrationRequest request) {
31 this.cloudOrchestrationRequest = request;
35 * Create an AAIOperationalEnvironment object.
36 * @param environmentId
37 * @param environmentName
38 * @param environmentType
39 * @param envrionmentStatus
40 * @param tenantContext
41 * @param workloadContext
43 * @throws JsonProcessingException
46 public static AAIOperationalEnvironment createAAIOperationalEnvironment(
48 String environmentName,
49 String environmentType,
50 String envrionmentStatus,
52 String workloadContext) {
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);
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());