From 16cf3e4775138210b7781aa2a2644e45d395b6fe Mon Sep 17 00:00:00 2001 From: Gimhan-minion Date: Wed, 14 Feb 2024 01:25:15 +0530 Subject: [PATCH] Add operation request column in dynamic task --- .../mgt/core/task/mgt/common/bean/DynamicTask.java | 9 +++++++++ .../core/task/mgt/core/dao/impl/DynamicTaskDAOImpl.java | 7 ++++--- .../task/mgt/core/dao/util/TaskManagementDAOUtil.java | 1 + 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/src/main/java/io/entgra/device/mgt/core/task/mgt/common/bean/DynamicTask.java b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/src/main/java/io/entgra/device/mgt/core/task/mgt/common/bean/DynamicTask.java index a37925865e..c663a8e057 100755 --- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/src/main/java/io/entgra/device/mgt/core/task/mgt/common/bean/DynamicTask.java +++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/src/main/java/io/entgra/device/mgt/core/task/mgt/common/bean/DynamicTask.java @@ -27,6 +27,7 @@ public class DynamicTask { private boolean isEnabled; private int tenantId; private String taskClassName; + private String operationRequest; private Map properties; public int getDynamicTaskId() { @@ -77,6 +78,14 @@ public class DynamicTask { this.taskClassName = taskClassName; } + public String getOperationRequest() { + return operationRequest; + } + + public void setOperationRequest(String operationRequest) { + this.operationRequest = operationRequest; + } + public Map getProperties() { return properties; } diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/dao/impl/DynamicTaskDAOImpl.java b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/dao/impl/DynamicTaskDAOImpl.java index f115176717..1cb33659df 100755 --- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/dao/impl/DynamicTaskDAOImpl.java +++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/dao/impl/DynamicTaskDAOImpl.java @@ -40,15 +40,16 @@ public class DynamicTaskDAOImpl implements DynamicTaskDAO { int taskId = -1; try { Connection conn = TaskManagementDAOFactory.getConnection(); - String sql = "INSERT INTO DYNAMIC_TASK(CRON, NAME, IS_ENABLED, TASK_CLASS_NAME, TENANT_ID) " + - "VALUES (?, ?, ?, ?, ?)"; + String sql = "INSERT INTO DYNAMIC_TASK(CRON, NAME, IS_ENABLED, TASK_CLASS_NAME, OPERATION_REQUEST, TENANT_ID) " + + "VALUES (?, ?, ?, ?, ?, ?)"; stmt = conn.prepareStatement(sql, new String[]{"DYNAMIC_TASK_ID"}); stmt.setString(1, dynamicTask.getCronExpression()); stmt.setString(2, dynamicTask.getName()); stmt.setBoolean(3, dynamicTask.isEnabled()); stmt.setString(4, dynamicTask.getTaskClassName()); - stmt.setInt(5, PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId()); + stmt.setString(5, dynamicTask.getOperationRequest()); + stmt.setInt(6, PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId()); stmt.executeUpdate(); rs = stmt.getGeneratedKeys(); diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/dao/util/TaskManagementDAOUtil.java b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/dao/util/TaskManagementDAOUtil.java index e2bb3c1bd3..1be04ae572 100755 --- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/dao/util/TaskManagementDAOUtil.java +++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/dao/util/TaskManagementDAOUtil.java @@ -93,6 +93,7 @@ public class TaskManagementDAOUtil { dynamicTask.setDynamicTaskId(rs.getInt("DYNAMIC_TASK_ID")); dynamicTask.setName(rs.getString("NAME")); dynamicTask.setCronExpression(rs.getString("CRON")); + dynamicTask.setOperationRequest(rs.getString("OPERATION_REQUEST")); dynamicTask.setTaskClassName(rs.getString("TASK_CLASS_NAME")); dynamicTask.setEnabled(rs.getBoolean("IS_ENABLED")); dynamicTask.setTenantId(rs.getInt("TENANT_ID")); -- 2.36.3