From 0aa493c70aebd63244beeddf0ef22147196c5489 Mon Sep 17 00:00:00 2001 From: "andre.schmid" Date: Tue, 2 Feb 2021 19:18:22 +0000 Subject: Improve import and export VFC TOSCA attributes Improve the import and export VFC TOSCA attributes, addressing the following concerns: - brings the import and export logic very close to the properties logic, as they are very similar structures - fix import/export default values for complex types and list of simple or complex types - fix export of unnecessary/empty attribute entries - creation of attributes during the initialization (base types) - inheritance of parent attributes Change-Id: Ic733e3455fc256595b5c2b1f48e19a13be27b5cc Issue-ID: SDC-3466 Signed-off-by: andre.schmid --- .../src/main/java/org/openecomp/sdc/be/dao/api/ActionStatus.java | 3 +-- .../java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDao.java | 9 ++++++--- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'catalog-dao/src/main') diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ActionStatus.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ActionStatus.java index aceaf95d3d..ea38b93730 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ActionStatus.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ActionStatus.java @@ -55,7 +55,7 @@ public enum ActionStatus { // Property related PROPERTY_ALREADY_EXIST, PROPERTY_NAME_ALREADY_EXISTS, PROPERTY_NOT_FOUND, INVALID_PROPERTY, INVALID_PROPERTY_TYPE, INVALID_PROPERTY_INNER_TYPE, MISSING_PROPERTY_NAME, MISSING_PROPERTY_VALUE, // Attribute related - ATTRIBUTE_ALREADY_EXIST, ATTRIBUTE_NOT_FOUND, + ATTRIBUTE_ALREADY_EXIST, ATTRIBUTE_NOT_FOUND, INVALID_ATTRIBUTE, // State related INVALID_SERVICE_STATE, COMPONENT_IN_CHECKOUT_STATE, ILLEGAL_COMPONENT_STATE, COMPONENT_IN_CERT_IN_PROGRESS_STATE, COMPONENT_SENT_FOR_CERTIFICATION, COMPONENT_VERSION_ALREADY_EXIST, COMPONENT_ALREADY_CHECKED_IN, COMPONENT_CHECKOUT_BY_ANOTHER_USER, COMPONENT_IN_USE, COMPONENT_HAS_NEWER_VERSION, COMPONENT_ALREADY_CERTIFIED, COMPONENT_NOT_READY_FOR_CERTIFICATION, COMPONENT_ARTIFACT_NOT_FOUND, COMPONENT_INSTANCE_NOT_FOUND, COMPONENT_INSTANCE_NOT_FOUND_ON_CONTAINER, SERVICE_NOT_FOUND, SERVICE_CATEGORY_CANNOT_BE_CHANGED, SERVICE_NAME_CANNOT_BE_CHANGED, SERVICE_ICON_CANNOT_BE_CHANGED, COMPONENT_TOO_MUCH_CATEGORIES, SERVICE_CANNOT_CONTAIN_SUBCATEGORY, RESOURCE_CATEGORY_CANNOT_BE_CHANGED, RESOURCE_NAME_CANNOT_BE_CHANGED, RESOURCE_ICON_CANNOT_BE_CHANGED, RESOURCE_VENDOR_NAME_CANNOT_BE_CHANGED, RESOURCE_TOO_MUCH_SUBCATEGORIES, SERVICE_ICON_EXCEEDS_LIMIT, RESOURCE_INSTANCE_NOT_FOUND, RESOURCE_INSTANCE_BAD_REQUEST, RESOURCE_INSTANCE_MATCH_NOT_FOUND, RESOURCE_INSTANCE_ALREADY_EXIST, RESOURCE_INSTANCE_RELATION_NOT_FOUND, COMPONENT_MISSING_SUBCATEGORY, COMPONENT_INVALID_SUBCATEGORY, ARTIFACT_TYPE_NOT_SUPPORTED, MISSING_ARTIFACT_TYPE, ARTIFACT_LOGICAL_NAME_CANNOT_BE_CHANGED, ARTIFACT_EXIST, ARTIFACT_NOT_FOUND, ARTIFACT_INVALID_MD5, MISSING_ARTIFACT_NAME, MISSING_PROJECT_CODE, INVALID_PROJECT_CODE, COMPONENT_MISSING_MANDATORY_ARTIFACTS, LIFECYCLE_TYPE_ALREADY_EXIST, SERVICE_NOT_AVAILABLE_FOR_DISTRIBUTION, MISSING_LIFECYCLE_TYPE, RESOURCE_VFCMT_LIFECYCLE_STATE_NOT_VALID, // Distribution @@ -190,5 +190,4 @@ public enum ActionStatus { //Abstract template related ABSTRACT, NORMAL - ; } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDao.java index be1dc454f8..bda3709d7d 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDao.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDao.java @@ -39,6 +39,7 @@ import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; import org.openecomp.sdc.common.jsongraph.util.CommonUtility; import org.openecomp.sdc.common.jsongraph.util.CommonUtility.LogLevelEnum; +import org.openecomp.sdc.common.log.enums.EcompLoggerErrorCode; import org.openecomp.sdc.common.log.wrappers.Logger; import org.springframework.beans.factory.annotation.Qualifier; @@ -94,11 +95,12 @@ public class JanusGraphDao { return Either.left(graphVertex); } catch (Exception e) { - logger.debug("Failed to create Node for ID [{}]", graphVertex.getUniqueId(), e); + logger.error(EcompLoggerErrorCode.DATA_ERROR, "JanusGraphDao", + "Failed to create Node for ID '{}'", (Object) graphVertex.getUniqueId(), e); return Either.right(JanusGraphClient.handleJanusGraphException(e)); } } else { - logger.debug("Failed to create vertex for ID [{}] {}", graphVertex.getUniqueId(), graph.right().value()); + logger.debug("Failed to create vertex for ID '{}' {}", graphVertex.getUniqueId(), graph.right().value()); return Either.right(graph.right().value()); } } @@ -330,7 +332,8 @@ public class JanusGraphDao { setEdgeProperties(edge, properties); status = JanusGraphOperationStatus.OK; } catch (IOException e) { - logger.debug("Failed to set properties on edge properties [{}]", properties, e); + logger.error(EcompLoggerErrorCode.DATA_ERROR, "JanusGraphDao", + "Failed to set properties on edge properties [{}]", properties, e); status = JanusGraphOperationStatus.GENERAL_ERROR; } return status; -- cgit 1.2.3-korg