|
|
@ -76,7 +76,7 @@ public class EnrollmentDAOImpl implements EnrollmentDAO {
|
|
|
|
String sql = "UPDATE DM_ENROLMENT SET OWNERSHIP = ?, STATUS = ?, " +
|
|
|
|
String sql = "UPDATE DM_ENROLMENT SET OWNERSHIP = ?, STATUS = ?, " +
|
|
|
|
"DATE_OF_ENROLMENT = ?, DATE_OF_LAST_UPDATE = ? WHERE DEVICE_ID = ? AND OWNER = ? AND TENANT_ID = ?" +
|
|
|
|
"DATE_OF_ENROLMENT = ?, DATE_OF_LAST_UPDATE = ? WHERE DEVICE_ID = ? AND OWNER = ? AND TENANT_ID = ?" +
|
|
|
|
" AND ID = ?";
|
|
|
|
" AND ID = ?";
|
|
|
|
stmt = conn.prepareStatement(sql, new String[] {"id"});
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
stmt.setString(1, enrolmentInfo.getOwnership().toString());
|
|
|
|
stmt.setString(1, enrolmentInfo.getOwnership().toString());
|
|
|
|
stmt.setString(2, enrolmentInfo.getStatus().toString());
|
|
|
|
stmt.setString(2, enrolmentInfo.getStatus().toString());
|
|
|
|
stmt.setTimestamp(3, new Timestamp(enrolmentInfo.getDateOfEnrolment()));
|
|
|
|
stmt.setTimestamp(3, new Timestamp(enrolmentInfo.getDateOfEnrolment()));
|
|
|
@ -86,11 +86,6 @@ public class EnrollmentDAOImpl implements EnrollmentDAO {
|
|
|
|
stmt.setInt(7, tenantId);
|
|
|
|
stmt.setInt(7, tenantId);
|
|
|
|
stmt.setInt(8, enrolmentInfo.getId());
|
|
|
|
stmt.setInt(8, enrolmentInfo.getId());
|
|
|
|
stmt.executeUpdate();
|
|
|
|
stmt.executeUpdate();
|
|
|
|
|
|
|
|
|
|
|
|
rs = stmt.getGeneratedKeys();
|
|
|
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
|
|
|
status = 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
return status;
|
|
|
|
} catch (SQLException e) {
|
|
|
|
} catch (SQLException e) {
|
|
|
|
throw new DeviceManagementDAOException("Error occurred while updating enrolment configuration", e);
|
|
|
|
throw new DeviceManagementDAOException("Error occurred while updating enrolment configuration", e);
|
|
|
@ -109,18 +104,13 @@ public class EnrollmentDAOImpl implements EnrollmentDAO {
|
|
|
|
conn = this.getConnection();
|
|
|
|
conn = this.getConnection();
|
|
|
|
String sql = "UPDATE DM_ENROLMENT SET OWNERSHIP = ?, STATUS = ?, " +
|
|
|
|
String sql = "UPDATE DM_ENROLMENT SET OWNERSHIP = ?, STATUS = ?, " +
|
|
|
|
"DATE_OF_ENROLMENT = ?, DATE_OF_LAST_UPDATE = ? WHERE ID = ?";
|
|
|
|
"DATE_OF_ENROLMENT = ?, DATE_OF_LAST_UPDATE = ? WHERE ID = ?";
|
|
|
|
stmt = conn.prepareStatement(sql, new String[] {"id"});
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
stmt.setString(1, enrolmentInfo.getOwnership().toString());
|
|
|
|
stmt.setString(1, enrolmentInfo.getOwnership().toString());
|
|
|
|
stmt.setString(2, enrolmentInfo.getStatus().toString());
|
|
|
|
stmt.setString(2, enrolmentInfo.getStatus().toString());
|
|
|
|
stmt.setTimestamp(3, new Timestamp(enrolmentInfo.getDateOfEnrolment()));
|
|
|
|
stmt.setTimestamp(3, new Timestamp(enrolmentInfo.getDateOfEnrolment()));
|
|
|
|
stmt.setTimestamp(4, new Timestamp(new Date().getTime()));
|
|
|
|
stmt.setTimestamp(4, new Timestamp(new Date().getTime()));
|
|
|
|
stmt.setInt(5, enrolmentInfo.getId());
|
|
|
|
stmt.setInt(5, enrolmentInfo.getId());
|
|
|
|
stmt.executeUpdate();
|
|
|
|
stmt.executeUpdate();
|
|
|
|
|
|
|
|
|
|
|
|
rs = stmt.getGeneratedKeys();
|
|
|
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
|
|
|
status = 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
return status;
|
|
|
|
} catch (SQLException e) {
|
|
|
|
} catch (SQLException e) {
|
|
|
|
throw new DeviceManagementDAOException("Error occurred while updating enrolment configuration", e);
|
|
|
|
throw new DeviceManagementDAOException("Error occurred while updating enrolment configuration", e);
|
|
|
|