diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.common/src/main/java/io/entgra/device/mgt/core/factory/mgt/common/spi/ProductionPlanService.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.common/src/main/java/io/entgra/device/mgt/core/factory/mgt/common/spi/ProductionPlanService.java index a462e932ed3..8363b32fc8e 100644 --- a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.common/src/main/java/io/entgra/device/mgt/core/factory/mgt/common/spi/ProductionPlanService.java +++ b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.common/src/main/java/io/entgra/device/mgt/core/factory/mgt/common/spi/ProductionPlanService.java @@ -21,8 +21,8 @@ package io.entgra.device.mgt.core.factory.mgt.common.spi; import io.entgra.device.mgt.core.factory.mgt.common.bean.PaginatedMeterRequestQuery; import io.entgra.device.mgt.core.factory.mgt.common.dto.ProductionPlan; -import io.entgra.device.mgt.core.factory.mgt.common.exception.FactoryMgtException; import io.entgra.device.mgt.core.factory.mgt.common.exception.BadRequestException; +import io.entgra.device.mgt.core.factory.mgt.common.exception.FactoryMgtException; import io.entgra.device.mgt.core.factory.mgt.common.exception.FactoryMgtPluginException; import io.entgra.device.mgt.core.factory.mgt.common.responses.BulkStatusResponse; import io.entgra.device.mgt.core.factory.mgt.common.wrapper.ProductionPlanWrapper; @@ -31,8 +31,6 @@ import java.util.List; public interface ProductionPlanService { - boolean addProductionPlan(ProductionPlan productionPlan) throws FactoryMgtPluginException; - BulkStatusResponse addProductionPlanBulk(List productionPlans) throws FactoryMgtPluginException; boolean updateProductionPlan(ProductionPlan productionPlan) throws FactoryMgtPluginException, FactoryMgtException; diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/config/FactoryConfigurationManager.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/config/FactoryConfigurationManager.java index 13edf24bf0e..e971f578606 100644 --- a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/config/FactoryConfigurationManager.java +++ b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/config/FactoryConfigurationManager.java @@ -18,10 +18,10 @@ package io.entgra.device.mgt.core.factory.mgt.core.config; -import org.w3c.dom.Document; import io.entgra.device.mgt.core.factory.mgt.common.util.FactoryMgtConstants; import io.entgra.device.mgt.core.factory.mgt.common.exception.FactoryMgtException; import io.entgra.device.mgt.core.factory.mgt.core.util.FactoryMgtUtil; +import org.w3c.dom.Document; import org.wso2.carbon.utils.CarbonUtils; import javax.xml.bind.JAXBContext; diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/service/impl/ProductionPlanServiceImpl.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/service/impl/ProductionPlanServiceImpl.java index 817b341c04e..fafd3615129 100644 --- a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/service/impl/ProductionPlanServiceImpl.java +++ b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/service/impl/ProductionPlanServiceImpl.java @@ -51,42 +51,6 @@ public class ProductionPlanServiceImpl implements ProductionPlanService { this.factoryMgtDAO = FactoryMgtDAOFactory.getFactoryMgtDAO(); } - @Override - public boolean addProductionPlan(ProductionPlan productionPlan) throws FactoryMgtPluginException { - try { - FactoryMgtDAOFactory.beginTransaction(); - boolean result = factoryMgtDAO.addProductionPlan(productionPlan); - if (result) { - String msg = "Factory Production plan added successfully, for productId: " + productionPlan.getProductId() + - " and machineId: " + productionPlan.getMachineId(); - if (log.isDebugEnabled()) { - log.debug(msg); - } - } else { - FactoryMgtDAOFactory.rollbackTransaction(); - String msg = "Production plan failed to add, for productId: " + productionPlan.getProductId() + - " and machineId: " + productionPlan.getMachineId(); - throw new FactoryMgtPluginException(msg); - } - FactoryMgtDAOFactory.commitTransaction(); - return true; - } catch (TransactionManagementException e) { - FactoryMgtDAOFactory.rollbackTransaction(); - String msg = "Error occurred while obtaining the database connection to add production plan for productId: " + - productionPlan.getProductId() + " and machineId: " + productionPlan.getMachineId(); - log.error(msg); - throw new FactoryMgtPluginException(msg, e); - } catch (FactoryMgtDAOException e) { - FactoryMgtDAOFactory.rollbackTransaction(); - String msg = "Error occurred in the database level while adding production plan for productId: " + - productionPlan.getProductId() + " and machineId: " + productionPlan.getMachineId(); - log.error(msg); - throw new FactoryMgtPluginException(msg, e); - } finally { - FactoryMgtDAOFactory.closeConnection(); - } - } - @Override public BulkStatusResponse addProductionPlanBulk(List productionPlans) throws FactoryMgtPluginException { List successDevices = new ArrayList<>();