From 3b59638415cb5cde445f9609dce3f439e2b3381d Mon Sep 17 00:00:00 2001 From: Rushdi Date: Fri, 4 Aug 2023 09:03:43 +0530 Subject: [PATCH] Refactor --- .../device/mgt/core/factory/mgt/api/beans/ErrorResponse.java | 2 -- .../device/mgt/core/factory/mgt/core/dao/FactoryMgtDAO.java | 2 +- .../mgt/core/factory/mgt/core/dao/impl/FactoryMgtDAOImpl.java | 4 ++-- .../mgt/core/factory/mgt/core/util/FactoryMgtDAOUtil.java | 1 + .../device/mgt/core/factory/mgt/core/util/FactoryMgtUtil.java | 1 + .../entgra/device/mgt/core/factory/mgt/core/ServiceTest.java | 3 +-- 6 files changed, 6 insertions(+), 7 deletions(-) diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/java/io/entgra/device/mgt/core/factory/mgt/api/beans/ErrorResponse.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/java/io/entgra/device/mgt/core/factory/mgt/api/beans/ErrorResponse.java index d826d94189a..7259daef144 100644 --- a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/java/io/entgra/device/mgt/core/factory/mgt/api/beans/ErrorResponse.java +++ b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/java/io/entgra/device/mgt/core/factory/mgt/api/beans/ErrorResponse.java @@ -153,5 +153,3 @@ public class ErrorResponse { } } - - 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/dao/FactoryMgtDAO.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/dao/FactoryMgtDAO.java index 62bdb95e2c7..b68ee1f62bd 100644 --- a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/dao/FactoryMgtDAO.java +++ b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/dao/FactoryMgtDAO.java @@ -24,7 +24,7 @@ import io.entgra.device.mgt.core.factory.mgt.common.dto.ProductionPlan; public interface FactoryMgtDAO extends BaseRequestDAO { - boolean addProductionPlan(ProductionPlan productionPlan) throws FactoryMgtPluginException, FactoryMgtDAOException; + void addProductionPlan(ProductionPlan productionPlan) throws FactoryMgtPluginException, FactoryMgtDAOException; boolean updateProductionPlan(ProductionPlan productionPlan) throws FactoryMgtPluginException, FactoryMgtDAOException; 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/dao/impl/FactoryMgtDAOImpl.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/dao/impl/FactoryMgtDAOImpl.java index f3d638b5bbc..720e811a277 100644 --- a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/dao/impl/FactoryMgtDAOImpl.java +++ b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/dao/impl/FactoryMgtDAOImpl.java @@ -38,7 +38,7 @@ public class FactoryMgtDAOImpl implements FactoryMgtDAO { private static final Log log = LogFactory.getLog(FactoryMgtDAOImpl.class); @Override - public boolean addProductionPlan(ProductionPlan productionPlan) throws FactoryMgtDAOException { + public void addProductionPlan(ProductionPlan productionPlan) throws FactoryMgtDAOException { String sql = "INSERT INTO PRODUCTION_PLAN (DATE, TIME, MACHINE_ID, PRODUCT_ID, TARGET) VALUES (?, ?, ?, ?, ?)"; try { int paramIndex = 1; @@ -49,7 +49,7 @@ public class FactoryMgtDAOImpl implements FactoryMgtDAO { stmt.setString(paramIndex++, productionPlan.getMachineId()); stmt.setString(paramIndex++, productionPlan.getProductId()); stmt.setInt(paramIndex, productionPlan.getTarget()); - return stmt.executeUpdate() > 0; + stmt.executeUpdate(); } } catch (SQLException e) { 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/util/FactoryMgtDAOUtil.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/util/FactoryMgtDAOUtil.java index 236b2639b0a..8e4cd6d548d 100644 --- a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/util/FactoryMgtDAOUtil.java +++ b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/util/FactoryMgtDAOUtil.java @@ -108,4 +108,5 @@ public class FactoryMgtDAOUtil { } return productionPlans; } + } 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/util/FactoryMgtUtil.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/util/FactoryMgtUtil.java index 1bfbadcf5b9..2c2b4cc9c3c 100644 --- a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/util/FactoryMgtUtil.java +++ b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/util/FactoryMgtUtil.java @@ -15,6 +15,7 @@ * specific language governing permissions and limitations * under the License. */ + package io.entgra.device.mgt.core.factory.mgt.core.util; import io.entgra.device.mgt.core.factory.mgt.common.exception.FactoryMgtException; diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/test/java/io/entgra/device/mgt/core/factory/mgt/core/ServiceTest.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/test/java/io/entgra/device/mgt/core/factory/mgt/core/ServiceTest.java index 1a246bbb906..27dc3ee501f 100644 --- a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/test/java/io/entgra/device/mgt/core/factory/mgt/core/ServiceTest.java +++ b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/test/java/io/entgra/device/mgt/core/factory/mgt/core/ServiceTest.java @@ -18,7 +18,6 @@ package io.entgra.device.mgt.core.factory.mgt.core; -import com.google.gson.Gson; 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; @@ -27,8 +26,8 @@ import io.entgra.device.mgt.core.factory.mgt.common.responses.BulkStatusResponse import io.entgra.device.mgt.core.factory.mgt.common.spi.ProductionPlanService; import io.entgra.device.mgt.core.factory.mgt.common.wrapper.ProductionPlanWrapper; import io.entgra.device.mgt.core.factory.mgt.core.mock.BaseFactoryMgtPluginTest; - import io.entgra.device.mgt.core.factory.mgt.core.service.impl.ProductionPlanServiceImpl; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.testng.Assert;