diff options
Diffstat (limited to 'common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums')
7 files changed, 457 insertions, 0 deletions
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/AssetTypeEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/AssetTypeEnum.java new file mode 100644 index 0000000000..e130671572 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/AssetTypeEnum.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.sdc.be.datatypes.enums; + +public enum AssetTypeEnum { + RESOURCES("resources", "Resource"), SERVICES("services", "Service"), PRODUCTS("products", "Product"); + + private String value; + + public String getValue() { + return value; + } + + public String getCorrespondingComponent() { + return correspondingComponent; + } + + private String correspondingComponent; + + private AssetTypeEnum(String value, String correspondingComponent) { + this.value = value; + this.correspondingComponent = correspondingComponent; + } + + public static ComponentTypeEnum convertToComponentTypeEnum(String assetType) { + ComponentTypeEnum ret = null; + for (AssetTypeEnum curr : AssetTypeEnum.values()) { + if (curr.value.equals(assetType)) { + return ComponentTypeEnum.findByValue(curr.correspondingComponent); + } + } + + return ret; + } +} 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 new file mode 100644 index 0000000000..9da0b81d3b --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentTypeEnum.java @@ -0,0 +1,104 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.sdc.be.datatypes.enums; + +public enum ComponentTypeEnum { + RESOURCE("Resource"), SERVICE("Service"), RESOURCE_INSTANCE("Resource Instance"), PRODUCT("Product"), SERVICE_INSTANCE("Service Instance"); + + private String value; + + private ComponentTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + // 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"; + + public NodeTypeEnum getNodeType() { + + switch (this) { + case RESOURCE: + return NodeTypeEnum.Resource; + case SERVICE: + return NodeTypeEnum.Service; + case PRODUCT: + return NodeTypeEnum.Product; + case RESOURCE_INSTANCE: + return NodeTypeEnum.ResourceInstance; + default: + throw new UnsupportedOperationException("No nodeType is defined for: " + this.getValue()); + } + } + + public static ComponentTypeEnum findByValue(String value) { + ComponentTypeEnum ret = null; + for (ComponentTypeEnum curr : ComponentTypeEnum.values()) { + if (curr.getValue().equals(value)) { + ret = curr; + return ret; + } + } + return ret; + } + + public static ComponentTypeEnum findByParamName(String paramName) { + ComponentTypeEnum ret = null; + switch (paramName) { + case RESOURCE_PARAM_NAME: + ret = RESOURCE; + break; + case SERVICE_PARAM_NAME: + ret = SERVICE; + break; + case PRODUCT_PARAM_NAME: + ret = PRODUCT; + break; + default: + break; + } + return ret; + } + + public static String findParamByType(ComponentTypeEnum type) { + String ret = null; + switch (type) { + case RESOURCE: + ret = RESOURCE_PARAM_NAME; + break; + case SERVICE: + ret = SERVICE_PARAM_NAME; + break; + case PRODUCT: + ret = PRODUCT_PARAM_NAME; + break; + default: + break; + } + return ret; + } +} 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 new file mode 100644 index 0000000000..bf8ae79467 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnum.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.sdc.be.datatypes.enums; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +public enum FilterKeyEnum { + SUB_CATEGORY("subCategory"), CATEGORY("category"), DISTRIBUTION_STATUS("distributionStatus"); + + private String name; + + FilterKeyEnum(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public static List<String> getAllFilters() { + return Arrays.stream(FilterKeyEnum.values()).map(f -> f.getName()).collect(Collectors.toList()); + } + + public static List<String> getValidFiltersByAssetType(ComponentTypeEnum assetType) { + switch (assetType) { + case RESOURCE: + return getAllFilters().subList(0, 2); + case SERVICE: + return getAllFilters().subList(1, 3); + default: + return null; + } + + } +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GroupTypeEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GroupTypeEnum.java new file mode 100644 index 0000000000..e5783e4a28 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GroupTypeEnum.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.sdc.be.datatypes.enums; + +public enum GroupTypeEnum { + VF_MODULE("org.openecomp.groups.VfModule"), HEAT_STACK("org.openecomp.groups.HeatStack"); + + private String groupTypeName; + + GroupTypeEnum(String groupTypeName) { + this.groupTypeName = groupTypeName; + } + + public String getGroupTypeName() { + return groupTypeName; + } +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/NodeTypeEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/NodeTypeEnum.java new file mode 100644 index 0000000000..2938b4576a --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/NodeTypeEnum.java @@ -0,0 +1,92 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.sdc.be.datatypes.enums; + +public enum NodeTypeEnum { + User("user"), + Service("service"), + Resource("resource"), + Product("product"), + ResourceCategory("resourceCategory"), + ServiceCategory("serviceCategory"), + ServiceNewCategory("serviceNewCategory"), + ResourceNewCategory("resourceNewCategory"), + ProductCategory("productCategory"), + ResourceSubcategory("resourceSubcategory"), + ProductSubcategory("productSubcategory"), + ProductGrouping("productGrouping"), + Tag("tag"), + Property("property"), + Attribute("attribute"), + CapabilityType("capabilityType"), + Requirement("requirement"), + RelationshipType("relationshipType"), + Capability("capability"), + RequirementImpl("requirementImpl"), + CapabilityInst("capabilityInst"), + AttributeValue("attributeValue"), + InputValue("inputValue"), + PropertyValue("propertyValue"), + LockNode("lockNode"), + ArtifactRef("artifactRef"), + Interface("interface"), + InterfaceOperation("interfaceOperation"), + ResourceInstance("resourceInstance"), + RelationshipInst("relationshipInst"), + AdditionalInfoParameters("additionalInfoParameters"), + ConsumerCredentials("consumerCredentials"), + HeatParameter("heatParameter"), + HeatParameterValue("heatParameterValue"), + DataType("dataType"), + GroupType("groupType"), + PolicyType("policyType"), + Group("group"), + UserFunctionalMenu("userFunctionalMenu"), + Input("input"); + + private String name; + + NodeTypeEnum(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public static NodeTypeEnum getByName(String name) { + for (NodeTypeEnum inst : NodeTypeEnum.values()) { + if (inst.getName().equals(name)) { + return inst; + } + } + return null; + } + + public static NodeTypeEnum getByNameIgnoreCase(String name) { + for (NodeTypeEnum inst : NodeTypeEnum.values()) { + if (inst.getName().equalsIgnoreCase(name)) { + return inst; + } + } + return null; + } +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/OriginTypeEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/OriginTypeEnum.java new file mode 100644 index 0000000000..14b3e4ef86 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/OriginTypeEnum.java @@ -0,0 +1,69 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.sdc.be.datatypes.enums; + +public enum OriginTypeEnum { + PRODUCT("Product", "Product", "product instance", ComponentTypeEnum.PRODUCT), + SERVICE("Service", "Service", "service instance", ComponentTypeEnum.SERVICE), + VF("VF", "VF (Virtual Function)", "resource instance", ComponentTypeEnum.RESOURCE), + VFC("VFC", "VFC (Virtual Function Component)","resource instance",ComponentTypeEnum.RESOURCE), + CP("CP", "CP (Connection Point)", "resource instance", ComponentTypeEnum.RESOURCE), + VL("VL", "VL (Virtual Link)", "resource instance", ComponentTypeEnum.RESOURCE); + + private String value; + private String displayValue; + private String instanceType; + private ComponentTypeEnum componentType; + + private OriginTypeEnum(String value, String displayValue, String instanceType, ComponentTypeEnum componentType) { + this.value = value; + this.displayValue = displayValue; + this.instanceType = instanceType; + this.componentType = componentType; + } + + public String getValue() { + return value; + } + + public String getDisplayValue() { + return displayValue; + } + + public String getInstanceType() { + return instanceType; + } + + public ComponentTypeEnum getComponentType() { + return componentType; + } + + public static OriginTypeEnum findByValue(String value) { + OriginTypeEnum ret = null; + for (OriginTypeEnum curr : OriginTypeEnum.values()) { + if (curr.getValue().equals(value)) { + ret = curr; + break; + } + } + return ret; + } +} 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 new file mode 100644 index 0000000000..7864a2cf5f --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ResourceTypeEnum.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.sdc.be.datatypes.enums; + +public enum ResourceTypeEnum { + + VFC("VFC (Virtual Function Component)"), + VF("VF"/* (Virtual Function)" */), + CP("CP (Connection Point)"), + VL("VL (Virtual Link)"); + + String value; + + private ResourceTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static boolean contains(String type) { + + for (ResourceTypeEnum e : ResourceTypeEnum.values()) { + if (e.name().equals(type)) { + return true; + } + } + return false; + } +} |