summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap
diff options
context:
space:
mode:
authorKuleshov, Elena <evn@att.com>2020-05-20 11:23:22 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-05-20 11:23:23 -0400
commit570c4324718b7563911c4e180ab13908cf20d738 (patch)
tree49ca8cd04a2049aca7179f9d89131111165640a6 /mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap
parent5dd30849655e5a218c63d6c3855e8916399e49e7 (diff)
Add Spring Component markup to rest validator
Add Spring Component markup to rest validator classes. Do not invoke serviceInstanceDeleteValidator for macro deletes. Issue-ID: SO-2945 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: I0eb501bccb016d5d5fed43c3f5d1bd39c7d4fd72
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/NetworkDeleteValidator.java3
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidator.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/ServiceInstanceDeleteValidator.java13
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VnfDeleteValidator.java3
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VolumeGroupDeleteValidator.java2
5 files changed, 20 insertions, 3 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/NetworkDeleteValidator.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/NetworkDeleteValidator.java
index f75897dda1..89c5cbed9b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/NetworkDeleteValidator.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/NetworkDeleteValidator.java
@@ -8,8 +8,9 @@ import org.onap.so.apihandlerinfra.Actions;
import org.onap.so.apihandlerinfra.infra.rest.AAIDataRetrieval;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
-
+@Component
public class NetworkDeleteValidator implements RequestValidator {
@Autowired
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidator.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidator.java
index 1dea57ad9c..50938e6826 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidator.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidator.java
@@ -24,7 +24,9 @@ import java.util.Map;
import java.util.Optional;
import org.onap.so.apihandlerinfra.Actions;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.springframework.stereotype.Component;
+@Component
public interface RequestValidator {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/ServiceInstanceDeleteValidator.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/ServiceInstanceDeleteValidator.java
index 61f757ba64..843d94ce6c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/ServiceInstanceDeleteValidator.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/ServiceInstanceDeleteValidator.java
@@ -8,8 +8,10 @@ import org.onap.so.apihandlerinfra.Actions;
import org.onap.so.apihandlerinfra.infra.rest.AAIDataRetrieval;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+@Component
public class ServiceInstanceDeleteValidator implements RequestValidator {
@Autowired
@@ -17,8 +19,17 @@ public class ServiceInstanceDeleteValidator implements RequestValidator {
@Override
public boolean shouldRunFor(String requestUri, ServiceInstancesRequest request, Actions action) {
+ boolean isALaCarte = false;
+ if (request.getRequestDetails() != null && request.getRequestDetails().getRequestParameters() != null) {
+ if (request.getRequestDetails().getRequestParameters().getALaCarte() == null) {
+ isALaCarte = false;
+ } else {
+ isALaCarte = request.getRequestDetails().getRequestParameters().getALaCarte();
+ }
+
+ }
return Pattern.compile("[Vv][5-8]/serviceInstances/[^/]+").matcher(requestUri).matches()
- && action.equals(Action.deleteInstance);
+ && action.equals(Action.deleteInstance) && isALaCarte;
}
@Override
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VnfDeleteValidator.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VnfDeleteValidator.java
index d54e60d153..37e3f0cb2e 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VnfDeleteValidator.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VnfDeleteValidator.java
@@ -8,8 +8,9 @@ import org.onap.so.apihandlerinfra.Actions;
import org.onap.so.apihandlerinfra.infra.rest.AAIDataRetrieval;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
-
+@Component
public class VnfDeleteValidator implements RequestValidator {
@Autowired
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VolumeGroupDeleteValidator.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VolumeGroupDeleteValidator.java
index f010d47f70..e3598af31d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VolumeGroupDeleteValidator.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VolumeGroupDeleteValidator.java
@@ -8,7 +8,9 @@ import org.onap.so.apihandlerinfra.Actions;
import org.onap.so.apihandlerinfra.infra.rest.AAIDataRetrieval;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+@Component
public class VolumeGroupDeleteValidator implements RequestValidator {
@Autowired