mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Resolved wso2/product-iots#1358
This commit is contained in:
parent
ec78ba09f2
commit
88303f7f94
@ -170,7 +170,6 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
||||
throws OperationManagementDAOException {
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
boolean result = false;
|
||||
try {
|
||||
Connection connection = OperationManagementDAOFactory.getConnection();
|
||||
String query = "SELECT EOM.ID FROM DM_ENROLMENT_OP_MAPPING EOM INNER JOIN DM_OPERATION DM "
|
||||
@ -182,25 +181,13 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
||||
stmt.setString(3, Operation.Status.PENDING.toString());
|
||||
// This will return only one result always.
|
||||
rs = stmt.executeQuery();
|
||||
int id = 0;
|
||||
if (rs.next()) {
|
||||
id = rs.getInt("ID");
|
||||
}
|
||||
if (id != 0) {
|
||||
stmt = connection.prepareStatement(
|
||||
"UPDATE DM_ENROLMENT_OP_MAPPING SET UPDATED_TIMESTAMP = ? " + "WHERE ID = ?");
|
||||
stmt.setLong(1, System.currentTimeMillis() / 1000);
|
||||
stmt.setInt(2, id);
|
||||
stmt.executeUpdate();
|
||||
result = true;
|
||||
}
|
||||
return true;
|
||||
} catch (SQLException e) {
|
||||
throw new OperationManagementDAOException(
|
||||
"Error occurred while update device mapping operation status " + "metadata", e);
|
||||
} finally {
|
||||
OperationManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loading…
Reference in New Issue
Block a user