}
String generateSqlRequest(int resourceId, int snapshotId) {
- return "UPDATE reviews SET status='CLOSED' " + "WHERE resource_id = " + resourceId + " AND rule_failure_permanent_id NOT IN "
+ return "UPDATE reviews SET status='CLOSED' WHERE resource_id = " + resourceId + " AND rule_failure_permanent_id NOT IN "
+ "(SELECT permanent_id FROM rule_failures WHERE snapshot_id = " + snapshotId + " AND permanent_id IS NOT NULL)";
}
}
static final class MeasureKey {
- Integer metricId;
+ int metricId;
Integer characteristicId;
MeasureKey(Object[] pastFields) {
characteristicId = PastMeasuresLoader.getCharacteristicId(pastFields);
}
- MeasureKey(Integer metricId, Integer characteristicId) {
+ MeasureKey(int metricId, Integer characteristicId) {
this.metricId = metricId;
this.characteristicId = characteristicId;
}
return false;
}
MeasureKey that = (MeasureKey) o;
- if (characteristicId != null ? !characteristicId.equals(that.characteristicId) : that.characteristicId != null) {
+ if (metricId != that.metricId) {
return false;
}
- if (!metricId.equals(that.metricId)) {
+ if (characteristicId != null ? !characteristicId.equals(that.characteristicId) : that.characteristicId != null) {
return false;
}
return true;
@Override
public int hashCode() {
- int result = metricId.hashCode();
+ int result = metricId;
result = 31 * result + (characteristicId != null ? characteristicId.hashCode() : 0);
return result;
}
return resource.getId() != null;
}
- public static Integer getMetricId(Object[] row) {
- return (Integer) row[0];
+ public static int getMetricId(Object[] row) {
+ // can be BigDecimal on Oracle
+ return ((Number)row[0]).intValue();
}
public static Integer getCharacteristicId(Object[] row) {
- return (Integer) row[1];
+ // can be BigDecimal on Oracle
+ Number number = (Number) row[1];
+ return number!=null ? number.intValue() : null;
}
public static boolean hasValue(Object[] row) {