aboutsummaryrefslogtreecommitdiffstats
path: root/a1-policy-management/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'a1-policy-management/src/main')
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/ConfigurationControllerV3.java54
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/PolicyControllerV3.java20
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/RicRepositoryControllerV3.java69
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/ServiceControllerV3.java81
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/StatusControllerV3.java64
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/mappers/v3/RicRepositoryMapper.java35
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/mappers/v3/ServiceControllerMapper.java35
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/mappers/v3/StatusControllerMapper.java30
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/service/v3/PolicyService.java2
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/util/v3/Helper.java8
10 files changed, 387 insertions, 11 deletions
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/ConfigurationControllerV3.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/ConfigurationControllerV3.java
new file mode 100644
index 00000000..d04254c0
--- /dev/null
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/ConfigurationControllerV3.java
@@ -0,0 +1,54 @@
+/*-
+ * ========================LICENSE_START=================================
+ * Copyright (C) 2020-2023 Nordix Foundation. All rights reserved.
+ * ======================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================LICENSE_END===================================
+ */
+
+package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v3;
+
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.onap.ccsdk.oran.a1policymanagementservice.controllers.api.v3.ConfigurationApi;
+import org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2.ConfigurationController;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.server.ServerWebExchange;
+import reactor.core.publisher.Mono;
+
+@RestController("ConfigurationControllerV3")
+@Tag( //
+ name = ConfigurationControllerV3.API_NAME, //
+ description = ConfigurationControllerV3.API_DESCRIPTION //
+)
+@RequestMapping("/a1policymanagement/v1")
+public class ConfigurationControllerV3 implements ConfigurationApi {
+
+ public static final String API_NAME = "Management of configuration";
+ public static final String API_DESCRIPTION = "API used to create or fetch the application configuration";
+
+ @Autowired
+ private ConfigurationController configurationController;
+
+ @Override
+ public Mono<ResponseEntity<String>> getConfiguration(ServerWebExchange exchange) throws Exception {
+ return configurationController.getConfiguration(exchange);
+ }
+
+ @Override
+ public Mono<ResponseEntity<Object>> putConfiguration(Mono<Object> body, ServerWebExchange exchange) throws Exception {
+ return configurationController.putConfiguration(body, exchange);
+ }
+}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/PolicyControllerV3.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/PolicyControllerV3.java
index edc3be12..4d9f3277 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/PolicyControllerV3.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/PolicyControllerV3.java
@@ -57,34 +57,38 @@ public class PolicyControllerV3 implements A1PolicyManagementApi {
@Override
public Mono<ResponseEntity<PolicyObjectInformation>> createPolicy(Mono<PolicyObjectInformation> policyObjectInformation, ServerWebExchange exchange) {
- return policyObjectInformation.flatMap(policyObjectInfo -> {
- return policyService.createPolicyService(policyObjectInfo, exchange);
- });
+ return policyObjectInformation.flatMap(policyObjectInfo -> policyService.createPolicyService(policyObjectInfo, exchange)
+ .doOnError(error -> errorHandlingService.handleError(error)));
}
@Override
public Mono<ResponseEntity<Void>> deletePolicy(String policyId, String accept, ServerWebExchange exchange) throws Exception {
- return policyService.deletePolicyService(policyId, exchange);
+ return policyService.deletePolicyService(policyId, exchange)
+ .doOnError(error -> errorHandlingService.handleError(error));
}
@Override
public Mono<ResponseEntity<Object>> getPolicy(String policyId, String accept, ServerWebExchange exchange) throws Exception {
- return policyService.getPolicyService(policyId, exchange);
+ return policyService.getPolicyService(policyId, exchange)
+ .doOnError(error -> errorHandlingService.handleError(error));
}
@Override
public Mono<ResponseEntity<Flux<PolicyInformation>>> getPolicyIds(String policyTypeId, String nearRtRicId, String serviceId, String typeName, String accept, ServerWebExchange exchange) throws Exception {
- return policyService.getPolicyIdsService(policyTypeId, nearRtRicId, serviceId, typeName, exchange);
+ return policyService.getPolicyIdsService(policyTypeId, nearRtRicId, serviceId, typeName, exchange)
+ .doOnError(error -> errorHandlingService.handleError(error));
}
@Override
public Mono<ResponseEntity<Object>> getPolicyTypeDefinition(String policyTypeId, String accept, ServerWebExchange exchange) throws Exception {
- return policyService.getPolicyTypeDefinitionService(policyTypeId);
+ return policyService.getPolicyTypeDefinitionService(policyTypeId)
+ .doOnError(error -> errorHandlingService.handleError(error));
}
@Override
public Mono<ResponseEntity<Flux<PolicyTypeInformation>>> getPolicyTypes(String nearRtRicId, String typeName, String compatibleWithVersion, String accept, ServerWebExchange exchange) throws Exception {
- return policyService.getPolicyTypesService(nearRtRicId, typeName, compatibleWithVersion, exchange);
+ return policyService.getPolicyTypesService(nearRtRicId, typeName, compatibleWithVersion, exchange)
+ .doOnError(error -> errorHandlingService.handleError(error));
}
@Override
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/RicRepositoryControllerV3.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/RicRepositoryControllerV3.java
new file mode 100644
index 00000000..9160bad2
--- /dev/null
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/RicRepositoryControllerV3.java
@@ -0,0 +1,69 @@
+/*-
+ * ========================LICENSE_START=================================
+ * ONAP : ccsdk oran
+ * ======================================================================
+ * Copyright (C) 2024 OpenInfra Foundation Europe. All rights reserved.
+ * ======================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================LICENSE_END===================================
+ */
+
+package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v3;
+
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.onap.ccsdk.oran.a1policymanagementservice.controllers.api.v3.NearRtRicRepositoryApi;
+import org.onap.ccsdk.oran.a1policymanagementservice.mappers.v3.RicRepositoryMapper;
+import org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2.RicRepositoryController;
+import org.onap.ccsdk.oran.a1policymanagementservice.models.v3.RicInfo;
+import org.onap.ccsdk.oran.a1policymanagementservice.models.v3.RicInfoList;
+import org.onap.ccsdk.oran.a1policymanagementservice.service.v3.ErrorHandlingService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.server.ServerWebExchange;
+import reactor.core.publisher.Mono;
+
+@RestController("RicRepositoryControllerV3")
+@Tag(
+ name = RicRepositoryControllerV3.API_NAME,
+ description = RicRepositoryControllerV3.API_DESCRIPTION
+)
+@RequestMapping("/a1policymanagement/v1")
+public class RicRepositoryControllerV3 implements NearRtRicRepositoryApi {
+
+ public static final String API_NAME = "NearRT-RIC Repository V3";
+ public static final String API_DESCRIPTION = "API used to get the NearRT-RIC for the managed element";
+ @Autowired
+ private RicRepositoryController ricRepositoryController;
+
+ @Autowired
+ private RicRepositoryMapper ricRepositoryMapper;
+
+ @Autowired
+ ErrorHandlingService errorHandlingService;
+
+ @Override
+ public Mono<ResponseEntity<RicInfo>> getRic(String managedElementId, String ricId, String accept, ServerWebExchange exchange) throws Exception {
+ return ricRepositoryController.getRic(managedElementId, ricId, exchange)
+ .map(responseEntity -> new ResponseEntity<>(ricRepositoryMapper.toRicInfoV3(responseEntity.getBody()), responseEntity.getStatusCode()))
+ .doOnError(error -> errorHandlingService.handleError(error));
+ }
+
+ @Override
+ public Mono<ResponseEntity<RicInfoList>> getRics(String policyTypeId, String accept, ServerWebExchange exchange) throws Exception {
+ return ricRepositoryController.getRics(policyTypeId, exchange)
+ .map(responseEntity -> new ResponseEntity<>(ricRepositoryMapper.toRicInfoListV3(responseEntity.getBody()), responseEntity.getStatusCode()))
+ .doOnError(error -> errorHandlingService.handleError(error));
+ }
+}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/ServiceControllerV3.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/ServiceControllerV3.java
new file mode 100644
index 00000000..1d5461c3
--- /dev/null
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/ServiceControllerV3.java
@@ -0,0 +1,81 @@
+/*-
+ * ========================LICENSE_START=================================
+ * ONAP : ccsdk oran
+ * ======================================================================
+ * Copyright (C) 2024 OpenInfra Foundation Europe. All rights reserved.
+ * ======================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================LICENSE_END===================================
+ */
+
+package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v3;
+
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.onap.ccsdk.oran.a1policymanagementservice.controllers.api.v3.ServiceRegistryAndSupervisionApi;
+import org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2.ServiceController;
+import org.onap.ccsdk.oran.a1policymanagementservice.mappers.v3.ServiceControllerMapper;
+import org.onap.ccsdk.oran.a1policymanagementservice.models.v3.ServiceRegistrationInfo;
+import org.onap.ccsdk.oran.a1policymanagementservice.models.v3.ServiceStatusList;
+import org.onap.ccsdk.oran.a1policymanagementservice.service.v3.ErrorHandlingService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.server.ServerWebExchange;
+import reactor.core.publisher.Mono;
+
+@RestController("ServiceControllerV3")
+@Tag( //
+ name = ServiceControllerV3.API_NAME, //
+ description = ServiceControllerV3.API_DESCRIPTION //
+)
+@RequestMapping("/a1policymanagement/v1")
+public class ServiceControllerV3 implements ServiceRegistryAndSupervisionApi {
+
+ public static final String API_NAME = "Service Registry and Supervision";
+ public static final String API_DESCRIPTION = "API used to keep the service Alive with in the timeout period";
+
+ @Autowired
+ private ServiceController serviceController;
+
+ @Autowired
+ private ServiceControllerMapper serviceControllerMapper;
+
+ @Autowired
+ ErrorHandlingService errorHandlingService;
+
+ @Override
+ public Mono<ResponseEntity<Object>> deleteService(String serviceId, String accept, ServerWebExchange exchange) throws Exception {
+ return serviceController.deleteService(serviceId, exchange);
+ }
+
+ @Override
+ public Mono<ResponseEntity<ServiceStatusList>> getServices(String serviceId, String accept, ServerWebExchange exchange) throws Exception {
+ return serviceController.getServices(serviceId, exchange)
+ .map(responseEntity -> new ResponseEntity<>(serviceControllerMapper.toServiceStatusListV3(
+ responseEntity.getBody()), responseEntity.getStatusCode()))
+ .doOnError(error -> errorHandlingService.handleError(error));
+ }
+
+ @Override
+ public Mono<ResponseEntity<Object>> keepAliveService(String serviceId, String accept, Mono<String> body, ServerWebExchange exchange) throws Exception {
+ return serviceController.keepAliveService(serviceId, exchange);
+ }
+
+ @Override
+ public Mono<ResponseEntity<Object>> putService(Mono<ServiceRegistrationInfo> serviceRegistrationInfo, ServerWebExchange exchange) throws Exception {
+ return serviceController.putService(serviceRegistrationInfo.map(serviceRegistrationInfoV2 ->
+ serviceControllerMapper.toServiceRegistrationInfoV2(serviceRegistrationInfoV2)), exchange)
+ .doOnError(error -> errorHandlingService.handleError(error));
+ }
+}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/StatusControllerV3.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/StatusControllerV3.java
new file mode 100644
index 00000000..4bed9fe8
--- /dev/null
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/StatusControllerV3.java
@@ -0,0 +1,64 @@
+/*-
+ * ========================LICENSE_START=================================
+ * ONAP : ccsdk oran
+ * ======================================================================
+ * Copyright (C) 2024 OpenInfra Foundation Europe. All rights reserved.
+ * ======================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================LICENSE_END===================================
+ */
+
+package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v3;
+
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.onap.ccsdk.oran.a1policymanagementservice.controllers.api.v3.HealthCheckApi;
+import org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2.RicRepositoryController;
+import org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2.StatusController;
+import org.onap.ccsdk.oran.a1policymanagementservice.mappers.v3.StatusControllerMapper;
+import org.onap.ccsdk.oran.a1policymanagementservice.models.v3.StatusInfo;
+import org.onap.ccsdk.oran.a1policymanagementservice.service.v3.ErrorHandlingService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.server.ServerWebExchange;
+import reactor.core.publisher.Mono;
+
+@RestController("StatusControllerV3")
+@Tag( //
+ name = StatusControllerV3.API_NAME, //
+ description = StatusControllerV3.API_DESCRIPTION //
+)
+@RequestMapping("/a1policymanagement/v1")
+public class StatusControllerV3 implements HealthCheckApi {
+
+ public static final String API_NAME = "Health Check";
+ public static final String API_DESCRIPTION = "API used to get the health status and statistics of this service";
+
+ @Autowired
+ private StatusController statusController;
+
+ @Autowired
+ private StatusControllerMapper statusControllerMapper;
+
+ @Autowired
+ ErrorHandlingService errorHandlingService;
+
+ @Override
+ public Mono<ResponseEntity<StatusInfo>> getStatus(ServerWebExchange exchange) throws Exception {
+ return statusController.getStatus(exchange)
+ .map(statusInfoResponseEntity -> new ResponseEntity<>(statusControllerMapper.toStatusInfoV3
+ (statusInfoResponseEntity.getBody()), statusInfoResponseEntity.getStatusCode()))
+ .doOnError(error -> errorHandlingService.handleError(error));
+ }
+}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/mappers/v3/RicRepositoryMapper.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/mappers/v3/RicRepositoryMapper.java
new file mode 100644
index 00000000..c616d247
--- /dev/null
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/mappers/v3/RicRepositoryMapper.java
@@ -0,0 +1,35 @@
+/*-
+ * ========================LICENSE_START=================================
+ * ONAP : ccsdk oran
+ * ======================================================================
+ * Copyright (C) 2024 OpenInfra Foundation Europe. All rights reserved.
+ * ======================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================LICENSE_END===================================
+ */
+
+package org.onap.ccsdk.oran.a1policymanagementservice.mappers.v3;
+
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+import org.onap.ccsdk.oran.a1policymanagementservice.models.v3.RicInfo;
+import org.onap.ccsdk.oran.a1policymanagementservice.models.v3.RicInfoList;
+
+@Mapper(componentModel = "spring")
+public interface RicRepositoryMapper {
+
+ @Mapping(source = "policytypeIds", target = "policyTypeIds")
+ RicInfo toRicInfoV3(org.onap.ccsdk.oran.a1policymanagementservice.models.v2.RicInfo ricInfoV2);
+
+ RicInfoList toRicInfoListV3(org.onap.ccsdk.oran.a1policymanagementservice.models.v2.RicInfoList ricInfoListV2);
+}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/mappers/v3/ServiceControllerMapper.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/mappers/v3/ServiceControllerMapper.java
new file mode 100644
index 00000000..37f52502
--- /dev/null
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/mappers/v3/ServiceControllerMapper.java
@@ -0,0 +1,35 @@
+/*-
+ * ========================LICENSE_START=================================
+ * ONAP : ccsdk oran
+ * ======================================================================
+ * Copyright (C) 2024 OpenInfra Foundation Europe. All rights reserved.
+ * ======================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================LICENSE_END===================================
+ */
+
+package org.onap.ccsdk.oran.a1policymanagementservice.mappers.v3;
+
+import org.mapstruct.Mapper;
+import org.onap.ccsdk.oran.a1policymanagementservice.models.v2.ServiceRegistrationInfo;
+import org.onap.ccsdk.oran.a1policymanagementservice.models.v3.ServiceStatusList;
+
+@Mapper(componentModel = "spring")
+public interface ServiceControllerMapper {
+
+ ServiceRegistrationInfo toServiceRegistrationInfoV2(
+ org.onap.ccsdk.oran.a1policymanagementservice.models.v3.ServiceRegistrationInfo serviceRegistrationInfo);
+
+ ServiceStatusList toServiceStatusListV3(
+ org.onap.ccsdk.oran.a1policymanagementservice.models.v2.ServiceStatusList serviceStatusList);
+}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/mappers/v3/StatusControllerMapper.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/mappers/v3/StatusControllerMapper.java
new file mode 100644
index 00000000..17b858ba
--- /dev/null
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/mappers/v3/StatusControllerMapper.java
@@ -0,0 +1,30 @@
+/*-
+ * ========================LICENSE_START=================================
+ * ONAP : ccsdk oran
+ * ======================================================================
+ * Copyright (C) 2024 OpenInfra Foundation Europe. All rights reserved.
+ * ======================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================LICENSE_END===================================
+ */
+
+package org.onap.ccsdk.oran.a1policymanagementservice.mappers.v3;
+
+import org.mapstruct.Mapper;
+import org.onap.ccsdk.oran.a1policymanagementservice.models.v3.StatusInfo;
+
+@Mapper(componentModel = "spring")
+public interface StatusControllerMapper {
+
+ StatusInfo toStatusInfoV3(org.onap.ccsdk.oran.a1policymanagementservice.models.v2.StatusInfo statusInfo);
+}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/service/v3/PolicyService.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/service/v3/PolicyService.java
index 6cd9b8d3..a892bfa3 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/service/v3/PolicyService.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/service/v3/PolicyService.java
@@ -81,7 +81,7 @@ public class PolicyService {
return Mono.error(new ServiceException("Schema validation failed", HttpStatus.BAD_REQUEST));
Ric ric = rics.getRic(policyObjectInfo.getNearRtRicId());
PolicyType policyType = policyTypes.getType(policyObjectInfo.getPolicyTypeId());
- Policy policy = helper.buildPolicy(policyObjectInfo, policyType, ric, helper.policyIdGeneration());
+ Policy policy = helper.buildPolicy(policyObjectInfo, policyType, ric, helper.policyIdGeneration(policyObjectInfo));
return helper.isPolicyAlreadyCreated(policy,policies)
.doOnError(error -> errorHandlingService.handleError(error))
.flatMap(policyBuilt -> authorizationService.authCheck(serverWebExchange, policy, AccessType.WRITE)
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/util/v3/Helper.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/util/v3/Helper.java
index 88205919..638d9504 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/util/v3/Helper.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/util/v3/Helper.java
@@ -102,8 +102,12 @@ public class Helper {
return true;
}
- public String policyIdGeneration() {
- return UUID.randomUUID().toString();
+ public String policyIdGeneration(PolicyObjectInformation policyObjectInfo) {
+ if (policyObjectInfo.getPolicyId() == null || policyObjectInfo.getPolicyId().isEmpty() ||
+ policyObjectInfo.getPolicyId().isBlank())
+ return UUID.randomUUID().toString();
+ else
+ return policyObjectInfo.getPolicyId().trim();
}
public String toJson(Object jsonObject) {