|
|
@ -28,6 +28,7 @@ import org.wso2.carbon.device.mgt.common.operation.mgt.ActivityHolder;
|
|
|
|
import org.wso2.carbon.device.mgt.common.operation.mgt.ActivityStatus;
|
|
|
|
import org.wso2.carbon.device.mgt.common.operation.mgt.ActivityStatus;
|
|
|
|
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationResponse;
|
|
|
|
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationResponse;
|
|
|
|
import org.wso2.carbon.device.mgt.core.DeviceManagementConstants;
|
|
|
|
import org.wso2.carbon.device.mgt.core.DeviceManagementConstants;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
|
|
|
|
import org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation;
|
|
|
|
import org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation;
|
|
|
|
import org.wso2.carbon.device.mgt.core.dto.operation.mgt.OperationResponseMeta;
|
|
|
|
import org.wso2.carbon.device.mgt.core.dto.operation.mgt.OperationResponseMeta;
|
|
|
|
import org.wso2.carbon.device.mgt.core.operation.mgt.OperationMapping;
|
|
|
|
import org.wso2.carbon.device.mgt.core.operation.mgt.OperationMapping;
|
|
|
@ -72,8 +73,8 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
"INITIATED_BY, OPERATION_DETAILS) VALUES (?, ?, ?, ?, ?, ?)";
|
|
|
|
"INITIATED_BY, OPERATION_DETAILS) VALUES (?, ?, ?, ?, ?, ?)";
|
|
|
|
stmt = connection.prepareStatement(sql, new String[]{"id"});
|
|
|
|
stmt = connection.prepareStatement(sql, new String[]{"id"});
|
|
|
|
stmt.setString(1, operation.getType().toString());
|
|
|
|
stmt.setString(1, operation.getType().toString());
|
|
|
|
stmt.setTimestamp(2, new Timestamp(new Date().getTime()));
|
|
|
|
stmt.setLong(2, DeviceManagementDAOUtil.getCurrentUTCTime());
|
|
|
|
stmt.setTimestamp(3, null);
|
|
|
|
stmt.setLong(3, 0);
|
|
|
|
stmt.setString(4, operation.getCode());
|
|
|
|
stmt.setString(4, operation.getCode());
|
|
|
|
stmt.setString(5, operation.getInitiatedBy());
|
|
|
|
stmt.setString(5, operation.getInitiatedBy());
|
|
|
|
stmt.setObject(6, operation);
|
|
|
|
stmt.setObject(6, operation);
|
|
|
@ -98,7 +99,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
boolean isUpdated = false;
|
|
|
|
boolean isUpdated = false;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
long time = System.currentTimeMillis() / 1000;
|
|
|
|
long time = DeviceManagementDAOUtil.getCurrentUTCTime();
|
|
|
|
Connection connection = OperationManagementDAOFactory.getConnection();
|
|
|
|
Connection connection = OperationManagementDAOFactory.getConnection();
|
|
|
|
stmt = connection.prepareStatement("UPDATE DM_ENROLMENT_OP_MAPPING SET STATUS=?, UPDATED_TIMESTAMP=? " +
|
|
|
|
stmt = connection.prepareStatement("UPDATE DM_ENROLMENT_OP_MAPPING SET STATUS=?, UPDATED_TIMESTAMP=? " +
|
|
|
|
"WHERE ENROLMENT_ID=? and OPERATION_ID=?");
|
|
|
|
"WHERE ENROLMENT_ID=? and OPERATION_ID=?");
|
|
|
@ -440,7 +441,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
activity = new Activity();
|
|
|
|
activity = new Activity();
|
|
|
|
activity.setActivityId(DeviceManagementConstants.OperationAttributes.ACTIVITY + operationId);
|
|
|
|
activity.setActivityId(DeviceManagementConstants.OperationAttributes.ACTIVITY + operationId);
|
|
|
|
activity.setType(Activity.Type.valueOf(rs.getString("OPERATION_TYPE")));
|
|
|
|
activity.setType(Activity.Type.valueOf(rs.getString("OPERATION_TYPE")));
|
|
|
|
activity.setCreatedTimeStamp(new java.util.Date(rs.getLong(("CREATED_TIMESTAMP")) * 1000).toString());
|
|
|
|
activity.setCreatedTimeStamp(new Date(rs.getLong(("CREATED_TIMESTAMP")) * 1000).toString());
|
|
|
|
activity.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
activity.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
activity.setInitiatedBy(rs.getString("INITIATED_BY"));
|
|
|
|
activity.setInitiatedBy(rs.getString("INITIATED_BY"));
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -456,7 +457,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
|
|
|
|
|
|
|
|
List<OperationResponse> operationResponses = new ArrayList<>();
|
|
|
|
List<OperationResponse> operationResponses = new ArrayList<>();
|
|
|
|
if (rs.getInt("UPDATED_TIMESTAMP") != 0) {
|
|
|
|
if (rs.getInt("UPDATED_TIMESTAMP") != 0) {
|
|
|
|
activityStatus.setUpdatedTimestamp(new java.util.Date(rs.getLong(("UPDATED_TIMESTAMP")) * 1000).toString());
|
|
|
|
activityStatus.setUpdatedTimestamp(new Date(rs.getLong(("UPDATED_TIMESTAMP")) * 1000).toString());
|
|
|
|
operationResponses.add(OperationDAOUtil.getOperationResponse(rs));
|
|
|
|
operationResponses.add(OperationDAOUtil.getOperationResponse(rs));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
activityStatus.setResponses(operationResponses);
|
|
|
|
activityStatus.setResponses(operationResponses);
|
|
|
@ -556,7 +557,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
|
|
|
|
|
|
|
|
activity.setType(Activity.Type.valueOf(rs.getString("OPERATION_TYPE")));
|
|
|
|
activity.setType(Activity.Type.valueOf(rs.getString("OPERATION_TYPE")));
|
|
|
|
activity.setCreatedTimeStamp(
|
|
|
|
activity.setCreatedTimeStamp(
|
|
|
|
new java.util.Date(rs.getLong(("CREATED_TIMESTAMP")) * 1000).toString());
|
|
|
|
new Date(rs.getLong(("CREATED_TIMESTAMP")) * 1000).toString());
|
|
|
|
activity.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
activity.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
activity.setInitiatedBy(rs.getString("INITIATED_BY"));
|
|
|
|
activity.setInitiatedBy(rs.getString("INITIATED_BY"));
|
|
|
|
|
|
|
|
|
|
|
@ -571,7 +572,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
List<OperationResponse> operationResponses = new ArrayList<>();
|
|
|
|
List<OperationResponse> operationResponses = new ArrayList<>();
|
|
|
|
if (rs.getInt("UPDATED_TIMESTAMP") != 0) {
|
|
|
|
if (rs.getInt("UPDATED_TIMESTAMP") != 0) {
|
|
|
|
activityStatus.setUpdatedTimestamp(
|
|
|
|
activityStatus.setUpdatedTimestamp(
|
|
|
|
new java.util.Date(rs.getLong(("UPDATED_TIMESTAMP")) * 1000).toString());
|
|
|
|
new Date(rs.getLong(("UPDATED_TIMESTAMP")) * 1000).toString());
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (rs.getTimestamp("RECEIVED_TIMESTAMP") != null) {
|
|
|
|
if (rs.getTimestamp("RECEIVED_TIMESTAMP") != null) {
|
|
|
@ -595,7 +596,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
|
|
|
|
|
|
|
|
activity.setType(Activity.Type.valueOf(rs.getString("OPERATION_TYPE")));
|
|
|
|
activity.setType(Activity.Type.valueOf(rs.getString("OPERATION_TYPE")));
|
|
|
|
activity.setCreatedTimeStamp(
|
|
|
|
activity.setCreatedTimeStamp(
|
|
|
|
new java.util.Date(rs.getLong(("CREATED_TIMESTAMP")) * 1000).toString());
|
|
|
|
new Date(rs.getLong(("CREATED_TIMESTAMP")) * 1000).toString());
|
|
|
|
activity.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
activity.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
|
|
|
|
|
|
|
|
DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
|
|
|
|
DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
|
|
|
@ -608,7 +609,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
List<OperationResponse> operationResponses = new ArrayList<>();
|
|
|
|
List<OperationResponse> operationResponses = new ArrayList<>();
|
|
|
|
if (rs.getInt("UPDATED_TIMESTAMP") != 0) {
|
|
|
|
if (rs.getInt("UPDATED_TIMESTAMP") != 0) {
|
|
|
|
activityStatus.setUpdatedTimestamp(
|
|
|
|
activityStatus.setUpdatedTimestamp(
|
|
|
|
new java.util.Date(rs.getLong(("UPDATED_TIMESTAMP")) * 1000).toString());
|
|
|
|
new Date(rs.getLong(("UPDATED_TIMESTAMP")) * 1000).toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (rs.getTimestamp("RECEIVED_TIMESTAMP") != null) {
|
|
|
|
if (rs.getTimestamp("RECEIVED_TIMESTAMP") != null) {
|
|
|
|
responseId = rs.getInt("OP_RES_ID");
|
|
|
|
responseId = rs.getInt("OP_RES_ID");
|
|
|
@ -694,7 +695,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
activity.setActivityId(DeviceManagementConstants.OperationAttributes.ACTIVITY + operationId);
|
|
|
|
activity.setActivityId(DeviceManagementConstants.OperationAttributes.ACTIVITY + operationId);
|
|
|
|
activity.setType(Activity.Type.valueOf(rs.getString("OPERATION_TYPE")));
|
|
|
|
activity.setType(Activity.Type.valueOf(rs.getString("OPERATION_TYPE")));
|
|
|
|
activity.setCreatedTimeStamp(
|
|
|
|
activity.setCreatedTimeStamp(
|
|
|
|
new java.util.Date(rs.getLong(("CREATED_TIMESTAMP")) * 1000).toString());
|
|
|
|
new Date(rs.getLong(("CREATED_TIMESTAMP")) * 1000).toString());
|
|
|
|
activity.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
activity.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
activity.setInitiatedBy(rs.getString("INITIATED_BY"));
|
|
|
|
activity.setInitiatedBy(rs.getString("INITIATED_BY"));
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -708,7 +709,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
List<OperationResponse> operationResponses = new ArrayList<>();
|
|
|
|
List<OperationResponse> operationResponses = new ArrayList<>();
|
|
|
|
if (rs.getInt("UPDATED_TIMESTAMP") != 0) {
|
|
|
|
if (rs.getInt("UPDATED_TIMESTAMP") != 0) {
|
|
|
|
activityStatus.setUpdatedTimestamp(
|
|
|
|
activityStatus.setUpdatedTimestamp(
|
|
|
|
new java.util.Date(rs.getLong(("UPDATED_TIMESTAMP")) * 1000).toString());
|
|
|
|
new Date(rs.getLong(("UPDATED_TIMESTAMP")) * 1000).toString());
|
|
|
|
if (rs.getBoolean("IS_LARGE_RESPONSE")) {
|
|
|
|
if (rs.getBoolean("IS_LARGE_RESPONSE")) {
|
|
|
|
largeResponseIDs.add(rs.getInt("OP_RES_ID"));
|
|
|
|
largeResponseIDs.add(rs.getInt("OP_RES_ID"));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -842,7 +843,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
enrolmentId = rs.getInt("ENROLMENT_ID");
|
|
|
|
enrolmentId = rs.getInt("ENROLMENT_ID");
|
|
|
|
|
|
|
|
|
|
|
|
activity.setType(Activity.Type.valueOf(rs.getString("OPERATION_TYPE")));
|
|
|
|
activity.setType(Activity.Type.valueOf(rs.getString("OPERATION_TYPE")));
|
|
|
|
activity.setCreatedTimeStamp(new java.util.Date(rs.getLong(("CREATED_TIMESTAMP")) * 1000).toString());
|
|
|
|
activity.setCreatedTimeStamp(new Date(rs.getLong(("CREATED_TIMESTAMP")) * 1000).toString());
|
|
|
|
activity.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
activity.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
activity.setInitiatedBy(rs.getString("INITIATED_BY"));
|
|
|
|
activity.setInitiatedBy(rs.getString("INITIATED_BY"));
|
|
|
|
|
|
|
|
|
|
|
@ -855,7 +856,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
|
|
|
|
|
|
|
|
List<OperationResponse> operationResponses = new ArrayList<>();
|
|
|
|
List<OperationResponse> operationResponses = new ArrayList<>();
|
|
|
|
if (rs.getInt("UPDATED_TIMESTAMP") != 0) {
|
|
|
|
if (rs.getInt("UPDATED_TIMESTAMP") != 0) {
|
|
|
|
activityStatus.setUpdatedTimestamp(new java.util.Date(
|
|
|
|
activityStatus.setUpdatedTimestamp(new Date(
|
|
|
|
rs.getLong(("UPDATED_TIMESTAMP")) * 1000).toString());
|
|
|
|
rs.getLong(("UPDATED_TIMESTAMP")) * 1000).toString());
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -878,7 +879,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
activityStatus = new ActivityStatus();
|
|
|
|
activityStatus = new ActivityStatus();
|
|
|
|
|
|
|
|
|
|
|
|
activity.setType(Activity.Type.valueOf(rs.getString("OPERATION_TYPE")));
|
|
|
|
activity.setType(Activity.Type.valueOf(rs.getString("OPERATION_TYPE")));
|
|
|
|
activity.setCreatedTimeStamp(new java.util.Date(rs.getLong(("CREATED_TIMESTAMP")) * 1000).toString());
|
|
|
|
activity.setCreatedTimeStamp(new Date(rs.getLong(("CREATED_TIMESTAMP")) * 1000).toString());
|
|
|
|
activity.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
activity.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
|
|
|
|
|
|
|
|
DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
|
|
|
|
DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
|
|
|
@ -890,7 +891,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
|
|
|
|
|
|
|
|
List<OperationResponse> operationResponses = new ArrayList<>();
|
|
|
|
List<OperationResponse> operationResponses = new ArrayList<>();
|
|
|
|
if (rs.getInt("UPDATED_TIMESTAMP") != 0) {
|
|
|
|
if (rs.getInt("UPDATED_TIMESTAMP") != 0) {
|
|
|
|
activityStatus.setUpdatedTimestamp(new java.util.Date(
|
|
|
|
activityStatus.setUpdatedTimestamp(new Date(
|
|
|
|
rs.getLong(("UPDATED_TIMESTAMP")) * 1000).toString());
|
|
|
|
rs.getLong(("UPDATED_TIMESTAMP")) * 1000).toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (rs.getTimestamp("RECEIVED_TIMESTAMP") != null) {
|
|
|
|
if (rs.getTimestamp("RECEIVED_TIMESTAMP") != null) {
|
|
|
@ -1146,11 +1147,11 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
operation = new Operation();
|
|
|
|
operation = new Operation();
|
|
|
|
operation.setId(rs.getInt("ID"));
|
|
|
|
operation.setId(rs.getInt("ID"));
|
|
|
|
operation.setType(Operation.Type.valueOf(rs.getString("TYPE")));
|
|
|
|
operation.setType(Operation.Type.valueOf(rs.getString("TYPE")));
|
|
|
|
operation.setCreatedTimeStamp(rs.getTimestamp("CREATED_TIMESTAMP").toString());
|
|
|
|
operation.setCreatedTimeStamp(new Timestamp(rs.getLong("CREATED_TIMESTAMP") * 1000L).toString());
|
|
|
|
if (rs.getTimestamp("RECEIVED_TIMESTAMP") == null) {
|
|
|
|
if (rs.getLong("RECEIVED_TIMESTAMP") == 0) {
|
|
|
|
operation.setReceivedTimeStamp("");
|
|
|
|
operation.setReceivedTimeStamp("");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
operation.setReceivedTimeStamp(rs.getTimestamp("RECEIVED_TIMESTAMP").toString());
|
|
|
|
operation.setReceivedTimeStamp(new Timestamp(rs.getLong("RECEIVED_TIMESTAMP") * 1000L).toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setInitiatedBy(rs.getString("INITIATED_BY"));
|
|
|
|
operation.setInitiatedBy(rs.getString("INITIATED_BY"));
|
|
|
@ -1172,10 +1173,10 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
Operation operation = null;
|
|
|
|
Operation operation = null;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
Connection conn = OperationManagementDAOFactory.getConnection();
|
|
|
|
Connection conn = OperationManagementDAOFactory.getConnection();
|
|
|
|
String sql = "SELECT o.ID, o.TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, om.STATUS, " +
|
|
|
|
String sql = "SELECT o.ID, o.TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, om.STATUS, o.OPERATION_CODE, " +
|
|
|
|
"o.OPERATION_CODE, o.INITIATED_BY, om.ID AS OM_MAPPING_ID, " +
|
|
|
|
"om.ID AS OM_MAPPING_ID, " +
|
|
|
|
"om.UPDATED_TIMESTAMP FROM (SELECT ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP," +
|
|
|
|
"om.UPDATED_TIMESTAMP FROM (SELECT ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP," +
|
|
|
|
"OPERATION_CODE, INITIATED_BY FROM DM_OPERATION WHERE id = ?) o INNER JOIN (SELECT * FROM " +
|
|
|
|
"OPERATION_CODE FROM DM_OPERATION WHERE id = ?) o INNER JOIN (SELECT * FROM " +
|
|
|
|
"DM_ENROLMENT_OP_MAPPING dm where dm.OPERATION_ID = ? AND dm.ENROLMENT_ID = ?) om " +
|
|
|
|
"DM_ENROLMENT_OP_MAPPING dm where dm.OPERATION_ID = ? AND dm.ENROLMENT_ID = ?) om " +
|
|
|
|
"ON o.ID = om.OPERATION_ID ";
|
|
|
|
"ON o.ID = om.OPERATION_ID ";
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
@ -1188,16 +1189,15 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
operation = new Operation();
|
|
|
|
operation = new Operation();
|
|
|
|
operation.setId(rs.getInt("ID"));
|
|
|
|
operation.setId(rs.getInt("ID"));
|
|
|
|
operation.setType(Operation.Type.valueOf(rs.getString("TYPE")));
|
|
|
|
operation.setType(Operation.Type.valueOf(rs.getString("TYPE")));
|
|
|
|
operation.setCreatedTimeStamp(rs.getTimestamp("CREATED_TIMESTAMP").toString());
|
|
|
|
operation.setCreatedTimeStamp(new Timestamp(rs.getLong("CREATED_TIMESTAMP") * 1000L).toString());
|
|
|
|
operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS")));
|
|
|
|
operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS")));
|
|
|
|
if (rs.getLong("UPDATED_TIMESTAMP") == 0) {
|
|
|
|
if (rs.getLong("UPDATED_TIMESTAMP") == 0) {
|
|
|
|
operation.setReceivedTimeStamp("");
|
|
|
|
operation.setReceivedTimeStamp("");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
operation.setReceivedTimeStamp(
|
|
|
|
operation.setReceivedTimeStamp(
|
|
|
|
new java.sql.Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString());
|
|
|
|
new Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setInitiatedBy(rs.getString("INITIATED_BY"));
|
|
|
|
|
|
|
|
OperationDAOUtil.setActivityId(operation, rs.getInt("ID"));
|
|
|
|
OperationDAOUtil.setActivityId(operation, rs.getInt("ID"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (SQLException e) {
|
|
|
|
} catch (SQLException e) {
|
|
|
@ -1215,11 +1215,11 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
ResultSet rs = null;
|
|
|
|
ResultSet rs = null;
|
|
|
|
Operation operation;
|
|
|
|
Operation operation;
|
|
|
|
List<Operation> operations = new ArrayList<>();
|
|
|
|
List<Operation> operations = new ArrayList<Operation>();
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
Connection conn = OperationManagementDAOFactory.getConnection();
|
|
|
|
Connection conn = OperationManagementDAOFactory.getConnection();
|
|
|
|
String sql = "SELECT o.ID, TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, o.OPERATION_CODE, " +
|
|
|
|
String sql = "SELECT o.ID, TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, o.OPERATION_CODE, om.ID AS OM_MAPPING_ID," +
|
|
|
|
"o.INITIATED_BY, om.ID AS OM_MAPPING_ID, om.UPDATED_TIMESTAMP FROM DM_OPERATION o " +
|
|
|
|
"om.UPDATED_TIMESTAMP FROM DM_OPERATION o " +
|
|
|
|
"INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " +
|
|
|
|
"INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " +
|
|
|
|
"WHERE dm.ENROLMENT_ID = ? AND dm.STATUS = ?) om ON o.ID = om.OPERATION_ID ORDER BY o.CREATED_TIMESTAMP DESC";
|
|
|
|
"WHERE dm.ENROLMENT_ID = ? AND dm.STATUS = ?) om ON o.ID = om.OPERATION_ID ORDER BY o.CREATED_TIMESTAMP DESC";
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
@ -1231,15 +1231,14 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
operation = new Operation();
|
|
|
|
operation = new Operation();
|
|
|
|
operation.setId(rs.getInt("ID"));
|
|
|
|
operation.setId(rs.getInt("ID"));
|
|
|
|
operation.setType(Operation.Type.valueOf(rs.getString("TYPE")));
|
|
|
|
operation.setType(Operation.Type.valueOf(rs.getString("TYPE")));
|
|
|
|
operation.setCreatedTimeStamp(rs.getTimestamp("CREATED_TIMESTAMP").toString());
|
|
|
|
operation.setCreatedTimeStamp(new Timestamp(rs.getLong("CREATED_TIMESTAMP") * 1000L).toString());
|
|
|
|
if (rs.getLong("UPDATED_TIMESTAMP") == 0) {
|
|
|
|
if (rs.getLong("UPDATED_TIMESTAMP") == 0) {
|
|
|
|
operation.setReceivedTimeStamp("");
|
|
|
|
operation.setReceivedTimeStamp("");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
operation.setReceivedTimeStamp(
|
|
|
|
operation.setReceivedTimeStamp(
|
|
|
|
new java.sql.Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString());
|
|
|
|
new Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setInitiatedBy(rs.getString("INITIATED_BY"));
|
|
|
|
|
|
|
|
operation.setStatus(status);
|
|
|
|
operation.setStatus(status);
|
|
|
|
OperationDAOUtil.setActivityId(operation, rs.getInt("ID"));
|
|
|
|
OperationDAOUtil.setActivityId(operation, rs.getInt("ID"));
|
|
|
|
operations.add(operation);
|
|
|
|
operations.add(operation);
|
|
|
@ -1264,7 +1263,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
Connection conn = OperationManagementDAOFactory.getConnection();
|
|
|
|
Connection conn = OperationManagementDAOFactory.getConnection();
|
|
|
|
String sql = "SELECT o.ID, TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, o.OPERATION_CODE, " +
|
|
|
|
String sql = "SELECT o.ID, TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, o.OPERATION_CODE, " +
|
|
|
|
"o.INITIATED_BY, om.ID AS OM_MAPPING_ID, om.UPDATED_TIMESTAMP FROM DM_OPERATION o " +
|
|
|
|
"om.ID AS OM_MAPPING_ID, om.UPDATED_TIMESTAMP FROM DM_OPERATION o " +
|
|
|
|
"INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " +
|
|
|
|
"INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " +
|
|
|
|
"WHERE dm.ENROLMENT_ID = ? AND dm.STATUS = ?) om ON o.ID = om.OPERATION_ID ORDER BY " +
|
|
|
|
"WHERE dm.ENROLMENT_ID = ? AND dm.STATUS = ?) om ON o.ID = om.OPERATION_ID ORDER BY " +
|
|
|
|
"o.CREATED_TIMESTAMP DESC LIMIT ?,?";
|
|
|
|
"o.CREATED_TIMESTAMP DESC LIMIT ?,?";
|
|
|
@ -1279,15 +1278,14 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
operation = new Operation();
|
|
|
|
operation = new Operation();
|
|
|
|
operation.setId(rs.getInt("ID"));
|
|
|
|
operation.setId(rs.getInt("ID"));
|
|
|
|
operation.setType(Operation.Type.valueOf(rs.getString("TYPE")));
|
|
|
|
operation.setType(Operation.Type.valueOf(rs.getString("TYPE")));
|
|
|
|
operation.setCreatedTimeStamp(rs.getTimestamp("CREATED_TIMESTAMP").toString());
|
|
|
|
operation.setCreatedTimeStamp(new Timestamp(rs.getLong("CREATED_TIMESTAMP") * 1000L).toString());
|
|
|
|
if (rs.getLong("UPDATED_TIMESTAMP") == 0) {
|
|
|
|
if (rs.getLong("UPDATED_TIMESTAMP") == 0) {
|
|
|
|
operation.setReceivedTimeStamp("");
|
|
|
|
operation.setReceivedTimeStamp("");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
operation.setReceivedTimeStamp(
|
|
|
|
operation.setReceivedTimeStamp(
|
|
|
|
new java.sql.Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString());
|
|
|
|
new Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setInitiatedBy(rs.getString("INITIATED_BY"));
|
|
|
|
|
|
|
|
operation.setStatus(status);
|
|
|
|
operation.setStatus(status);
|
|
|
|
OperationDAOUtil.setActivityId(operation, rs.getInt("OM_MAPPING_ID"));
|
|
|
|
OperationDAOUtil.setActivityId(operation, rs.getInt("OM_MAPPING_ID"));
|
|
|
|
operations.add(operation);
|
|
|
|
operations.add(operation);
|
|
|
@ -1311,8 +1309,8 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
Connection conn = OperationManagementDAOFactory.getConnection();
|
|
|
|
Connection conn = OperationManagementDAOFactory.getConnection();
|
|
|
|
String sql = "SELECT o.ID, o.TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, " +
|
|
|
|
String sql = "SELECT o.ID, o.TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, " +
|
|
|
|
"o.OPERATION_CODE, o.INITIATED_BY, om.STATUS, om.ID AS OM_MAPPING_ID, om.UPDATED_TIMESTAMP " +
|
|
|
|
"o.OPERATION_CODE, om.STATUS, om.ID AS OM_MAPPING_ID, om.UPDATED_TIMESTAMP FROM DM_OPERATION o " +
|
|
|
|
"FROM DM_OPERATION o INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " +
|
|
|
|
"INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " +
|
|
|
|
"WHERE dm.ENROLMENT_ID = ?) om ON o.ID = om.OPERATION_ID " +
|
|
|
|
"WHERE dm.ENROLMENT_ID = ?) om ON o.ID = om.OPERATION_ID " +
|
|
|
|
"ORDER BY o.CREATED_TIMESTAMP DESC, o.ID DESC";
|
|
|
|
"ORDER BY o.CREATED_TIMESTAMP DESC, o.ID DESC";
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
@ -1323,15 +1321,14 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
operation = new Operation();
|
|
|
|
operation = new Operation();
|
|
|
|
operation.setId(rs.getInt("ID"));
|
|
|
|
operation.setId(rs.getInt("ID"));
|
|
|
|
operation.setType(Operation.Type.valueOf(rs.getString("TYPE")));
|
|
|
|
operation.setType(Operation.Type.valueOf(rs.getString("TYPE")));
|
|
|
|
operation.setCreatedTimeStamp(rs.getTimestamp("CREATED_TIMESTAMP").toString());
|
|
|
|
operation.setCreatedTimeStamp(new Timestamp(rs.getLong("CREATED_TIMESTAMP") * 1000L).toString());
|
|
|
|
if (rs.getLong("UPDATED_TIMESTAMP") == 0) {
|
|
|
|
if (rs.getLong("UPDATED_TIMESTAMP") == 0) {
|
|
|
|
operation.setReceivedTimeStamp("");
|
|
|
|
operation.setReceivedTimeStamp("");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
operation.setReceivedTimeStamp(
|
|
|
|
operation.setReceivedTimeStamp(
|
|
|
|
new java.sql.Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString());
|
|
|
|
new Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setInitiatedBy(rs.getString("INITIATED_BY"));
|
|
|
|
|
|
|
|
operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS")));
|
|
|
|
operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS")));
|
|
|
|
operations.add(operation);
|
|
|
|
operations.add(operation);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1348,7 +1345,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
public List<? extends Operation> getOperationsForDevice(int enrolmentId, PaginationRequest request)
|
|
|
|
public List<? extends Operation> getOperationsForDevice(int enrolmentId, PaginationRequest request)
|
|
|
|
throws OperationManagementDAOException {
|
|
|
|
throws OperationManagementDAOException {
|
|
|
|
Operation operation;
|
|
|
|
Operation operation;
|
|
|
|
List<Operation> operations = new ArrayList<>();
|
|
|
|
List<Operation> operations = new ArrayList<Operation>();
|
|
|
|
String createdTo = null;
|
|
|
|
String createdTo = null;
|
|
|
|
String createdFrom = null;
|
|
|
|
String createdFrom = null;
|
|
|
|
DateFormat simple = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
|
|
|
DateFormat simple = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
|
|
@ -1366,13 +1363,12 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
Long updatedTo = request.getOperationLogFilters().getUpdatedDayTo();
|
|
|
|
Long updatedTo = request.getOperationLogFilters().getUpdatedDayTo();
|
|
|
|
List<String> operationCode = request.getOperationLogFilters().getOperationCode();
|
|
|
|
List<String> operationCode = request.getOperationLogFilters().getOperationCode();
|
|
|
|
List<String> status = request.getOperationLogFilters().getStatus();
|
|
|
|
List<String> status = request.getOperationLogFilters().getStatus();
|
|
|
|
StringBuilder sql = new StringBuilder("SELECT " +
|
|
|
|
String sql = "SELECT " +
|
|
|
|
"o.ID, " +
|
|
|
|
"o.ID, " +
|
|
|
|
"TYPE, " +
|
|
|
|
"TYPE, " +
|
|
|
|
"o.CREATED_TIMESTAMP, " +
|
|
|
|
"o.CREATED_TIMESTAMP, " +
|
|
|
|
"o.RECEIVED_TIMESTAMP, " +
|
|
|
|
"o.RECEIVED_TIMESTAMP, " +
|
|
|
|
"o.OPERATION_CODE, " +
|
|
|
|
"o.OPERATION_CODE, " +
|
|
|
|
"o.INITIATED_BY, " +
|
|
|
|
|
|
|
|
"om.STATUS, " +
|
|
|
|
"om.STATUS, " +
|
|
|
|
"om.ID AS OM_MAPPING_ID, " +
|
|
|
|
"om.ID AS OM_MAPPING_ID, " +
|
|
|
|
"om.UPDATED_TIMESTAMP " +
|
|
|
|
"om.UPDATED_TIMESTAMP " +
|
|
|
@ -1386,55 +1382,55 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
"FROM " +
|
|
|
|
"FROM " +
|
|
|
|
"DM_ENROLMENT_OP_MAPPING dm " +
|
|
|
|
"DM_ENROLMENT_OP_MAPPING dm " +
|
|
|
|
"WHERE " +
|
|
|
|
"WHERE " +
|
|
|
|
"dm.ENROLMENT_ID = ?");
|
|
|
|
"dm.ENROLMENT_ID = ?";
|
|
|
|
|
|
|
|
|
|
|
|
if (updatedFrom != null && updatedFrom != 0 && updatedTo != null && updatedTo != 0) {
|
|
|
|
if (updatedFrom != null && updatedFrom != 0 && updatedTo != null && updatedTo != 0) {
|
|
|
|
sql.append(" AND dm.UPDATED_TIMESTAMP BETWEEN ? AND ?");
|
|
|
|
sql = sql + " AND dm.UPDATED_TIMESTAMP BETWEEN ? AND ?";
|
|
|
|
isUpdatedDayProvided = true;
|
|
|
|
isUpdatedDayProvided = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sql.append(") om ON o.ID = om.OPERATION_ID ");
|
|
|
|
sql = sql + ") om ON o.ID = om.OPERATION_ID ";
|
|
|
|
if (createdFrom != null && !createdFrom.isEmpty() && createdTo != null && !createdTo.isEmpty()) {
|
|
|
|
if (createdFrom != null && !createdFrom.isEmpty() && createdTo != null && !createdTo.isEmpty()) {
|
|
|
|
sql.append(" WHERE o.CREATED_TIMESTAMP BETWEEN ? AND ?");
|
|
|
|
sql = sql + " WHERE o.CREATED_TIMESTAMP BETWEEN ? AND ?";
|
|
|
|
isCreatedDayProvided = true;
|
|
|
|
isCreatedDayProvided = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((isCreatedDayProvided) && (status != null && !status.isEmpty())) {
|
|
|
|
if ((isCreatedDayProvided) && (status != null && !status.isEmpty())) {
|
|
|
|
int size = status.size();
|
|
|
|
int size = status.size();
|
|
|
|
sql.append(" AND (om.STATUS = ? ");
|
|
|
|
sql = sql + " AND (om.STATUS = ? ";
|
|
|
|
for (int i = 0; i < size - 1; i++) {
|
|
|
|
for (int i = 0; i < size - 1; i++) {
|
|
|
|
sql.append(" OR om.STATUS = ?");
|
|
|
|
sql = sql + " OR om.STATUS = ?";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sql.append(")");
|
|
|
|
sql = sql + ")";
|
|
|
|
isStatusProvided = true;
|
|
|
|
isStatusProvided = true;
|
|
|
|
} else if ((!isCreatedDayProvided) && (status != null && !status.isEmpty())) {
|
|
|
|
} else if ((!isCreatedDayProvided) && (status != null && !status.isEmpty())) {
|
|
|
|
int size = status.size();
|
|
|
|
int size = status.size();
|
|
|
|
sql.append(" WHERE (om.STATUS = ? ");
|
|
|
|
sql = sql + " WHERE (om.STATUS = ? ";
|
|
|
|
for (int i = 0; i < size - 1; i++) {
|
|
|
|
for (int i = 0; i < size - 1; i++) {
|
|
|
|
sql.append(" OR om.STATUS = ?");
|
|
|
|
sql = sql + " OR om.STATUS = ?";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sql.append(")");
|
|
|
|
sql = sql + ")";
|
|
|
|
isStatusProvided = true;
|
|
|
|
isStatusProvided = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((isCreatedDayProvided || isStatusProvided) && (operationCode != null && !operationCode.isEmpty())) {
|
|
|
|
if ((isCreatedDayProvided || isStatusProvided) && (operationCode != null && !operationCode.isEmpty())) {
|
|
|
|
int size = operationCode.size();
|
|
|
|
int size = operationCode.size();
|
|
|
|
sql.append(" AND (o.OPERATION_CODE = ? ");
|
|
|
|
sql = sql + " AND (o.OPERATION_CODE = ? ";
|
|
|
|
for (int i = 0; i < size - 1; i++) {
|
|
|
|
for (int i = 0; i < size - 1; i++) {
|
|
|
|
sql.append(" OR o.OPERATION_CODE = ?");
|
|
|
|
sql = sql + " OR o.OPERATION_CODE = ?";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sql.append(")");
|
|
|
|
sql = sql + ")";
|
|
|
|
isOperationCodeProvided = true;
|
|
|
|
isOperationCodeProvided = true;
|
|
|
|
} else if ((!isCreatedDayProvided && !isStatusProvided) && (operationCode != null && !operationCode.isEmpty())) {
|
|
|
|
} else if ((!isCreatedDayProvided && !isStatusProvided) && (operationCode != null && !operationCode.isEmpty())) {
|
|
|
|
int size = operationCode.size();
|
|
|
|
int size = operationCode.size();
|
|
|
|
sql.append(" WHERE (o.OPERATION_CODE = ? ");
|
|
|
|
sql = sql + " WHERE (o.OPERATION_CODE = ? ";
|
|
|
|
for (int i = 0; i < size - 1; i++) {
|
|
|
|
for (int i = 0; i < size - 1; i++) {
|
|
|
|
sql.append(" OR o.OPERATION_CODE = ?");
|
|
|
|
sql = sql + " OR o.OPERATION_CODE = ?";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sql.append(")");
|
|
|
|
sql = sql + ")";
|
|
|
|
isOperationCodeProvided = true;
|
|
|
|
isOperationCodeProvided = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sql.append(" ORDER BY o.CREATED_TIMESTAMP DESC LIMIT ?,?");
|
|
|
|
sql = sql + " ORDER BY o.CREATED_TIMESTAMP DESC LIMIT ?,?";
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
Connection conn = OperationManagementDAOFactory.getConnection();
|
|
|
|
Connection conn = OperationManagementDAOFactory.getConnection();
|
|
|
|
try (PreparedStatement stmt = conn.prepareStatement(sql.toString())) {
|
|
|
|
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
|
|
|
|
int paramIndex = 1;
|
|
|
|
int paramIndex = 1;
|
|
|
|
stmt.setInt(paramIndex++, enrolmentId);
|
|
|
|
stmt.setInt(paramIndex++, enrolmentId);
|
|
|
|
if (isUpdatedDayProvided) {
|
|
|
|
if (isUpdatedDayProvided) {
|
|
|
@ -1446,13 +1442,15 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
stmt.setString(paramIndex++, createdTo);
|
|
|
|
stmt.setString(paramIndex++, createdTo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (isStatusProvided) {
|
|
|
|
if (isStatusProvided) {
|
|
|
|
for (String s : status) {
|
|
|
|
int size = status.size();
|
|
|
|
stmt.setString(paramIndex++, s);
|
|
|
|
for (int i = 0; i < size; i++) {
|
|
|
|
|
|
|
|
stmt.setString(paramIndex++, status.get(i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (isOperationCodeProvided) {
|
|
|
|
if (isOperationCodeProvided) {
|
|
|
|
for (String s : operationCode) {
|
|
|
|
int size = operationCode.size();
|
|
|
|
stmt.setString(paramIndex++, s);
|
|
|
|
for (int i = 0; i < size; i++) {
|
|
|
|
|
|
|
|
stmt.setString(paramIndex++, operationCode.get(i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stmt.setInt(paramIndex++, request.getStartIndex());
|
|
|
|
stmt.setInt(paramIndex++, request.getStartIndex());
|
|
|
@ -1462,15 +1460,14 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
operation = new Operation();
|
|
|
|
operation = new Operation();
|
|
|
|
operation.setId(rs.getInt("ID"));
|
|
|
|
operation.setId(rs.getInt("ID"));
|
|
|
|
operation.setType(Operation.Type.valueOf(rs.getString("TYPE")));
|
|
|
|
operation.setType(Operation.Type.valueOf(rs.getString("TYPE")));
|
|
|
|
operation.setCreatedTimeStamp(rs.getTimestamp("CREATED_TIMESTAMP").toString());
|
|
|
|
operation.setCreatedTimeStamp(new Timestamp(rs.getLong("CREATED_TIMESTAMP") * 1000L).toString());
|
|
|
|
if (rs.getLong("UPDATED_TIMESTAMP") == 0) {
|
|
|
|
if (rs.getLong("UPDATED_TIMESTAMP") == 0) {
|
|
|
|
operation.setReceivedTimeStamp("");
|
|
|
|
operation.setReceivedTimeStamp("");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
operation.setReceivedTimeStamp(
|
|
|
|
operation.setReceivedTimeStamp(
|
|
|
|
new java.sql.Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString());
|
|
|
|
new Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setInitiatedBy(rs.getString("INITIATED_BY"));
|
|
|
|
|
|
|
|
operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS")));
|
|
|
|
operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS")));
|
|
|
|
OperationDAOUtil.setActivityId(operation, rs.getInt("ID"));
|
|
|
|
OperationDAOUtil.setActivityId(operation, rs.getInt("ID"));
|
|
|
|
operations.add(operation);
|
|
|
|
operations.add(operation);
|
|
|
@ -1597,7 +1594,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
Connection connection = OperationManagementDAOFactory.getConnection();
|
|
|
|
Connection connection = OperationManagementDAOFactory.getConnection();
|
|
|
|
stmt = connection.prepareStatement("SELECT o.ID, o.TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, " +
|
|
|
|
stmt = connection.prepareStatement("SELECT o.ID, o.TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, " +
|
|
|
|
"o.OPERATION_CODE, o.INITIATED_BY, om.ID AS OM_MAPPING_ID, om.UPDATED_TIMESTAMP FROM DM_OPERATION o " +
|
|
|
|
"o.OPERATION_CODE, om.ID AS OM_MAPPING_ID, om.UPDATED_TIMESTAMP FROM DM_OPERATION o " +
|
|
|
|
"INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " +
|
|
|
|
"INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " +
|
|
|
|
"WHERE dm.ENROLMENT_ID = ? AND dm.STATUS = ?) om ON o.ID = om.OPERATION_ID " +
|
|
|
|
"WHERE dm.ENROLMENT_ID = ? AND dm.STATUS = ?) om ON o.ID = om.OPERATION_ID " +
|
|
|
|
"ORDER BY om.UPDATED_TIMESTAMP ASC, om.ID ASC LIMIT 1");
|
|
|
|
"ORDER BY om.UPDATED_TIMESTAMP ASC, om.ID ASC LIMIT 1");
|
|
|
@ -1610,16 +1607,15 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
operation = new Operation();
|
|
|
|
operation = new Operation();
|
|
|
|
operation.setType(OperationDAOUtil.getType(rs.getString("TYPE")));
|
|
|
|
operation.setType(OperationDAOUtil.getType(rs.getString("TYPE")));
|
|
|
|
operation.setId(rs.getInt("ID"));
|
|
|
|
operation.setId(rs.getInt("ID"));
|
|
|
|
operation.setCreatedTimeStamp(rs.getTimestamp("CREATED_TIMESTAMP").toString());
|
|
|
|
operation.setCreatedTimeStamp(new Timestamp(rs.getLong("CREATED_TIMESTAMP") * 1000L).toString());
|
|
|
|
|
|
|
|
|
|
|
|
if (rs.getLong("UPDATED_TIMESTAMP") == 0) {
|
|
|
|
if (rs.getLong("UPDATED_TIMESTAMP") == 0) {
|
|
|
|
operation.setReceivedTimeStamp("");
|
|
|
|
operation.setReceivedTimeStamp("");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
operation.setReceivedTimeStamp(
|
|
|
|
operation.setReceivedTimeStamp(
|
|
|
|
new java.sql.Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString());
|
|
|
|
new Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setInitiatedBy(rs.getString("INITIATED_BY"));
|
|
|
|
|
|
|
|
operation.setStatus(Operation.Status.PENDING);
|
|
|
|
operation.setStatus(Operation.Status.PENDING);
|
|
|
|
OperationDAOUtil.setActivityId(operation, rs.getInt("ID"));
|
|
|
|
OperationDAOUtil.setActivityId(operation, rs.getInt("ID"));
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1640,10 +1636,10 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
List<Operation> operations = new ArrayList<>();
|
|
|
|
List<Operation> operations = new ArrayList<>();
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
Connection conn = OperationManagementDAOFactory.getConnection();
|
|
|
|
Connection conn = OperationManagementDAOFactory.getConnection();
|
|
|
|
String sql = "SELECT o.ID, TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, OPERATION_CODE, o.INITIATED_BY," +
|
|
|
|
String sql = "SELECT o.ID, TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, OPERATION_CODE, om.ID AS OM_MAPPING_ID, " +
|
|
|
|
" om.ID AS OM_MAPPING_ID, om.UPDATED_TIMESTAMP FROM " +
|
|
|
|
"om.UPDATED_TIMESTAMP FROM (SELECT o.ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE " +
|
|
|
|
"(SELECT o.ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE, INITIATED_BY " +
|
|
|
|
"FROM DM_OPERATION o WHERE o.TYPE = ?) o " +
|
|
|
|
"FROM DM_OPERATION o WHERE o.TYPE = ?) o INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " +
|
|
|
|
"INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " +
|
|
|
|
"WHERE dm.ENROLMENT_ID = ? AND dm.STATUS = ?) om ON o.ID = om.OPERATION_ID ORDER BY o.CREATED_TIMESTAMP ASC";
|
|
|
|
"WHERE dm.ENROLMENT_ID = ? AND dm.STATUS = ?) om ON o.ID = om.OPERATION_ID ORDER BY o.CREATED_TIMESTAMP ASC";
|
|
|
|
|
|
|
|
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
@ -1656,15 +1652,14 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
operation = new Operation();
|
|
|
|
operation = new Operation();
|
|
|
|
operation.setId(rs.getInt("ID"));
|
|
|
|
operation.setId(rs.getInt("ID"));
|
|
|
|
operation.setType(Operation.Type.valueOf(rs.getString("TYPE")));
|
|
|
|
operation.setType(Operation.Type.valueOf(rs.getString("TYPE")));
|
|
|
|
operation.setCreatedTimeStamp(rs.getTimestamp("CREATED_TIMESTAMP").toString());
|
|
|
|
operation.setCreatedTimeStamp(new Timestamp(rs.getLong("CREATED_TIMESTAMP") * 1000L).toString());
|
|
|
|
if (rs.getLong("UPDATED_TIMESTAMP") == 0) {
|
|
|
|
if (rs.getLong("UPDATED_TIMESTAMP") == 0) {
|
|
|
|
operation.setReceivedTimeStamp("");
|
|
|
|
operation.setReceivedTimeStamp("");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
operation.setReceivedTimeStamp(
|
|
|
|
operation.setReceivedTimeStamp(
|
|
|
|
new java.sql.Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString());
|
|
|
|
new Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setInitiatedBy(rs.getString("INITIATED_BY"));
|
|
|
|
|
|
|
|
OperationDAOUtil.setActivityId(operation, rs.getInt("ID"));
|
|
|
|
OperationDAOUtil.setActivityId(operation, rs.getInt("ID"));
|
|
|
|
operations.add(operation);
|
|
|
|
operations.add(operation);
|
|
|
|
}
|
|
|
|
}
|
|
|
|