summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src/main
diff options
context:
space:
mode:
authorChristophe Closset <cc697w@intl.att.com>2017-05-02 09:14:28 +0000
committerGerrit Code Review <gerrit@onap.org>2017-05-02 09:14:28 +0000
commit43bbca64032716730d2e7795b6569d5fdbda9d12 (patch)
tree8eff8cbf62b8c384c1730fd000560cd480d0f220 /mso-api-handlers/mso-api-handler-infra/src/main
parentae44e6134b551fb55c46c1b576e991270b5c295b (diff)
parent437c268fede8a20a0d344dd1145979b7108bc34b (diff)
Merge "Simplify InfraUtils"
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/main')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/InfraUtils.java21
1 files changed, 4 insertions, 17 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/InfraUtils.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/InfraUtils.java
index 37cbb4de66..7088a33b16 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/InfraUtils.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/InfraUtils.java
@@ -22,6 +22,8 @@ package org.openecomp.mso.apihandlerinfra;
+import java.util.Arrays;
+
import org.openecomp.mso.properties.MsoJavaProperties;
public class InfraUtils {
@@ -29,27 +31,12 @@ public class InfraUtils {
// Check for allowable actions
String actionsPropertyName = requestType + "." + version + ".ApiAllowableActions";
String allowableActions = props.getProperty(actionsPropertyName, null);
- boolean actionAllowed = false;
- if (allowableActions != null) {
- String allowableActionsList[] = allowableActions.split(",");
- for (int i=0; i<allowableActionsList.length; i++) {
- if (action.equals (allowableActionsList[i])) {
- actionAllowed = true;
- break;
- }
- }
- }
- else {
- actionAllowed = true;
- }
- return actionAllowed;
+ return allowableActions == null || Arrays.asList(allowableActions.split(",")).contains(action);
}
// Checks if the name is acceptable for heat stack
public static boolean isValidHeatName(String name) {
- if (name.matches("^[a-zA-Z][a-zA-Z0-9_\\.-]*$"))
- return true;
- return false;
+ return name.matches("^[a-zA-Z][a-zA-Z0-9_\\.-]*$");
}