mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Refactor operations mgt connection handling
This commit is contained in:
parent
749f2b782e
commit
2e051d8df5
@ -120,19 +120,11 @@ public class OperationManagerImpl implements OperationManager {
|
||||
try {
|
||||
List<Operation> operations = new ArrayList<Operation>();
|
||||
|
||||
OperationManagementDAOFactory.beginTransaction();
|
||||
operations.addAll(profileOperationDAO.getOperations(deviceId, Operation.Status.PENDING));
|
||||
operations.addAll(configOperationDAO.getOperations(deviceId, Operation.Status.PENDING));
|
||||
operations.addAll(commandOperationDAO.getOperations(deviceId, Operation.Status.PENDING));
|
||||
OperationManagementDAOFactory.commitTransaction();
|
||||
|
||||
return operations;
|
||||
} 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 " +
|
||||
"pending operations assigned for '" + deviceId.getType() + "' device '" +
|
||||
deviceId.getId() + "'", e);
|
||||
|
||||
@ -54,7 +54,7 @@ public class ProfileOperationDAOImpl extends OperationDAOImpl {
|
||||
stmt = conn.prepareStatement("INSERT INTO DM_PROFILE_OPERATION(OPERATION_ID, OPERATION_DETAILS) " +
|
||||
"VALUES(?, ?)");
|
||||
stmt.setInt(1, operationId);
|
||||
stmt.setBytes(2, bao.toByteArray());
|
||||
stmt.setObject(2, bao.toByteArray());
|
||||
stmt.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
throw new OperationManagementDAOException("Error occurred while adding profile operation", e);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user