From cf04a1a714ef4a1df973929dc750232b4d67d7b4 Mon Sep 17 00:00:00 2001 From: Kartik Hegde Date: Sat, 12 Nov 2022 14:29:11 +0530 Subject: Multitenancy in SDC Issue-ID: SDC-4215 Change-Id: Ie24ba38acc9f1998d4a7e722e8f98456dab9201d Signed-off-by: Kartik Hegde --- .../src/main/java/org/openecomp/sdc/be/dao/api/ActionStatus.java | 4 +++- .../org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionary.java | 1 + .../sdc/be/dao/neo4j/GraphPropertiesDictionaryExtractor.java | 4 ++++ .../org/openecomp/sdc/be/resources/data/ComponentMetadataData.java | 2 ++ .../org/openecomp/sdc/be/resources/data/ResourceMetadataData.java | 2 ++ 5 files changed, 12 insertions(+), 1 deletion(-) (limited to 'catalog-dao') 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 cd5a6e5d7a..0150ebe891 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 @@ -150,5 +150,7 @@ public enum ActionStatus { COMPONENT_PROPERTY_NOT_FOUND, INVALID_COMPONENT_TYPE, DATA_TYPE_PROPERTY_ALREADY_EXISTS, - UNEXPECTED_ERROR + UNEXPECTED_ERROR, + //Tenant + MISSING_TENANT, TENANT_NAME_EXCEEDS_LIMIT, INVALID_TENANT_NAME, UNAUTHORIZED_TENANT } 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 c689298fc1..15fc013173 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 @@ -50,6 +50,7 @@ public enum GraphPropertiesDictionary { CONSTRAINTS ("constraints", String.class, false, false), CONTACT_ID ("contactId", String.class, false, false), VENDOR_NAME ("vendorName", String.class, false, false), + TENANT ("tenant", String.class, false, false), VENDOR_RELEASE ("vendorRelease", String.class, false, false), MODEL ("model", String.class, false, false), MODEL_TYPE ("modelType", String.class, false, false), diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionaryExtractor.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionaryExtractor.java index 3b11743050..da32017d90 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionaryExtractor.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionaryExtractor.java @@ -136,6 +136,10 @@ public class GraphPropertiesDictionaryExtractor { return (String) properties.get(GraphPropertiesDictionary.VENDOR_NAME.getProperty()); } + public String getTenant() { + return (String) properties.get(GraphPropertiesDictionary.TENANT.getProperty()); + } + public String getVendorRelease() { return (String) properties.get(GraphPropertiesDictionary.VENDOR_RELEASE.getProperty()); } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ComponentMetadataData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ComponentMetadataData.java index 602d53ed26..7f05f56f13 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ComponentMetadataData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ComponentMetadataData.java @@ -63,6 +63,7 @@ public abstract class ComponentMetadataData extends GraphNode { metadataDataDefinition.setImportedToscaChecksum(extractor.getImportedToscaChecksum()); metadataDataDefinition.setInvariantUUID(extractor.getInvariantUuid()); metadataDataDefinition.setModel(extractor.getModel()); + metadataDataDefinition.setTenant(extractor.getTenant()); componentInstanceCounter = extractor.getInstanceCounter(); } @@ -92,6 +93,7 @@ public abstract class ComponentMetadataData extends GraphNode { addIfExists(map, GraphPropertiesDictionary.IMPORTED_TOSCA_CHECKSUM, metadataDataDefinition.getImportedToscaChecksum()); addIfExists(map, GraphPropertiesDictionary.INVARIANT_UUID, metadataDataDefinition.getInvariantUUID()); addIfExists(map, GraphPropertiesDictionary.MODEL, metadataDataDefinition.getModel()); + addIfExists(map, GraphPropertiesDictionary.TENANT, metadataDataDefinition.getTenant()); return map; } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ResourceMetadataData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ResourceMetadataData.java index 1b5f948c1c..6eb56932ec 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ResourceMetadataData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ResourceMetadataData.java @@ -47,6 +47,7 @@ public class ResourceMetadataData extends ComponentMetadataData { resourceMetadataDataDefinition.setLicenseType(extractor.getLicenseType()); resourceMetadataDataDefinition.setToscaResourceName(extractor.getToscaResourceName()); resourceMetadataDataDefinition.setCsarVersionId(extractor.getCsarVersionId()); + resourceMetadataDataDefinition.setTenant(extractor.getTenant()); } @Override @@ -61,6 +62,7 @@ public class ResourceMetadataData extends ComponentMetadataData { addIfExists(graphMap, GraphPropertiesDictionary.LICENSE_TYPE, resourceMetadataDataDefinition.getLicenseType()); addIfExists(graphMap, GraphPropertiesDictionary.TOSCA_RESOURCE_NAME, resourceMetadataDataDefinition.getToscaResourceName()); addIfExists(graphMap, GraphPropertiesDictionary.CSAR_VERSION_ID, resourceMetadataDataDefinition.getCsarVersionId()); + addIfExists(graphMap, GraphPropertiesDictionary.TENANT, resourceMetadataDataDefinition.getTenant()); return graphMap; } } -- cgit 1.2.3-korg