summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main/java
diff options
context:
space:
mode:
authorsarada prasad sahoo <sarada.prasad.sahoo@huawei.com>2019-04-05 16:11:50 +0530
committerOfir Sonsino <ofir.sonsino@intl.att.com>2019-04-08 08:46:05 +0000
commit1c9383bf85ce17e541fc1498a41a69568292b004 (patch)
treea1f77c750903a34fa2d34c6771b1479d64a5e513 /catalog-be/src/main/java
parent67437109d8df88ff494f8bd14faef44b7f5a2dee (diff)
updating the VNFD (SOL001) type based on SOL001 v2.5.1
updated VNFD types (tosca*.*nfv.) based on latest v2.5.1 version, not supported backward compatibility of SOL draft version, will be documented as limitation while upgrading from SOL draft version, updated importscript for new nodes, Also fixed java files for policyType having groupType reference Change-Id: I8b8175ec908809608e6bdac990052d909792a2ba Issue-ID: SDC-2170 Signed-off-by: sarada prasad sahoo <sarada.prasad.sahoo@huawei.com>
Diffstat (limited to 'catalog-be/src/main/java')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java
index f40e0e97f5..5aedb4ee0e 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java
@@ -27,9 +27,11 @@ import org.openecomp.sdc.be.components.impl.model.ToscaTypeImportData;
import org.openecomp.sdc.be.components.impl.utils.PolicyTypeImportUtils;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.impl.ComponentsUtils;
+import org.openecomp.sdc.be.model.GroupTypeDefinition;
import org.openecomp.sdc.be.model.PolicyTypeDefinition;
import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.IGroupOperation;
+import org.openecomp.sdc.be.model.operations.api.IGroupTypeOperation;
import org.openecomp.sdc.be.model.operations.api.IPolicyTypeOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.utils.TypeUtils;
@@ -48,13 +50,17 @@ public class PolicyTypeImportManager {
private final IGroupOperation groupOperation;
private final ToscaOperationFacade toscaOperationFacade;
private final CommonImportManager commonImportManager;
+ private final IGroupTypeOperation groupTypeOperation;
- public PolicyTypeImportManager(IPolicyTypeOperation policyTypeOperation, ComponentsUtils componentsUtils, IGroupOperation groupOperation, ToscaOperationFacade toscaOperationFacade, CommonImportManager commonImportManager) {
+ public PolicyTypeImportManager(IPolicyTypeOperation policyTypeOperation, ComponentsUtils componentsUtils,
+ IGroupOperation groupOperation, ToscaOperationFacade toscaOperationFacade,
+ CommonImportManager commonImportManager, IGroupTypeOperation groupTypeOperation) {
this.policyTypeOperation = policyTypeOperation;
this.componentsUtils = componentsUtils;
this.groupOperation = groupOperation;
this.toscaOperationFacade = toscaOperationFacade;
this.commonImportManager = commonImportManager;
+ this.groupTypeOperation = groupTypeOperation;
}
public Either<List<ImmutablePair<PolicyTypeDefinition, Boolean>>, ResponseFormat> createPolicyTypes(ToscaTypeImportData toscaTypeImportData) {
@@ -94,6 +100,13 @@ public class PolicyTypeImportManager {
if (!isValid) {
isValid = groupOperation.isGroupExist(targetId, false);
}
+
+ if (!isValid) { // check if it is a groupType
+ final Either<GroupTypeDefinition, StorageOperationStatus> groupTypeFound = groupTypeOperation
+ .getLatestGroupTypeByType(targetId, false);
+ isValid = groupTypeFound.isLeft() && !groupTypeFound.left().value().isEmpty();
+ }
+
if (!isValid) {
ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.TARGETS_NON_VALID, policyType.getType(), targetId);
result = Either.right(responseFormat);