aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTal Gitelman <tal.gitelman@att.com>2018-11-15 18:35:37 +0200
committerIdan Amit <idan.amit@intl.att.com>2018-11-15 18:25:04 +0000
commita7bb8ec767dd9ec755dc5ef9b489f1114c034db3 (patch)
tree74ba50fb8a9385156871579f8b07c87598e78c5a
parentb5fc68f8df7d253da2be2d42b0533e01884e0686 (diff)
vcpe artifacts support
- make the input csar could accepted by SDC Change-Id: Ia327044c3fa606278d0e5783f35bfa724e5d1d5f Issue-ID: SDC-1911 Signed-off-by: Tal Gitelman <tal.gitelman@att.com>
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java47
1 files changed, 27 insertions, 20 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java
index 14e28f3530..7917a0aa5d 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java
@@ -5086,12 +5086,13 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR);
responseWrapper.setInnerElement(responseFormat);
log.debug("Exception occured when findNodeTypeArtifactsToHandle, error is:{}", e.getMessage(), e);
+ nodeTypeArtifactsToHandleRes = Either.right(responseWrapper.getInnerElement());
}
return nodeTypeArtifactsToHandleRes;
}
ImmutablePair<String, String> buildNestedToscaResourceName(String nodeResourceType, String vfResourceName,
- String nodeTypeFullName) {
+ String nodeTypeFullName) {
String actualType;
String actualVfName;
if (ResourceTypeEnum.CVFC.name().equals(nodeResourceType)) {
@@ -5102,25 +5103,31 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
actualType = nodeResourceType;
}
- StringBuilder toscaResourceName = new StringBuilder(Constants.USER_DEFINED_RESOURCE_NAMESPACE_PREFIX);
- String nameWithouNamespacePrefix = nodeTypeFullName
- .substring(Constants.USER_DEFINED_RESOURCE_NAMESPACE_PREFIX.length());
- String[] findTypes = nameWithouNamespacePrefix.split("\\.");
- String resourceType = findTypes[0];
- String actualName = nameWithouNamespacePrefix.substring(resourceType.length());
-
- if (actualName.startsWith(Constants.ABSTRACT)) {
- toscaResourceName.append(resourceType.toLowerCase()).append('.')
- .append(ValidationUtils.convertToSystemName(actualVfName));
- } else {
- toscaResourceName.append(actualType.toLowerCase()).append('.')
- .append(ValidationUtils.convertToSystemName(actualVfName)).append('.').append(Constants.ABSTRACT);
- }
- StringBuilder previousToscaResourceName = new StringBuilder(toscaResourceName);
- return new ImmutablePair<>(toscaResourceName.append(actualName.toLowerCase()).toString(),
- previousToscaResourceName
- .append(actualName.substring(actualName.split("\\.")[1].length() + 1).toLowerCase())
- .toString());
+ try {
+ StringBuilder toscaResourceName = new StringBuilder(Constants.USER_DEFINED_RESOURCE_NAMESPACE_PREFIX);
+ String nameWithouNamespacePrefix = nodeTypeFullName
+ .substring(Constants.USER_DEFINED_RESOURCE_NAMESPACE_PREFIX.length());
+ String[] findTypes = nameWithouNamespacePrefix.split("\\.");
+ String resourceType = findTypes[0];
+ String actualName = nameWithouNamespacePrefix.substring(resourceType.length());
+
+ if (actualName.startsWith(Constants.ABSTRACT)) {
+ toscaResourceName.append(resourceType.toLowerCase()).append('.')
+ .append(ValidationUtils.convertToSystemName(actualVfName));
+ } else {
+ toscaResourceName.append(actualType.toLowerCase()).append('.')
+ .append(ValidationUtils.convertToSystemName(actualVfName)).append('.').append(Constants.ABSTRACT);
+ }
+ StringBuilder previousToscaResourceName = new StringBuilder(toscaResourceName);
+ return new ImmutablePair<>(toscaResourceName.append(actualName.toLowerCase()).toString(),
+ previousToscaResourceName
+ .append(actualName.substring(actualName.split("\\.")[1].length() + 1).toLowerCase())
+ .toString());
+ } catch (Exception e) {
+ ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.INVALID_TOSCA_TEMPLATE);
+ log.debug("Exception occured when buildNestedToscaResourceName, error is:{}", e.getMessage(), e);
+ throw new ComponentException(ActionStatus.INVALID_TOSCA_TEMPLATE, vfResourceName);
+ }
}
public ICacheMangerOperation getCacheManagerOperation() {