diff options
Diffstat (limited to 'catalog-dao/src')
5 files changed, 179 insertions, 154 deletions
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 ff6e0481f6..15a7fa72c7 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 @@ -145,5 +145,18 @@ public enum ActionStatus { //InterfaceLifeCycleType - INTERFACE_LIFECYCLE_TYPES_NOT_FOUND + INTERFACE_LIFECYCLE_TYPES_NOT_FOUND, + + //Capability related + CAPABILITY_NOT_FOUND, CAPABILITY_NAME_MANDATORY, CAPABILITY_TYPE_MANDATORY,CAPABILITY_NAME_ALREADY_IN_USE, + MAX_OCCURRENCES_SHOULD_BE_GREATER_THAN_MIN_OCCURRENCES, CAPABILITY_DELETION_NOT_ALLOWED_USED_IN_COMPOSITION, + CAPABILITY_UPDATE_NOT_ALLOWED_USED_IN_COMPOSITION,INVALID_CAPABILITY_NAME, + + RELATIONSHIP_TYPE_ALREADY_EXIST, MISSING_RELATIONSHIP_TYPE, CAPABILITY_TYPE_CANNOT_BE_EMPTY, + + + //Requirement related + REQUIREMENT_NOT_FOUND, REQUIREMENT_NAME_MANDATORY, REQUIREMENT_CAPABILITY_MANDATORY,REQUIREMENT_NAME_ALREADY_IN_USE, + REQUIREMENT_DELETION_NOT_ALLOWED_USED_IN_COMPOSITION, REQUIREMENT_UPDATE_NOT_ALLOWED_USED_IN_COMPOSITION, INVALID_REQUIREMENT_NAME + ; } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/graph/GraphElementFactory.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/graph/GraphElementFactory.java index a6bb026a71..350909e66d 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/graph/GraphElementFactory.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/graph/GraphElementFactory.java @@ -172,6 +172,7 @@ public class GraphElementFactory { element = clazz.cast(new InputValueData(properties)); break; case RelationshipType: + element = clazz.cast(new RelationshipTypeData(properties)); break; case LockNode: element = clazz.cast(new GraphNodeLock(properties)); diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/VertexTypeEnum.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/VertexTypeEnum.java index 108d5e7201..9ba7048dd7 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/VertexTypeEnum.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/VertexTypeEnum.java @@ -33,7 +33,7 @@ public enum VertexTypeEnum { INTERFACE_ARTIFACTS ("interface_artifacts", InterfaceDataDefinition.class), INSTANCE_ARTIFACTS ("instance_artifacts", MapArtifactDataDefinition.class), PROPERTIES ("properties", PropertyDataDefinition.class), - CAPABILTIES ("capabilities", ListCapabilityDataDefinition.class), + CAPABILITIES ("capabilities", ListCapabilityDataDefinition.class), CAPABILITIES_PROPERTIES ("capabilities_properties", MapPropertiesDataDefinition.class), REQUIREMENTS ("requirements", ListRequirementDataDefinition.class), ATTRIBUTES ("attributes", PropertyDataDefinition.class), diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionary.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionary.java index 1da09e0cc5..b3f9037ea6 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionary.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionary.java @@ -21,161 +21,162 @@ package org.openecomp.sdc.be.dao.neo4j; public enum GraphPropertiesDictionary { -// field name class type unique indexed +// field name class type unique indexed // stored in graph index - // Common - LABEL ("nodeLabel", String.class, false, true), - HEALTH_CHECK ("healthcheckis", String.class, true, true), - // Resource - NAME ("name", String.class, false, true), - TOSCA_RESOURCE_NAME ("toscaResourceName", String.class, false, true), - CATEGORY_NAME ("categoryName", String.class, false, true), - VERSION ("version", String.class, false, true), - CREATION_DATE ("creationDate", Long.class, false, false), - LAST_UPDATE_DATE ("modificationDate", Long.class, false, false), - IS_HIGHEST_VERSION ("highestVersion", Boolean.class, false, true), - IS_ABSTRACT ("abstract", Boolean.class, false, true), - DESCRIPTION ("description", String.class, false, false), - UNIQUE_ID ("uid", String.class, true, true), - STATE ("state", String.class, false, true), - TYPE ("type", String.class, false, true), - REQUIRED ("required", Boolean.class, false, false), - DEFAULT_VALUE ("defaultValue", String.class, false, false), - CONSTRAINTS ("constraints", String.class, false, false), - CONTACT_ID ("contactId", String.class, false, false), - VENDOR_NAME ("vendorName", String.class, false, false), - VENDOR_RELEASE ("vendorRelease", String.class, false, false), - CONFORMANCE_LEVEL ("conformanceLevel", String.class, false, false), - ICON ("icon", String.class, false, false), - TAGS ("tags", String.class, false, false), - UUID ("uuid", String.class, false, true), - COST ("cost", String.class, false, false), - LICENSE_TYPE ("licenseType", String.class, false, false), - NORMALIZED_NAME ("normalizedName", String.class, false, true), - SYSTEM_NAME ("systemName", String.class, false, true), - IS_DELETED ("deleted", Boolean.class, false, true), - RESOURCE_TYPE ("resourceType", String.class, false, true), - ENTRY_SCHEMA ("entry_schema", String.class, false, false), - CSAR_UUID ("csarUuid", String.class, false, true), - CSAR_VERSION ("csarVersion", String.class, false, true), - IMPORTED_TOSCA_CHECKSUM ("importedToscaChecksum", String.class, false, true), - GENERATED ("generated", Boolean.class, false, false), - // User - USERID ("userId", String.class, true, true), - EMAIL ("email", String.class, false, false), - FIRST_NAME ("firstName", String.class, false, false), - LAST_NAME ("lastName", String.class, false, false), - ROLE ("role", String.class, false, true), - USER_STATUS ("status", String.class, false, true), - VALID_SOURCE_TYPES ("validSourceTypes", String.class, false, false), - NODE ("node", String.class, false, false), - VALUE ("value", String.class, false, false), - HIDDEN ("Hidden", Boolean.class, false, false), - PROPERTIES ("properties", String.class, false, false), - POSITION_X ("positionX", String.class, false, false), - POSITION_Y ("positionY", String.class, false, false), - RELATIONSHIP_TYPE ("relationshipType", String.class, false, false), - ARTIFACT_TYPE ("artifactType", String.class, false, true), - ARTIFACT_REF ("artifactRef", String.class, false, false), - ARTIFACT_REPOSITORY ("artifactRepository", String.class, false, false), - ARTIFACT_CHECKSUM ("artifactChecksum", String.class, false, false), - CREATOR ("creator", String.class, false, false), - CREATOR_ID ("creatorId", String.class, false, false), - LAST_UPDATER ("lastUpdater", String.class, false, false), - CREATOR_FULL_NAME ("creatorFullName", String.class, false, false), - UPDATER_FULL_NAME ("updaterFullName", String.class, false, false), - ES_ID ("esId", String.class, false, false), - ARTIFACT_LABEL ("artifactLabel", String.class, false, true), - ARTIFACT_DISPLAY_NAME("artifactDisplayName", String.class, false, true), - INSTANCE_COUNTER ("instanceCounter", Integer.class, false, false), - PROJECT_CODE ("projectCode", String.class, false, false), - DISTRIBUTION_STATUS ("distributionStatus", String.class, false, false), - IS_VNF ("isVNF", Boolean.class, false, false), - LAST_LOGIN_TIME ("lastLoginTime", Long.class, false, true), - ATTRIBUTE_COUNTER ("attributeCounter", Integer.class, false, false), - INPUT_COUNTER ("inputCounter", Integer.class, false, false), - PROPERTY_COUNTER ("propertyCounter", Integer.class, false, false), - API_URL ("apiUrl", String.class, false, false), - SERVICE_API ("serviceApi", Boolean.class, false, true), - ADDITIONAL_INFO_PARAMS ("additionalInfo", String.class, false, false), - ADDITIONAL_INFO_ID_TO_KEY ("idToKey", String.class, false, false), - ARTIFACT_GROUP_TYPE ("artifactGroupType", String.class, false, true), - ARTIFACT_TIMEOUT ("timeout", Integer.class, false, false), - IS_ACTIVE ("isActive", Boolean.class, false, true), - PROPERTY_VALUE_RULES ("propertyValueRules", String.class, false, false), - //authantication - CONSUMER_NAME ("consumerName", String.class, true, true), - CONSUMER_PASSWORD ("consumerPassword", String.class, false, false), - CONSUMER_SALT ("consumerSalt", String.class, false, false), - CONSUMER_LAST_AUTHENTICATION_TIME ("consumerLastAuthenticationTime", Long.class, false, false), - CONSUMER_DETAILS_LAST_UPDATED_TIME ("consumerDetailsLastupdatedtime", Long.class, false, false), - LAST_MODIFIER_USER_ID("lastModfierUserId", String.class, false, false), - ARTIFACT_VERSION ("artifactVersion", String.class, false, false), - ARTIFACT_UUID ("artifactUUID", String.class, false, false), - PAYLOAD_UPDATE_DATE ("payloadUpdateDate", Long.class, false, false), - HEAT_PARAMS_UPDATE_DATE ("heatParamsUpdateDate",Long.class, false, false), - //product - FULL_NAME ("fullName", String.class, false, true), - //was changed as part of migration from 1602 to 1602 ( in 1602 was defined as unique. it's problem to reconfigure the index ) - CONSTANT_UUID ("constantUuidNew", String.class, false, true), - CONTACTS ("contacts", String.class, false, false), - //categorys - ICONS ("icons", String.class, false, false), - //relation - CAPABILITY_OWNER_ID ("capOwnerId", String.class, false, false), - REQUIREMENT_OWNER_ID ("reqOwnerId", String.class, false, false), - CAPABILITY_ID ("capabiltyId", String.class, false, false), - REQUIREMENT_ID ("requirementId", String.class, false, false), - PROPERTY_ID ("propertyId", String.class, false, false), - PROPERTY_NAME ("propertyName", String.class, false, false), - //component instance - ORIGIN_TYPE ("originType", String.class, false, false), - //requirement & capabilty - MIN_OCCURRENCES ("minOccurrences", String.class, false, false), - MAX_OCCURRENCES ("maxOccurrences", String.class, false, false), - //Data type - DERIVED_FROM ("derivedFrom", String.class, false, false), - MEMBERS ("members", String.class, false, false), - TARGETS ("targets ", String.class, false, false), - METADATA ("metadata", String.class, false, false), - INVARIANT_UUID ("invariantUuid", String.class, false, true), - IS_BASE ("isBase", Boolean.class, false, true), - GROUP_UUID ("groupUuid", String.class, false, true), - STATUS ("status", String.class, false, false), - FUNCTIONAL_MENU ("functionalMenu", String.class, false, false), - REQUIRED_ARTIFACTS ("requiredArtifacts", String.class, false, false), - CUSTOMIZATION_UUID ("customizationUUID", String.class, false, false), - IS_ARCHIVED ("isArchived", Boolean.class, false, true), - IS_VSP_ARCHIVED ("isVspArchived", Boolean.class, false, true), - ARCHIVE_TIME ("archiveTime", Long.class, false, true); + // Common + LABEL("nodeLabel", String.class, false, true), + HEALTH_CHECK("healthcheckis", String.class, true, true), + // Resource + NAME("name", String.class, false, true), + TOSCA_RESOURCE_NAME("toscaResourceName", String.class, false, true), + CATEGORY_NAME("categoryName", String.class, false, true), + VERSION("version", String.class, false, true), + CREATION_DATE("creationDate", Long.class, false, false), + LAST_UPDATE_DATE("modificationDate", Long.class, false, false), + IS_HIGHEST_VERSION("highestVersion", Boolean.class, false, true), + IS_ABSTRACT("abstract", Boolean.class, false, true), + DESCRIPTION("description", String.class, false, false), + UNIQUE_ID("uid", String.class, true, true), + STATE("state", String.class, false, true), + TYPE("type", String.class, false, true), + REQUIRED("required", Boolean.class, false, false), + DEFAULT_VALUE("defaultValue", String.class, false, false), + CONSTRAINTS("constraints", String.class, false, false), + CONTACT_ID("contactId", String.class, false, false), + VENDOR_NAME("vendorName", String.class, false, false), + VENDOR_RELEASE("vendorRelease", String.class, false, false), + CONFORMANCE_LEVEL("conformanceLevel", String.class, false, false), + ICON("icon", String.class, false, false), + TAGS("tags", String.class, false, false), + UUID("uuid", String.class, false, true), + COST("cost", String.class, false, false), + LICENSE_TYPE("licenseType", String.class, false, false), + NORMALIZED_NAME("normalizedName", String.class, false, true), + SYSTEM_NAME("systemName", String.class, false, true), + IS_DELETED("deleted", Boolean.class, false, true), + RESOURCE_TYPE("resourceType", String.class, false, true), + ENTRY_SCHEMA("entry_schema", String.class, false, false), + CSAR_UUID("csarUuid", String.class, false, true), + CSAR_VERSION("csarVersion", String.class, false, true), + IMPORTED_TOSCA_CHECKSUM("importedToscaChecksum", String.class, false, true), + GENERATED("generated", Boolean.class, false, false), + // User + USERID("userId", String.class, true, true), + EMAIL("email", String.class, false, false), + FIRST_NAME("firstName", String.class, false, false), + LAST_NAME("lastName", String.class, false, false), + ROLE("role", String.class, false, true), + USER_STATUS("status", String.class, false, true), + VALID_SOURCE_TYPES("validSourceTypes", String.class, false, false), + VALID_TARGET_TYPES("validTargetTypes", String.class, false, false), + NODE("node", String.class, false, false), + VALUE("value", String.class, false, false), + HIDDEN("Hidden", Boolean.class, false, false), + PROPERTIES("properties", String.class, false, false), + POSITION_X("positionX", String.class, false, false), + POSITION_Y("positionY", String.class, false, false), + RELATIONSHIP_TYPE("relationshipType", String.class, false, false), + ARTIFACT_TYPE("artifactType", String.class, false, true), + ARTIFACT_REF("artifactRef", String.class, false, false), + ARTIFACT_REPOSITORY("artifactRepository", String.class, false, false), + ARTIFACT_CHECKSUM("artifactChecksum", String.class, false, false), + CREATOR("creator", String.class, false, false), + CREATOR_ID("creatorId", String.class, false, false), + LAST_UPDATER("lastUpdater", String.class, false, false), + CREATOR_FULL_NAME("creatorFullName", String.class, false, false), + UPDATER_FULL_NAME("updaterFullName", String.class, false, false), + ES_ID("esId", String.class, false, false), + ARTIFACT_LABEL("artifactLabel", String.class, false, true), + ARTIFACT_DISPLAY_NAME("artifactDisplayName", String.class, false, true), + INSTANCE_COUNTER("instanceCounter", Integer.class, false, false), + PROJECT_CODE("projectCode", String.class, false, false), + DISTRIBUTION_STATUS("distributionStatus", String.class, false, false), + IS_VNF("isVNF", Boolean.class, false, false), + LAST_LOGIN_TIME("lastLoginTime", Long.class, false, true), + ATTRIBUTE_COUNTER("attributeCounter", Integer.class, false, false), + INPUT_COUNTER("inputCounter", Integer.class, false, false), + PROPERTY_COUNTER("propertyCounter", Integer.class, false, false), + API_URL("apiUrl", String.class, false, false), + SERVICE_API("serviceApi", Boolean.class, false, true), + ADDITIONAL_INFO_PARAMS("additionalInfo", String.class, false, false), + ADDITIONAL_INFO_ID_TO_KEY("idToKey", String.class, false, false), + ARTIFACT_GROUP_TYPE("artifactGroupType", String.class, false, true), + ARTIFACT_TIMEOUT("timeout", Integer.class, false, false), + IS_ACTIVE("isActive", Boolean.class, false, true), + PROPERTY_VALUE_RULES("propertyValueRules", String.class, false, false), + //authantication + CONSUMER_NAME("consumerName", String.class, true, true), + CONSUMER_PASSWORD("consumerPassword", String.class, false, false), + CONSUMER_SALT("consumerSalt", String.class, false, false), + CONSUMER_LAST_AUTHENTICATION_TIME("consumerLastAuthenticationTime", Long.class, false, false), + CONSUMER_DETAILS_LAST_UPDATED_TIME("consumerDetailsLastupdatedtime", Long.class, false, false), + LAST_MODIFIER_USER_ID("lastModfierUserId", String.class, false, false), + ARTIFACT_VERSION("artifactVersion", String.class, false, false), + ARTIFACT_UUID("artifactUUID", String.class, false, false), + PAYLOAD_UPDATE_DATE("payloadUpdateDate", Long.class, false, false), + HEAT_PARAMS_UPDATE_DATE("heatParamsUpdateDate", Long.class, false, false), + //product + FULL_NAME("fullName", String.class, false, true), + //was changed as part of migration from 1602 to 1602 ( in 1602 was defined as unique. it's problem to reconfigure the index ) + CONSTANT_UUID("constantUuidNew", String.class, false, true), + CONTACTS("contacts", String.class, false, false), + //categorys + ICONS("icons", String.class, false, false), + //relation + CAPABILITY_OWNER_ID("capOwnerId", String.class, false, false), + REQUIREMENT_OWNER_ID("reqOwnerId", String.class, false, false), + CAPABILITY_ID("capabiltyId", String.class, false, false), + REQUIREMENT_ID("requirementId", String.class, false, false), + PROPERTY_ID("propertyId", String.class, false, false), + PROPERTY_NAME("propertyName", String.class, false, false), + //component instance + ORIGIN_TYPE("originType", String.class, false, false), + //requirement & capabilty + MIN_OCCURRENCES("minOccurrences", String.class, false, false), + MAX_OCCURRENCES("maxOccurrences", String.class, false, false), + //Data type + DERIVED_FROM("derivedFrom", String.class, false, false), + MEMBERS("members", String.class, false, false), + TARGETS("targets ", String.class, false, false), + METADATA("metadata", String.class, false, false), + INVARIANT_UUID("invariantUuid", String.class, false, true), + IS_BASE("isBase", Boolean.class, false, true), + GROUP_UUID("groupUuid", String.class, false, true), + STATUS("status", String.class, false, false), + FUNCTIONAL_MENU("functionalMenu", String.class, false, false), + REQUIRED_ARTIFACTS("requiredArtifacts", String.class, false, false), + CUSTOMIZATION_UUID("customizationUUID", String.class, false, false), + IS_ARCHIVED("isArchived", Boolean.class, false, true), + IS_VSP_ARCHIVED("isVspArchived", Boolean.class, false, true), + ARCHIVE_TIME("archiveTime", Long.class, false, true); - private final String property; - private final Class clazz; - private final boolean unique; - private final boolean indexed; - - GraphPropertiesDictionary(String property,Class clazz, boolean unique,boolean indexed) { - this.property = property; - this.clazz = clazz; - this.unique = unique; - this.indexed = indexed; - } - + private final String property; + private final Class clazz; + private final boolean unique; + private final boolean indexed; - public String getProperty() { - return property; - } + GraphPropertiesDictionary(String property, Class clazz, boolean unique, boolean indexed) { + this.property = property; + this.clazz = clazz; + this.unique = unique; + this.indexed = indexed; + } - public Class getClazz() { - return clazz; - } - public boolean isUnique() { - return unique; - } + public String getProperty() { + return property; + } - public boolean isIndexed() { - return indexed; - } + public Class getClazz() { + return clazz; + } + + public boolean isUnique() { + return unique; + } + + public boolean isIndexed() { + return indexed; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/RelationshipTypeData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/RelationshipTypeData.java index 32a86e42ce..440cddad55 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/RelationshipTypeData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/RelationshipTypeData.java @@ -57,13 +57,20 @@ public class RelationshipTypeData extends GraphNode { relationshipTypeDataDefinition .setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); - Type listType = new TypeToken<List<String>>() { + Type listSourceType = new TypeToken<List<String>>() { }.getType(); List<String> validSourceTypesfromJson = getGson().fromJson( - (String) properties.get(GraphPropertiesDictionary.VALID_SOURCE_TYPES.getProperty()), listType); + (String) properties.get(GraphPropertiesDictionary.VALID_SOURCE_TYPES.getProperty()), listSourceType); relationshipTypeDataDefinition.setValidSourceTypes(validSourceTypesfromJson); + Type listTargetType = new TypeToken<List<String>>() { + }.getType(); + List<String> validTargetTypesfromJson = getGson().fromJson( + (String) properties.get(GraphPropertiesDictionary.VALID_TARGET_TYPES.getProperty()), listTargetType); + + relationshipTypeDataDefinition.setValidTargetTypes(validTargetTypesfromJson); + // relationshipTypeDataDefinition.setValidSourceTypes((List<String>) // properties.get(GraphPropertiesDictionary.VALID_SOURCE_TYPES // .getProperty())); @@ -98,6 +105,9 @@ public class RelationshipTypeData extends GraphNode { addIfExists(map, GraphPropertiesDictionary.VALID_SOURCE_TYPES, relationshipTypeDataDefinition.getValidSourceTypes()); + addIfExists(map, GraphPropertiesDictionary.VALID_TARGET_TYPES, + relationshipTypeDataDefinition.getValidTargetTypes()); + addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, relationshipTypeDataDefinition.getCreationTime()); addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, |