summaryrefslogtreecommitdiffstats
path: root/common-app-api/src/main/java/org/openecomp
diff options
context:
space:
mode:
Diffstat (limited to 'common-app-api/src/main/java/org/openecomp')
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/be/config/ArtifactConfigManager.java138
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/be/config/ArtifactConfiguration.java68
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/be/config/ComponentType.java36
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java66
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/api/ArtifactTypeEnum.java91
5 files changed, 311 insertions, 88 deletions
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/be/config/ArtifactConfigManager.java b/common-app-api/src/main/java/org/openecomp/sdc/be/config/ArtifactConfigManager.java
new file mode 100644
index 0000000000..e3327cc696
--- /dev/null
+++ b/common-app-api/src/main/java/org/openecomp/sdc/be/config/ArtifactConfigManager.java
@@ -0,0 +1,138 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.be.config;
+
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
+
+/**
+ * Singleton that manages the artifact type configuration
+ */
+public class ArtifactConfigManager {
+
+ public static final ArtifactConfigManager INSTANCE = new ArtifactConfigManager();
+
+ private ArtifactConfigManager() {
+
+ }
+
+ public static ArtifactConfigManager getInstance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Find an artifact configuration by artifact type.
+ *
+ * @param type the artifact type
+ * @return the artifact configuration if the type exists
+ */
+ public Optional<ArtifactConfiguration> find(final String type) {
+ final List<ArtifactConfiguration> artifactConfigurationList = getConfiguration();
+ return artifactConfigurationList.stream()
+ .filter(artifactConfiguration -> artifactConfiguration.getType().equals(type))
+ .findFirst();
+ }
+
+ /**
+ * Find an artifact configuration by artifact type, that supports the artifact category/group and component type.
+ *
+ * @param type the artifact type
+ * @param artifactGroup the artifact category/group
+ * @param componentType the component type
+ * @return the artifact configuration if it matches the provided filter
+ */
+ public Optional<ArtifactConfiguration> find(final String type, final ArtifactGroupTypeEnum artifactGroup,
+ final ComponentType componentType) {
+ final ArtifactConfiguration artifactConfiguration = find(type).orElse(null);
+ if (artifactConfiguration == null) {
+ return Optional.empty();
+ }
+
+ final boolean hasCategory = artifactConfiguration.hasSupport(artifactGroup);
+ if (!hasCategory) {
+ return Optional.empty();
+ }
+ final boolean hasComponentType = artifactConfiguration.hasSupport(componentType);
+ if (!hasComponentType) {
+ return Optional.empty();
+ }
+
+ return Optional.of(artifactConfiguration);
+ }
+
+ /**
+ * Find all artifact configuration that supports an artifact category/group and a component type.
+ *
+ * @param artifactGroup the artifact group/category
+ * @param componentType the component type
+ * @return the artifact configurations that matches the filter
+ */
+ public List<ArtifactConfiguration> findAll(final ArtifactGroupTypeEnum artifactGroup,
+ final ComponentType componentType) {
+ final List<ArtifactConfiguration> artifactConfigurationList =
+ ConfigurationManager.getConfigurationManager().getConfiguration().getArtifacts();
+
+ return artifactConfigurationList.stream()
+ .filter(artifactConfiguration1 ->
+ artifactConfiguration1.hasSupport(artifactGroup) && artifactConfiguration1.hasSupport(componentType))
+ .collect(Collectors.toList());
+ }
+
+ /**
+ * Find all artifact configuration that supports an artifact category/group.
+ *
+ * @param artifactGroup the artifact category/group
+ * @return the artifact configurations that matches the filter
+ */
+ public List<ArtifactConfiguration> findAll(final ArtifactGroupTypeEnum artifactGroup) {
+ final List<ArtifactConfiguration> artifactConfigurationList =
+ ConfigurationManager.getConfigurationManager().getConfiguration().getArtifacts();
+
+ return artifactConfigurationList.stream()
+ .filter(artifactConfiguration1 -> artifactConfiguration1.hasSupport(artifactGroup))
+ .collect(Collectors.toList());
+ }
+
+ /**
+ * Find all artifact configuration that supports a component type.
+ *
+ * @param componentType the component type
+ * @return the artifact configurations that matches the filter
+ */
+ public List<ArtifactConfiguration> findAll(final ComponentType componentType) {
+ final List<ArtifactConfiguration> artifactConfigurationList =
+ ConfigurationManager.getConfigurationManager().getConfiguration().getArtifacts();
+
+ return artifactConfigurationList.stream()
+ .filter(artifactConfiguration1 -> artifactConfiguration1.hasSupport(componentType))
+ .collect(Collectors.toList());
+ }
+
+ /**
+ * Gets the artifact configuration list.
+ *
+ * @return the artifact configuration list.
+ */
+ public List<ArtifactConfiguration> getConfiguration() {
+ return ConfigurationManager.getConfigurationManager().getConfiguration().getArtifacts();
+ }
+}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/be/config/ArtifactConfiguration.java b/common-app-api/src/main/java/org/openecomp/sdc/be/config/ArtifactConfiguration.java
new file mode 100644
index 0000000000..1656b4abb1
--- /dev/null
+++ b/common-app-api/src/main/java/org/openecomp/sdc/be/config/ArtifactConfiguration.java
@@ -0,0 +1,68 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.be.config;
+
+import java.util.List;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import org.apache.commons.collections.CollectionUtils;
+import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
+
+/**
+ * Represents an artifact type configuration
+ */
+@Getter
+@Setter
+@ToString
+public class ArtifactConfiguration {
+
+ private String type;
+ private List<ArtifactGroupTypeEnum> categories;
+ private List<ComponentType> componentTypes;
+ private List<String> acceptedTypes;
+ private List<String> resourceTypes;
+
+ /**
+ * Checks if the configuration supports a component type.
+ *
+ * @param componentType the component type
+ * @return {@code true} if the component type is supported, {@code false} otherwise
+ */
+ public boolean hasSupport(final ComponentType componentType) {
+ if (CollectionUtils.isEmpty(componentTypes)) {
+ return false;
+ }
+ return componentTypes.contains(componentType);
+ }
+
+ /**
+ * Checks if the configuration supports an artifact group/category.
+ *
+ * @param groupType the artifact category/group type
+ * @return {@code true} if the artifact group/category is supported, {@code false} otherwise
+ */
+ public boolean hasSupport(final ArtifactGroupTypeEnum groupType) {
+ if (CollectionUtils.isEmpty(categories)) {
+ return false;
+ }
+ return categories.contains(groupType);
+ }
+}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/be/config/ComponentType.java b/common-app-api/src/main/java/org/openecomp/sdc/be/config/ComponentType.java
new file mode 100644
index 0000000000..2f28687620
--- /dev/null
+++ b/common-app-api/src/main/java/org/openecomp/sdc/be/config/ComponentType.java
@@ -0,0 +1,36 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.be.config;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@Getter
+@AllArgsConstructor
+public enum ComponentType {
+
+ RESOURCE("Resource"),
+ SERVICE("Service"),
+ RESOURCE_INSTANCE("Resource Instance"),
+ SERVICE_INSTANCE("Service Instance");
+
+ private final String value;
+
+}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java b/common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java
index 0bc0707822..f9f4bc14ae 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java
@@ -20,16 +20,15 @@
package org.openecomp.sdc.be.config;
-import org.apache.commons.collections.map.CaseInsensitiveMap;
-import org.openecomp.sdc.common.api.BasicConfiguration;
+import static java.lang.String.format;
+import static java.util.Collections.emptyMap;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
-
-import static java.lang.String.format;
-import static java.util.Collections.emptyMap;
+import org.apache.commons.collections.map.CaseInsensitiveMap;
+import org.openecomp.sdc.common.api.BasicConfiguration;
public class Configuration extends BasicConfiguration {
@@ -91,14 +90,9 @@ public class Configuration extends BasicConfiguration {
private Map<String, Object> toscaArtifacts;
private Map<String, Object> informationalResourceArtifacts;
private Map<String, Object> informationalServiceArtifacts;
- private Map<String, ArtifactTypeConfig> resourceDeploymentArtifacts;
- private Map<String, ArtifactTypeConfig> serviceDeploymentArtifacts;
- private Map<String, ArtifactTypeConfig> resourceInstanceDeploymentArtifacts;
- private Map<String, ArtifactTypeConfig> resourceInformationalArtifacts;
private Map<String, Object> serviceApiArtifacts;
private List<String> excludeServiceCategory;
- private List<String> artifactTypes;
private List<String> licenseTypes;
private List<String> definedResourceNamespace;
@@ -161,6 +155,15 @@ public class Configuration extends BasicConfiguration {
private EnvironmentContext environmentContext;
private List<GabConfig> gabConfig;
private EcompPortalConfig ecompPortal;
+ private List<ArtifactConfiguration> artifacts;
+
+ public List<ArtifactConfiguration> getArtifacts() {
+ return artifacts;
+ }
+
+ public void setArtifacts(List<ArtifactConfiguration> artifacts) {
+ this.artifacts = artifacts;
+ }
public String getAutoHealingOwner() {
return autoHealingOwner;
@@ -437,14 +440,6 @@ public class Configuration extends BasicConfiguration {
this.janusGraphReconnectIntervalInSeconds = janusGraphReconnectIntervalInSeconds;
}
- public List<String> getArtifactTypes() {
- return artifactTypes;
- }
-
- public void setArtifactTypes(List<String> artifactTypes) {
- this.artifactTypes = artifactTypes;
- }
-
public List<String> getExcludeResourceCategory() {
return excludeResourceCategory;
}
@@ -509,31 +504,6 @@ public class Configuration extends BasicConfiguration {
this.serviceApiArtifacts = serviceApiArtifacts;
}
- public Map<String, ArtifactTypeConfig> getServiceDeploymentArtifacts() {
- return serviceDeploymentArtifacts;
- }
-
- public void setServiceDeploymentArtifacts(Map<String, ArtifactTypeConfig> serviceDeploymentArtifacts) {
- this.serviceDeploymentArtifacts = serviceDeploymentArtifacts;
- }
-
- public Map<String, ArtifactTypeConfig> getResourceDeploymentArtifacts() {
- return resourceDeploymentArtifacts;
- }
-
- public void setResourceDeploymentArtifacts(Map<String, ArtifactTypeConfig> resourceDeploymentArtifacts) {
- this.resourceDeploymentArtifacts = resourceDeploymentArtifacts;
- }
-
- public void setResourceInstanceDeploymentArtifacts(
- Map<String, ArtifactTypeConfig> resourceInstanceDeploymentArtifacts) {
- this.resourceInstanceDeploymentArtifacts = resourceInstanceDeploymentArtifacts;
- }
-
- public Map<String, ArtifactTypeConfig> getResourceInstanceDeploymentArtifacts() {
- return resourceInstanceDeploymentArtifacts;
- }
-
public List<String> getExcludeServiceCategory() {
return excludeServiceCategory;
}
@@ -1529,7 +1499,7 @@ public class Configuration extends BasicConfiguration {
.append(format("informationalResourceArtifacts: %s%n", informationalResourceArtifacts))
.append(format("deploymentResourceArtifacts: %s%n", deploymentResourceArtifacts))
.append(format("informationalServiceArtifacts: %s%n", informationalServiceArtifacts))
- .append(format("Supported artifacts types: %s%n", artifactTypes))
+ .append(format("Supported artifacts types: %s%n", artifacts))
.append(format("Supported license types: %s%n", licenseTypes))
.append(format("Additional information Maximum number of preoperties: %s%n",
additionalInformationMaxNumberOfKeys))
@@ -1653,14 +1623,6 @@ public class Configuration extends BasicConfiguration {
this.disableAudit = enableAudit;
}
- public Map<String, ArtifactTypeConfig> getResourceInformationalArtifacts() {
- return resourceInformationalArtifacts;
- }
-
- public void setResourceInformationalArtifacts(Map<String, ArtifactTypeConfig> resourceInformationalArtifacts) {
- this.resourceInformationalArtifacts = resourceInformationalArtifacts;
- }
-
public Map<String, VfModuleProperty> getVfModuleProperties() {
return vfModuleProperties;
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/ArtifactTypeEnum.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/ArtifactTypeEnum.java
index 9d0ff1c083..affa2d32e0 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/ArtifactTypeEnum.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/ArtifactTypeEnum.java
@@ -7,9 +7,9 @@
* 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.
@@ -20,50 +20,69 @@
package org.openecomp.sdc.common.api;
-import java.util.ArrayList;
-import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
- * Enum That Represents possible Artifacts Types.
- *
+ * Represents an artifact type that is used for hard-coded type representation. All artifacts must be configured in the
+ * SDC configuration file.
*/
@Getter
@AllArgsConstructor
public enum ArtifactTypeEnum {
- CHEF("CHEF"), PUPPET("PUPPET"), YANG("YANG"), SHELL_SCRIPT("SHELL_SCRIPT"), SHELL("SHELL"), ICON("ICON"), UNKNOWN("UNKNOWN"), HEAT("HEAT"), DG_XML("DG_XML"), MURANO_PKG("MURANO_PKG"), HEAT_ENV("HEAT_ENV"), YANG_XML("YANG_XML"), HEAT_VOL("HEAT_VOL"),
- HEAT_NET("HEAT_NET"), OTHER("OTHER"), WORKFLOW("WORKFLOW"), NETWORK_CALL_FLOW("NETWORK_CALL_FLOW"), TOSCA_TEMPLATE("TOSCA_TEMPLATE"), TOSCA_CSAR("TOSCA_CSAR"), VNF_CATALOG("VNF_CATALOG"), VF_LICENSE("VF_LICENSE"), BPEL("BPEL"),
- VENDOR_LICENSE("VENDOR_LICENSE"), MODEL_INVENTORY_PROFILE("MODEL_INVENTORY_PROFILE"), MODEL_QUERY_SPEC("MODEL_QUERY_SPEC"), APPC_CONFIG("APPC_CONFIG"), HEAT_NESTED("HEAT_NESTED"), HEAT_ARTIFACT("HEAT_ARTIFACT"), CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT("CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT"),
- VF_MODULES_METADATA("VF_MODULES_METADATA"), LIFECYCLE_OPERATIONS("LIFECYCLE_OPERATIONS"), VES_EVENTS("VES_EVENTS"), PERFORMANCE_COUNTER("PERFORMANCE_COUNTER"),UCPE_LAYER_2_CONFIGURATION("UCPE_LAYER_2_CONFIGURATION"),
- CONTROLLER_BLUEPRINT_ARCHIVE("CONTROLLER_BLUEPRINT_ARCHIVE"),
- // DCAE Artifacts
- DCAE_TOSCA("DCAE_TOSCA"), DCAE_JSON("DCAE_JSON"), DCAE_POLICY("DCAE_POLICY"), DCAE_DOC("DCAE_DOC"), DCAE_EVENT("DCAE_EVENT"), DCAE_INVENTORY_TOSCA("DCAE_INVENTORY_TOSCA"), DCAE_INVENTORY_JSON("DCAE_INVENTORY_JSON"),
- DCAE_INVENTORY_POLICY("DCAE_INVENTORY_POLICY"), DCAE_INVENTORY_DOC("DCAE_INVENTORY_DOC"), DCAE_INVENTORY_BLUEPRINT("DCAE_INVENTORY_BLUEPRINT"), DCAE_INVENTORY_EVENT("DCAE_INVENTORY_EVENT"),
- // AAI Artifacts
- AAI_SERVICE_MODEL("AAI_SERVICE_MODEL"), AAI_VF_MODEL("AAI_VF_MODEL"), AAI_VF_MODULE_MODEL("AAI_VF_MODULE_MODEL"), AAI_VF_INSTANCE_MODEL("AAI_VF_INSTANCE_MODEL"),
- // MIB artifacts
- SNMP_POLL ("SNMP_POLL"), SNMP_TRAP("SNMP_TRAP"), GUIDE("GUIDE"),
- PLAN("PLAN"), PM_DICTIONARY("PM_DICTIONARY"), YANG_MODULE("YANG_MODULE"),
- ANSIBLE_PLAYBOOK("ANSIBLE_PLAYBOOK"), ONBOARDED_PACKAGE("ONBOARDED_PACKAGE"), PNF_SW_INFORMATION("PNF_SW_INFORMATION");
+ AAI_SERVICE_MODEL("AAI_SERVICE_MODEL"),
+ ANSIBLE_PLAYBOOK("ANSIBLE_PLAYBOOK"),
+ CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT("CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT"),
+ DCAE_INVENTORY_JSON("DCAE_INVENTORY_JSON"),
+ DCAE_INVENTORY_TOSCA("DCAE_INVENTORY_TOSCA"),
+ GUIDE("GUIDE"),
+ HEAT("HEAT"),
+ HEAT_ARTIFACT("HEAT_ARTIFACT"),
+ HEAT_ENV("HEAT_ENV"),
+ HEAT_NESTED("HEAT_NESTED"),
+ HEAT_NET("HEAT_NET"),
+ HEAT_VOL("HEAT_VOL"),
+ LIFECYCLE_OPERATIONS("LIFECYCLE_OPERATIONS"),
+ MODEL_INVENTORY_PROFILE("MODEL_INVENTORY_PROFILE"),
+ MODEL_QUERY_SPEC("MODEL_QUERY_SPEC"),
+ OTHER("OTHER"),
+ PM_DICTIONARY("PM_DICTIONARY"),
+ PUPPET("PUPPET"),
+ SNMP_POLL("SNMP_POLL"),
+ SNMP_TRAP("SNMP_TRAP"),
+ TOSCA_CSAR("TOSCA_CSAR"),
+ TOSCA_TEMPLATE("TOSCA_TEMPLATE"),
+ UCPE_LAYER_2_CONFIGURATION("UCPE_LAYER_2_CONFIGURATION"),
+ VENDOR_LICENSE("VENDOR_LICENSE"),
+ VES_EVENTS("VES_EVENTS"),
+ VF_LICENSE("VF_LICENSE"),
+ VF_MODULES_METADATA("VF_MODULES_METADATA"),
+ VNF_CATALOG("VNF_CATALOG"),
+ WORKFLOW("WORKFLOW"),
+ YANG_XML("YANG_XML"),
+ CHEF("CHEF"), YANG("YANG"), SHELL_SCRIPT("SHELL_SCRIPT"), SHELL("SHELL"), ICON("ICON"), UNKNOWN("UNKNOWN"), DG_XML("DG_XML"), MURANO_PKG("MURANO_PKG"),
+ NETWORK_CALL_FLOW("NETWORK_CALL_FLOW"), BPEL("BPEL"), APPC_CONFIG("APPC_CONFIG"), PERFORMANCE_COUNTER("PERFORMANCE_COUNTER"), CONTROLLER_BLUEPRINT_ARCHIVE("CONTROLLER_BLUEPRINT_ARCHIVE"),
+ DCAE_TOSCA("DCAE_TOSCA"), DCAE_JSON("DCAE_JSON"), DCAE_POLICY("DCAE_POLICY"), DCAE_DOC("DCAE_DOC"), DCAE_EVENT("DCAE_EVENT"),
+ DCAE_INVENTORY_POLICY("DCAE_INVENTORY_POLICY"), DCAE_INVENTORY_DOC("DCAE_INVENTORY_DOC"), DCAE_INVENTORY_BLUEPRINT("DCAE_INVENTORY_BLUEPRINT"), DCAE_INVENTORY_EVENT("DCAE_INVENTORY_EVENT"),
+ AAI_VF_MODEL("AAI_VF_MODEL"), AAI_VF_MODULE_MODEL("AAI_VF_MODULE_MODEL"), AAI_VF_INSTANCE_MODEL("AAI_VF_INSTANCE_MODEL"),
+ PLAN("PLAN"), YANG_MODULE("YANG_MODULE"), ONBOARDED_PACKAGE("ONBOARDED_PACKAGE"), PNF_SW_INFORMATION("PNF_SW_INFORMATION");
- private final String type;
+ private final String type;
- public static ArtifactTypeEnum findType(final String type) {
- for (final ArtifactTypeEnum ate : ArtifactTypeEnum.values()) {
- if (ate.getType().equalsIgnoreCase(type)) {
- return ate;
- }
- }
- return null;
- }
+ /**
+ * Parse a string to a {@link ArtifactTypeEnum}, ignoring the case.
+ *
+ * @param type the artifact type
+ * @return The artifact type if its represented in the present enum, otherwise {@code null}.
+ */
+ public static ArtifactTypeEnum parse(final String type) {
+ for (final ArtifactTypeEnum artifactType : ArtifactTypeEnum.values()) {
+ if (artifactType.getType().equalsIgnoreCase(type)) {
+ return artifactType;
+ }
+ }
+ return null;
+ }
- public static List<String> getAllTypes() {
- final List<String> types = new ArrayList<>();
- for (final ArtifactTypeEnum ate : ArtifactTypeEnum.values()) {
- types.add(ate.getType());
- }
- return types;
- }
}