public boolean revokeApprovals(Collection<Approval> approvals) {
logger.debug(String.format("Revoking approvals: [%s]", approvals));
boolean success = true;
for (final Approval approval : approvals) {
if (handleRevocationsAsExpiry) {
int refreshed = jdbcTemplate.update(expireApprovalStatement, new PreparedStatementSetter() {
@Override
public void setValues(PreparedStatement ps) throws SQLException {
ps.setTimestamp(1, new Timestamp(System.currentTimeMillis()));
ps.setString(2, approval.getUserId());
ps.setString(3, approval.getClientId());
ps.setString(4, approval.getScope());
}
});
if (refreshed != 1) {
success = false;
}
}
else {
int refreshed = jdbcTemplate.update(deleteApprovalStatment, new PreparedStatementSetter() {
@Override
public void setValues(PreparedStatement ps) throws SQLException {
ps.setString(1, approval.getUserId());
ps.setString(2, approval.getClientId());
ps.setString(3, approval.getScope());