|
|
@ -52,7 +52,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
Connection connection = OperationManagementDAOFactory.getConnection();
|
|
|
|
Connection connection = OperationManagementDAOFactory.getConnection();
|
|
|
|
String sql = "INSERT INTO DM_OPERATION(TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE) " +
|
|
|
|
String sql = "INSERT INTO DM_OPERATION(TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE) " +
|
|
|
|
"VALUES (?, ?, ?, ?)";
|
|
|
|
"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.setTimestamp(2, new Timestamp(new Date().getTime()));
|
|
|
|
stmt.setTimestamp(3, null);
|
|
|
|
stmt.setTimestamp(3, null);
|
|
|
@ -93,7 +93,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
throws OperationManagementDAOException {
|
|
|
|
throws OperationManagementDAOException {
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
long time = System.currentTimeMillis()/1000;
|
|
|
|
long time = System.currentTimeMillis() / 1000;
|
|
|
|
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=?");
|
|
|
@ -128,14 +128,14 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
// This will return only one result always.
|
|
|
|
// This will return only one result always.
|
|
|
|
rs = stmt.executeQuery();
|
|
|
|
rs = stmt.executeQuery();
|
|
|
|
int id = 0;
|
|
|
|
int id = 0;
|
|
|
|
while (rs.next()){
|
|
|
|
while (rs.next()) {
|
|
|
|
id = rs.getInt("ID");
|
|
|
|
id = rs.getInt("ID");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (id != 0){
|
|
|
|
if (id != 0) {
|
|
|
|
stmt = connection.prepareStatement("UPDATE DM_ENROLMENT_OP_MAPPING SET STATUS = ?, " +
|
|
|
|
stmt = connection.prepareStatement("UPDATE DM_ENROLMENT_OP_MAPPING SET STATUS = ?, " +
|
|
|
|
"UPDATED_TIMESTAMP = ? WHERE ID = ?");
|
|
|
|
"UPDATED_TIMESTAMP = ? WHERE ID = ?");
|
|
|
|
stmt.setString(1, newStatus.toString());
|
|
|
|
stmt.setString(1, newStatus.toString());
|
|
|
|
stmt.setLong(2, System.currentTimeMillis()/1000);
|
|
|
|
stmt.setLong(2, System.currentTimeMillis() / 1000);
|
|
|
|
stmt.setInt(3, id);
|
|
|
|
stmt.setInt(3, id);
|
|
|
|
stmt.executeUpdate();
|
|
|
|
stmt.executeUpdate();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -257,7 +257,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
|
|
|
|
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
ResultSet rs = null;
|
|
|
|
ResultSet rs = null;
|
|
|
|
Activity activity = new Activity();
|
|
|
|
Activity activity = null;
|
|
|
|
List<ActivityStatus> activityStatusList = new ArrayList<>();
|
|
|
|
List<ActivityStatus> activityStatusList = new ArrayList<>();
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
Connection conn = OperationManagementDAOFactory.getConnection();
|
|
|
|
Connection conn = OperationManagementDAOFactory.getConnection();
|
|
|
@ -281,8 +281,10 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
|
|
|
|
|
|
|
|
int enrolmentId = 0;
|
|
|
|
int enrolmentId = 0;
|
|
|
|
ActivityStatus activityStatus = null;
|
|
|
|
ActivityStatus activityStatus = null;
|
|
|
|
while (rs.next()) {
|
|
|
|
|
|
|
|
if (enrolmentId == 0){
|
|
|
|
if (rs.next()) {
|
|
|
|
|
|
|
|
activity = new Activity();
|
|
|
|
|
|
|
|
if (enrolmentId == 0) {
|
|
|
|
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"))).toString());
|
|
|
|
activity.setCreatedTimeStamp(new java.util.Date(rs.getLong(("CREATED_TIMESTAMP"))).toString());
|
|
|
|
activity.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
activity.setCode(rs.getString("OPERATION_CODE"));
|
|
|
@ -306,6 +308,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
activityStatusList.add(activityStatus);
|
|
|
|
activityStatusList.add(activityStatus);
|
|
|
|
|
|
|
|
|
|
|
|
enrolmentId = rs.getInt("ENROLMENT_ID");
|
|
|
|
enrolmentId = rs.getInt("ENROLMENT_ID");
|
|
|
|
|
|
|
|
activity.setActivityStatus(activityStatusList);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (rs.getInt("UPDATED_TIMESTAMP") != 0) {
|
|
|
|
if (rs.getInt("UPDATED_TIMESTAMP") != 0) {
|
|
|
|
activityStatus.getResponses().add(this.getOperationResponse(rs));
|
|
|
|
activityStatus.getResponses().add(this.getOperationResponse(rs));
|
|
|
@ -322,7 +325,6 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
OperationManagementDAOUtil.cleanupResources(stmt, rs);
|
|
|
|
OperationManagementDAOUtil.cleanupResources(stmt, rs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
activity.setActivityStatus(activityStatusList);
|
|
|
|
|
|
|
|
return activity;
|
|
|
|
return activity;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -357,7 +359,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
ActivityStatus activityStatus = null;
|
|
|
|
ActivityStatus activityStatus = null;
|
|
|
|
while (rs.next()) {
|
|
|
|
while (rs.next()) {
|
|
|
|
|
|
|
|
|
|
|
|
if(operationId != rs.getInt("OPERATION_ID")) {
|
|
|
|
if (operationId != rs.getInt("OPERATION_ID")) {
|
|
|
|
activity = new Activity();
|
|
|
|
activity = new Activity();
|
|
|
|
activities.add(activity);
|
|
|
|
activities.add(activity);
|
|
|
|
List<ActivityStatus> statusList = new ArrayList<>();
|
|
|
|
List<ActivityStatus> statusList = new ArrayList<>();
|
|
|
@ -388,7 +390,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(operationId == rs.getInt("OPERATION_ID") && enrolmentId != rs.getInt("ENROLMENT_ID")) {
|
|
|
|
if (operationId == rs.getInt("OPERATION_ID") && enrolmentId != rs.getInt("ENROLMENT_ID")) {
|
|
|
|
activityStatus = new ActivityStatus();
|
|
|
|
activityStatus = new ActivityStatus();
|
|
|
|
|
|
|
|
|
|
|
|
activity.setType(Activity.Type.valueOf(rs.getString("OPERATION_TYPE")));
|
|
|
|
activity.setType(Activity.Type.valueOf(rs.getString("OPERATION_TYPE")));
|
|
|
@ -403,7 +405,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
activityStatus.setStatus(ActivityStatus.Status.valueOf(rs.getString("STATUS")));
|
|
|
|
activityStatus.setStatus(ActivityStatus.Status.valueOf(rs.getString("STATUS")));
|
|
|
|
|
|
|
|
|
|
|
|
List<OperationResponse> operationResponses = new ArrayList<>();
|
|
|
|
List<OperationResponse> operationResponses = new ArrayList<>();
|
|
|
|
if (rs.getTimestamp("RECEIVED_TIMESTAMP") !=(null)) {
|
|
|
|
if (rs.getTimestamp("RECEIVED_TIMESTAMP") != (null)) {
|
|
|
|
operationResponses.add(this.getOperationResponse(rs));
|
|
|
|
operationResponses.add(this.getOperationResponse(rs));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
activityStatus.setResponses(operationResponses);
|
|
|
|
activityStatus.setResponses(operationResponses);
|
|
|
@ -411,7 +413,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
|
|
|
|
|
|
|
|
enrolmentId = rs.getInt("ENROLMENT_ID");
|
|
|
|
enrolmentId = rs.getInt("ENROLMENT_ID");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (rs.getTimestamp("RECEIVED_TIMESTAMP") !=(null)) {
|
|
|
|
if (rs.getTimestamp("RECEIVED_TIMESTAMP") != (null)) {
|
|
|
|
activityStatus.getResponses().add(this.getOperationResponse(rs));
|
|
|
|
activityStatus.getResponses().add(this.getOperationResponse(rs));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -432,14 +434,14 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
private OperationResponse getOperationResponse(ResultSet rs) throws
|
|
|
|
private OperationResponse getOperationResponse(ResultSet rs) throws
|
|
|
|
ClassNotFoundException, IOException, SQLException {
|
|
|
|
ClassNotFoundException, IOException, SQLException {
|
|
|
|
OperationResponse response = new OperationResponse();
|
|
|
|
OperationResponse response = new OperationResponse();
|
|
|
|
if(rs.getTimestamp("RECEIVED_TIMESTAMP") !=(null)) {
|
|
|
|
if (rs.getTimestamp("RECEIVED_TIMESTAMP") != (null)) {
|
|
|
|
response.setRecievedTimeStamp(rs.getTimestamp("RECEIVED_TIMESTAMP").toString());
|
|
|
|
response.setRecievedTimeStamp(rs.getTimestamp("RECEIVED_TIMESTAMP").toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ByteArrayInputStream bais = null;
|
|
|
|
ByteArrayInputStream bais = null;
|
|
|
|
ObjectInputStream ois = null;
|
|
|
|
ObjectInputStream ois = null;
|
|
|
|
byte[] contentBytes;
|
|
|
|
byte[] contentBytes;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
if(rs.getBytes("OPERATION_RESPONSE") != null) {
|
|
|
|
if (rs.getBytes("OPERATION_RESPONSE") != null) {
|
|
|
|
contentBytes = (byte[]) rs.getBytes("OPERATION_RESPONSE");
|
|
|
|
contentBytes = (byte[]) rs.getBytes("OPERATION_RESPONSE");
|
|
|
|
bais = new ByteArrayInputStream(contentBytes);
|
|
|
|
bais = new ByteArrayInputStream(contentBytes);
|
|
|
|
ois = new ObjectInputStream(bais);
|
|
|
|
ois = new ObjectInputStream(bais);
|
|
|
@ -515,7 +517,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
} catch (SQLException e) {
|
|
|
|
throw new OperationManagementDAOException("Error occurred while retrieving the operations updated " +
|
|
|
|
throw new OperationManagementDAOException("Error occurred while retrieving the operations updated " +
|
|
|
|
"after a given time" , e);
|
|
|
|
"after a given time", e);
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
OperationManagementDAOUtil.cleanupResources(stmt, rs);
|
|
|
|
OperationManagementDAOUtil.cleanupResources(stmt, rs);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -523,7 +525,6 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void deleteOperation(int id) throws OperationManagementDAOException {
|
|
|
|
public void deleteOperation(int id) throws OperationManagementDAOException {
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
PreparedStatement stmt = null;
|
|
|
@ -603,7 +604,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
operation.setReceivedTimeStamp("");
|
|
|
|
operation.setReceivedTimeStamp("");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
operation.setReceivedTimeStamp(
|
|
|
|
operation.setReceivedTimeStamp(
|
|
|
|
new java.sql.Timestamp((rs.getLong("UPDATED_TIMESTAMP")*1000)).toString());
|
|
|
|
new java.sql.Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS")));
|
|
|
|
operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS")));
|
|
|
@ -650,7 +651,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
operation.setReceivedTimeStamp("");
|
|
|
|
operation.setReceivedTimeStamp("");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
operation.setReceivedTimeStamp(
|
|
|
|
operation.setReceivedTimeStamp(
|
|
|
|
new java.sql.Timestamp((rs.getLong("UPDATED_TIMESTAMP")*1000)).toString());
|
|
|
|
new java.sql.Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
this.setActivityId(operation, rs.getInt("ID"));
|
|
|
|
this.setActivityId(operation, rs.getInt("ID"));
|
|
|
@ -696,7 +697,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
operation.setReceivedTimeStamp("");
|
|
|
|
operation.setReceivedTimeStamp("");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
operation.setReceivedTimeStamp(
|
|
|
|
operation.setReceivedTimeStamp(
|
|
|
|
new java.sql.Timestamp((rs.getLong("UPDATED_TIMESTAMP")*1000)).toString());
|
|
|
|
new java.sql.Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setStatus(status);
|
|
|
|
operation.setStatus(status);
|
|
|
@ -714,7 +715,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<? extends Operation> getOperationsByDeviceAndStatus(int enrolmentId, PaginationRequest request,
|
|
|
|
public List<? extends Operation> getOperationsByDeviceAndStatus(int enrolmentId, PaginationRequest request,
|
|
|
|
Operation.Status status)
|
|
|
|
Operation.Status status)
|
|
|
|
throws OperationManagementDAOException {
|
|
|
|
throws OperationManagementDAOException {
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
ResultSet rs = null;
|
|
|
|
ResultSet rs = null;
|
|
|
@ -723,10 +724,10 @@ 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, " +
|
|
|
|
"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 ?,?";
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
stmt.setInt(1, enrolmentId);
|
|
|
|
stmt.setInt(1, enrolmentId);
|
|
|
|
stmt.setString(2, status.toString());
|
|
|
|
stmt.setString(2, status.toString());
|
|
|
@ -748,7 +749,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
operation.setReceivedTimeStamp("");
|
|
|
|
operation.setReceivedTimeStamp("");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
operation.setReceivedTimeStamp(
|
|
|
|
operation.setReceivedTimeStamp(
|
|
|
|
new java.sql.Timestamp((rs.getLong("UPDATED_TIMESTAMP")*1000)).toString());
|
|
|
|
new java.sql.Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setStatus(status);
|
|
|
|
operation.setStatus(status);
|
|
|
@ -757,7 +758,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (SQLException e) {
|
|
|
|
} catch (SQLException e) {
|
|
|
|
throw new OperationManagementDAOException("SQL error occurred while retrieving the operation " +
|
|
|
|
throw new OperationManagementDAOException("SQL error occurred while retrieving the operation " +
|
|
|
|
"available for the device'" + enrolmentId + "' with status '" + status.toString(), e);
|
|
|
|
"available for the device'" + enrolmentId + "' with status '" + status.toString(), e);
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
OperationManagementDAOUtil.cleanupResources(stmt, rs);
|
|
|
|
OperationManagementDAOUtil.cleanupResources(stmt, rs);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -794,7 +795,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
operation.setReceivedTimeStamp("");
|
|
|
|
operation.setReceivedTimeStamp("");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
operation.setReceivedTimeStamp(
|
|
|
|
operation.setReceivedTimeStamp(
|
|
|
|
new java.sql.Timestamp((rs.getLong("UPDATED_TIMESTAMP")*1000)).toString());
|
|
|
|
new java.sql.Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS")));
|
|
|
|
operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS")));
|
|
|
@ -820,9 +821,9 @@ 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, " +
|
|
|
|
String sql = "SELECT o.ID, TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, " +
|
|
|
|
"OPERATION_CODE, om.STATUS, om.ID AS OM_MAPPING_ID, om.UPDATED_TIMESTAMP FROM DM_OPERATION o " +
|
|
|
|
"OPERATION_CODE, om.STATUS, 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 = ?) om ON o.ID = om.OPERATION_ID ORDER BY o.CREATED_TIMESTAMP DESC LIMIT ?,?";
|
|
|
|
"WHERE dm.ENROLMENT_ID = ?) om ON o.ID = om.OPERATION_ID ORDER BY o.CREATED_TIMESTAMP DESC LIMIT ?,?";
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
stmt.setInt(1, enrolmentId);
|
|
|
|
stmt.setInt(1, enrolmentId);
|
|
|
|
stmt.setInt(2, request.getStartIndex());
|
|
|
|
stmt.setInt(2, request.getStartIndex());
|
|
|
@ -843,7 +844,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
operation.setReceivedTimeStamp("");
|
|
|
|
operation.setReceivedTimeStamp("");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
operation.setReceivedTimeStamp(
|
|
|
|
operation.setReceivedTimeStamp(
|
|
|
|
new java.sql.Timestamp((rs.getLong("UPDATED_TIMESTAMP")*1000)).toString());
|
|
|
|
new java.sql.Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS")));
|
|
|
|
operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS")));
|
|
|
@ -852,7 +853,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (SQLException e) {
|
|
|
|
} catch (SQLException e) {
|
|
|
|
throw new OperationManagementDAOException("SQL error occurred while retrieving the operation " +
|
|
|
|
throw new OperationManagementDAOException("SQL error occurred while retrieving the operation " +
|
|
|
|
"available for the device'" + enrolmentId + "' with status '", e);
|
|
|
|
"available for the device'" + enrolmentId + "' with status '", e);
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
OperationManagementDAOUtil.cleanupResources(stmt, rs);
|
|
|
|
OperationManagementDAOUtil.cleanupResources(stmt, rs);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -876,7 +877,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (SQLException e) {
|
|
|
|
} catch (SQLException e) {
|
|
|
|
throw new OperationManagementDAOException("Error occurred while getting the operations count for enrolment : "
|
|
|
|
throw new OperationManagementDAOException("Error occurred while getting the operations count for enrolment : "
|
|
|
|
+ enrolmentId, e);
|
|
|
|
+ enrolmentId, e);
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
OperationManagementDAOUtil.cleanupResources(stmt, rs);
|
|
|
|
OperationManagementDAOUtil.cleanupResources(stmt, rs);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -913,7 +914,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
operation.setReceivedTimeStamp("");
|
|
|
|
operation.setReceivedTimeStamp("");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
operation.setReceivedTimeStamp(
|
|
|
|
operation.setReceivedTimeStamp(
|
|
|
|
new java.sql.Timestamp((rs.getLong("UPDATED_TIMESTAMP")*1000)).toString());
|
|
|
|
new java.sql.Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setStatus(Operation.Status.PENDING);
|
|
|
|
operation.setStatus(Operation.Status.PENDING);
|
|
|
@ -962,7 +963,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
operation.setReceivedTimeStamp("");
|
|
|
|
operation.setReceivedTimeStamp("");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
operation.setReceivedTimeStamp(
|
|
|
|
operation.setReceivedTimeStamp(
|
|
|
|
new java.sql.Timestamp((rs.getLong("UPDATED_TIMESTAMP")*1000)).toString());
|
|
|
|
new java.sql.Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
this.setActivityId(operation, rs.getInt("ID"));
|
|
|
|
this.setActivityId(operation, rs.getInt("ID"));
|
|
|
@ -986,7 +987,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private String getActivityId( int operationId) {
|
|
|
|
private String getActivityId(int operationId) {
|
|
|
|
return DeviceManagementConstants.OperationAttributes.ACTIVITY + operationId;
|
|
|
|
return DeviceManagementConstants.OperationAttributes.ACTIVITY + operationId;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|