WIP: Add operation request column in dynamic task #347

Closed
Gimhan-minion wants to merge 1 commits from Gimhan-minion/device-mgt-core:operation-request into master

@ -27,6 +27,7 @@ public class DynamicTask {
private boolean isEnabled;
private int tenantId;
private String taskClassName;
private String operationRequest;
private Map<String, String> 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<String, String> getProperties() {
return properties;
}

@ -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();

@ -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"));

Loading…
Cancel
Save