summaryrefslogtreecommitdiffstats
path: root/common-be/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'common-be/src/main')
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentTypeEnum.java9
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnum.java33
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ResourceTypeEnum.java3
3 files changed, 29 insertions, 16 deletions
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentTypeEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentTypeEnum.java
index 44956ceb17..e549466c45 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentTypeEnum.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentTypeEnum.java
@@ -20,10 +20,13 @@ import lombok.Getter;
@Getter
@AllArgsConstructor
public enum ComponentTypeEnum {
- RESOURCE("Resource"), SERVICE("Service"), RESOURCE_INSTANCE("Resource Instance"), PRODUCT("Product"), SERVICE_INSTANCE("Service Instance");
- // Those values cannot be another field in enum, because they are needed
+ RESOURCE("Resource"),
+ SERVICE("Service"),
+ RESOURCE_INSTANCE("Resource Instance"),
+ PRODUCT("Product"),
+ SERVICE_INSTANCE("Service Instance");
- // as constants for Swagger allowedValues param
+ // Those values cannot be another field in enum, because they are needed as constants for Swagger allowedValues param
public static final String RESOURCE_PARAM_NAME = "resources";
public static final String SERVICE_PARAM_NAME = "services";
public static final String PRODUCT_PARAM_NAME = "products";
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnum.java
index a4dc0084cc..3ba4ca62cd 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnum.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnum.java
@@ -15,35 +15,44 @@
package org.openecomp.sdc.be.datatypes.enums;
import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
-import java.util.stream.Collectors;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum FilterKeyEnum {
- RESOURCE_TYPE("resourceType"), SUB_CATEGORY("subCategory"), CATEGORY("category"), DISTRIBUTION_STATUS("distributionStatus"), NAME_FRAGMENT(
- "nameFragment");
- private static final int NUMBER_OF_RESOURCES_FILTERED = 3;
- private static final int NUMBER_OF_SERVICES_FILTERED = 4;
+ RESOURCE_TYPE("resourceType"),
+ SUB_CATEGORY("subCategory"),
+ CATEGORY("category"),
+ VERSION("version"),
+ METADATA("metadata"),
+ DISTRIBUTION_STATUS("distributionStatus"),
+ NAME_FRAGMENT("nameFragment");
private final String name;
- public static List<String> getAllFilters() {
- return Arrays.stream(FilterKeyEnum.values()).map(FilterKeyEnum::getName).collect(Collectors.toList());
- }
+ private static final List<String> RESOURCES_FILTERED = Arrays.asList(
+ RESOURCE_TYPE.getName(),
+ SUB_CATEGORY.getName(),
+ CATEGORY.getName());
+ private static final List<String> SERVICES_FILTERED = Arrays.asList(
+ CATEGORY.getName(),
+ DISTRIBUTION_STATUS.getName(),
+ VERSION.getName(),
+ METADATA.getName());
public static List<String> getValidFiltersByAssetType(ComponentTypeEnum assetType) {
if (assetType == null) {
- return null;
+ return Collections.emptyList();
}
switch (assetType) {
case RESOURCE:
- return getAllFilters().subList(0, NUMBER_OF_RESOURCES_FILTERED);
+ return RESOURCES_FILTERED;
case SERVICE:
- return getAllFilters().subList(2, NUMBER_OF_SERVICES_FILTERED);
+ return SERVICES_FILTERED;
default:
- return null;
+ return Collections.emptyList();
}
}
}
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ResourceTypeEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ResourceTypeEnum.java
index 88ff61b6d1..e65fb1bdce 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ResourceTypeEnum.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ResourceTypeEnum.java
@@ -38,7 +38,8 @@ public enum ResourceTypeEnum {
VL("VL"/* (Virtual Link)"*/, true),
VFCMT("VFCMT"/* (VFC Monitoring Template)"*/, true),
- Configuration("Configuration", true), ServiceProxy("ServiceProxy", true),
+ Configuration("Configuration", true),
+ ServiceProxy("ServiceProxy", true),
//Generic VFC/VF/PNF/Service Type
ABSTRACT("Abstract", true),
SERVICE("Service"/*(Network Service)"*/, false);