aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra
diff options
context:
space:
mode:
authorGary Wu <gary.i.wu@huawei.com>2017-04-10 16:29:44 -0700
committerGary Wu <gary.i.wu@huawei.com>2017-04-19 01:21:22 +0000
commit437c268fede8a20a0d344dd1145979b7108bc34b (patch)
tree37ae6dd214fdee34fa150ceeffd5ea8a9dd9bd30 /mso-api-handlers/mso-api-handler-infra
parentb6b7bef8bdcad15af01ac88a038dd763ce59f68f (diff)
Simplify InfraUtils
Change-Id: I23659102feccaa5bf97194e052a6b28cd1e7705f Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra')
-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_\\.-]*$");
}