Refactor operations mgt connection handling

revert-70aa11f8
manoj 10 years ago
parent 749f2b782e
commit 2e051d8df5

@ -120,19 +120,11 @@ public class OperationManagerImpl implements OperationManager {
try { try {
List<Operation> operations = new ArrayList<Operation>(); List<Operation> operations = new ArrayList<Operation>();
OperationManagementDAOFactory.beginTransaction();
operations.addAll(profileOperationDAO.getOperations(deviceId, Operation.Status.PENDING)); operations.addAll(profileOperationDAO.getOperations(deviceId, Operation.Status.PENDING));
operations.addAll(configOperationDAO.getOperations(deviceId, Operation.Status.PENDING)); operations.addAll(configOperationDAO.getOperations(deviceId, Operation.Status.PENDING));
operations.addAll(commandOperationDAO.getOperations(deviceId, Operation.Status.PENDING)); operations.addAll(commandOperationDAO.getOperations(deviceId, Operation.Status.PENDING));
OperationManagementDAOFactory.commitTransaction();
return operations; return operations;
} catch (OperationManagementDAOException e) { } catch (OperationManagementDAOException e) {
try {
OperationManagementDAOFactory.rollbackTransaction();
} catch (OperationManagementDAOException e1) {
log.warn("Error occurred while roll-backing the transaction", e1);
}
throw new OperationManagementException("Error occurred while retrieving the list of " + throw new OperationManagementException("Error occurred while retrieving the list of " +
"pending operations assigned for '" + deviceId.getType() + "' device '" + "pending operations assigned for '" + deviceId.getType() + "' device '" +
deviceId.getId() + "'", e); deviceId.getId() + "'", e);

@ -54,7 +54,7 @@ public class ProfileOperationDAOImpl extends OperationDAOImpl {
stmt = conn.prepareStatement("INSERT INTO DM_PROFILE_OPERATION(OPERATION_ID, OPERATION_DETAILS) " + stmt = conn.prepareStatement("INSERT INTO DM_PROFILE_OPERATION(OPERATION_ID, OPERATION_DETAILS) " +
"VALUES(?, ?)"); "VALUES(?, ?)");
stmt.setInt(1, operationId); stmt.setInt(1, operationId);
stmt.setBytes(2, bao.toByteArray()); stmt.setObject(2, bao.toByteArray());
stmt.executeUpdate(); stmt.executeUpdate();
} catch (SQLException e) { } catch (SQLException e) {
throw new OperationManagementDAOException("Error occurred while adding profile operation", e); throw new OperationManagementDAOException("Error occurred while adding profile operation", e);

Loading…
Cancel
Save