summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogicProvider.java
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogicProvider.java')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogicProvider.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogicProvider.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogicProvider.java
new file mode 100644
index 0000000000..3025084239
--- /dev/null
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogicProvider.java
@@ -0,0 +1,37 @@
+package org.openecomp.sdc.be.components.impl;
+
+import org.openecomp.sdc.be.components.impl.exceptions.ComponentException;
+import org.openecomp.sdc.be.config.BeEcompErrorManager;
+import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ComponentBusinessLogicProvider {
+
+ private final ResourceBusinessLogic resourceBusinessLogic;
+ private final ServiceBusinessLogic serviceBusinessLogic;
+ private final ProductBusinessLogic productBusinessLogic;
+
+ public ComponentBusinessLogicProvider(ResourceBusinessLogic resourceBusinessLogic, ServiceBusinessLogic serviceBusinessLogic, ProductBusinessLogic productBusinessLogic) {
+ this.resourceBusinessLogic = resourceBusinessLogic;
+ this.serviceBusinessLogic = serviceBusinessLogic;
+ this.productBusinessLogic = productBusinessLogic;
+ }
+
+ public ComponentBusinessLogic getInstance(ComponentTypeEnum componentTypeEnum) {
+ switch (componentTypeEnum) {
+ case SERVICE:
+ return serviceBusinessLogic;
+ case PRODUCT:
+ return productBusinessLogic;
+ case RESOURCE:
+ case RESOURCE_INSTANCE:
+ return resourceBusinessLogic;
+ default:
+ BeEcompErrorManager.getInstance().logBeSystemError("getComponentBL");
+ throw new ComponentException(ActionStatus.INVALID_CONTENT_PARAM, componentTypeEnum.getValue());
+ }
+ }
+
+}