|
|
@ -32,7 +32,6 @@ import java.sql.Connection;
|
|
|
|
import java.sql.PreparedStatement;
|
|
|
|
import java.sql.PreparedStatement;
|
|
|
|
import java.sql.ResultSet;
|
|
|
|
import java.sql.ResultSet;
|
|
|
|
import java.sql.SQLException;
|
|
|
|
import java.sql.SQLException;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class ProfileOperationDAOImpl extends OperationDAOImpl {
|
|
|
|
public class ProfileOperationDAOImpl extends OperationDAOImpl {
|
|
|
|
|
|
|
|
|
|
|
@ -134,13 +133,18 @@ public class ProfileOperationDAOImpl extends OperationDAOImpl {
|
|
|
|
ByteArrayInputStream bais;
|
|
|
|
ByteArrayInputStream bais;
|
|
|
|
ObjectInputStream ois;
|
|
|
|
ObjectInputStream ois;
|
|
|
|
int operationId = 0;
|
|
|
|
int operationId = 0;
|
|
|
|
|
|
|
|
|
|
|
|
String operationType = "";
|
|
|
|
String operationType = "";
|
|
|
|
|
|
|
|
String createdTime;
|
|
|
|
|
|
|
|
String receivedTime;
|
|
|
|
|
|
|
|
String operationStatus = "";
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
Connection connection = OperationManagementDAOFactory.getConnection();
|
|
|
|
Connection connection = OperationManagementDAOFactory.getConnection();
|
|
|
|
stmt = connection.prepareStatement(
|
|
|
|
stmt = connection.prepareStatement(
|
|
|
|
"SELECT o.ID AS OPERATION_ID, o.CREATED_TIMESTAMP AS CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP AS " +
|
|
|
|
"SELECT o.ID AS OPERATION_ID, o.CREATED_TIMESTAMP AS CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP AS " +
|
|
|
|
"RECEIVED_TIMESTAMP, po.PAYLOAD AS PAYLOAD,o.TYPE AS TYPE FROM DM_OPERATION o " +
|
|
|
|
"RECEIVED_TIMESTAMP, po.PAYLOAD AS PAYLOAD,o.TYPE AS TYPE,o.STATUS as STATUS " +
|
|
|
|
|
|
|
|
"FROM DM_OPERATION o " +
|
|
|
|
"INNER JOIN DM_PROFILE_OPERATION po ON o.ID = po.OPERATION_ID AND o.ID IN (" +
|
|
|
|
"INNER JOIN DM_PROFILE_OPERATION po ON o.ID = po.OPERATION_ID AND o.ID IN (" +
|
|
|
|
"SELECT dom.OPERATION_ID FROM (SELECT d.ID FROM DM_DEVICE d INNER JOIN " +
|
|
|
|
"SELECT dom.OPERATION_ID FROM (SELECT d.ID FROM DM_DEVICE d INNER JOIN " +
|
|
|
|
"DM_DEVICE_TYPE dm ON d.DEVICE_TYPE_ID = dm.ID AND dm.NAME = ? AND " +
|
|
|
|
"DM_DEVICE_TYPE dm ON d.DEVICE_TYPE_ID = dm.ID AND dm.NAME = ? AND " +
|
|
|
@ -152,16 +156,22 @@ public class ProfileOperationDAOImpl extends OperationDAOImpl {
|
|
|
|
|
|
|
|
|
|
|
|
byte[] payload = new byte[0];
|
|
|
|
byte[] payload = new byte[0];
|
|
|
|
if (rs.next()) {
|
|
|
|
if (rs.next()) {
|
|
|
|
payload = rs.getBytes("PAYLOAD");
|
|
|
|
|
|
|
|
operationId = rs.getInt("OPERATION_ID");
|
|
|
|
operationId = rs.getInt("OPERATION_ID");
|
|
|
|
|
|
|
|
createdTime = rs.getTimestamp("CREATED_TIMESTAMP").toString();
|
|
|
|
|
|
|
|
receivedTime = rs.getTimestamp("RECEIVED_TIMESTAMP").toString();
|
|
|
|
|
|
|
|
payload = rs.getBytes("PAYLOAD");
|
|
|
|
operationType = rs.getString("TYPE");
|
|
|
|
operationType = rs.getString("TYPE");
|
|
|
|
|
|
|
|
operationStatus = rs.getString("STATUS");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bais = new ByteArrayInputStream(payload);
|
|
|
|
bais = new ByteArrayInputStream(payload);
|
|
|
|
ois = new ObjectInputStream(bais);
|
|
|
|
ois = new ObjectInputStream(bais);
|
|
|
|
ProfileOperation profileOperation = (ProfileOperation) ois.readObject();
|
|
|
|
ProfileOperation profileOperation = new ProfileOperation();
|
|
|
|
|
|
|
|
profileOperation.setPayload(ois.readObject());
|
|
|
|
profileOperation.setId(operationId);
|
|
|
|
profileOperation.setId(operationId);
|
|
|
|
profileOperation.setType(Operation.Type.valueOf(operationType));
|
|
|
|
profileOperation.setType(Operation.Type.valueOf(operationType));
|
|
|
|
|
|
|
|
profileOperation.setStatus(Operation.Status.valueOf(operationStatus));
|
|
|
|
return profileOperation;
|
|
|
|
return profileOperation;
|
|
|
|
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
} catch (SQLException e) {
|
|
|
|
throw new OperationManagementDAOException("Error occurred while adding operation metadata", e);
|
|
|
|
throw new OperationManagementDAOException("Error occurred while adding operation metadata", e);
|
|
|
|
} catch (ClassNotFoundException e) {
|
|
|
|
} catch (ClassNotFoundException e) {
|
|
|
@ -173,5 +183,4 @@ public class ProfileOperationDAOImpl extends OperationDAOImpl {
|
|
|
|
OperationManagementDAOUtil.cleanupResources(stmt, rs);
|
|
|
|
OperationManagementDAOUtil.cleanupResources(stmt, rs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|