diff options
author | Avi Gaffa <avi.gaffa@amdocs.com> | 2017-09-12 11:00:02 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2017-09-12 11:00:02 +0000 |
commit | e6fc26ab18d1409c490c859398fc5fca71d0518b (patch) | |
tree | 30441a6b43e2507e8cdef3589a5defc74083263f /openecomp-be/lib/openecomp-core-lib | |
parent | a0858efdab2f9bdc5d46be5655cdbb76708f4763 (diff) | |
parent | c8a540b3c234449163f6fb1899807bba951113b4 (diff) |
Merge "Create new VSP, onboard from TOSCA file - UI"
Diffstat (limited to 'openecomp-be/lib/openecomp-core-lib')
2 files changed, 46 insertions, 0 deletions
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java index e04f02cce5..0fb587cc68 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java @@ -20,6 +20,7 @@ package org.openecomp.core.utilities.file; +import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.IOUtils; import org.openecomp.core.utilities.json.JsonUtil; import org.openecomp.sdc.tosca.services.YamlUtil; @@ -195,6 +196,19 @@ public class FileUtils { return fileName.substring(0, fileName.lastIndexOf(".")); } + public static String getFileExtension(String filename) { + return FilenameUtils.getExtension(filename); + } + + public static String getNetworkPackageName(String filename){ + String[] split = filename.split("\\."); + String name = null; + if (split != null && split.length > 1){ + name = split[0]; + } + return name; + } + /** * Gets file content map from zip. * diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/orchestration/OnboardingTypesEnum.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/orchestration/OnboardingTypesEnum.java new file mode 100644 index 0000000000..04e64c33a9 --- /dev/null +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/orchestration/OnboardingTypesEnum.java @@ -0,0 +1,32 @@ +package org.openecomp.core.utilities.orchestration; + +import java.util.Optional; + +import static java.util.Arrays.asList; +public enum OnboardingTypesEnum { + CSAR("csar"), ZIP("zip"), NONE("none"); + private String type; + + OnboardingTypesEnum(String type) { + this.type = type; + } + + @Override + public String toString() { + return type; + } + + public static final OnboardingTypesEnum getOnboardingTypesEnum(final String inStr) { + if (inStr == null) { + return null; + } + Optional<OnboardingTypesEnum> onboardingTypesOptional = asList(OnboardingTypesEnum.values()).stream() + .filter(onboardingTypesEnum -> onboardingTypesEnum.toString().equals(inStr)).findAny(); + if( onboardingTypesOptional.isPresent()){ + return onboardingTypesOptional.get(); + }else { + return null; + } + } + +} |