private Double sumChildren(DecoratorContext jobContext, Metric metric) {
Collection<Measure> childrenMeasures = jobContext.getChildrenMeasures(metric);
- if (childrenMeasures != null && childrenMeasures.size() > 0) {
+ if (childrenMeasures != null && !childrenMeasures.isEmpty()) {
Double sum = 0.0;
boolean hasChildrenMeasures = false;
for (Measure measure : childrenMeasures) {
Query query = getSession().createQuery("SELECT r1.id FROM " + ResourceModel.class.getSimpleName() +
" r1 WHERE r1.rootId IS NOT NULL AND NOT EXISTS(FROM " + ResourceModel.class.getSimpleName() + " r2 WHERE r1.rootId=r2.id)");
List<Integer> idsToDelete = query.getResultList();
- if (idsToDelete.size() > 0) {
+ if (!idsToDelete.isEmpty()) {
PurgeUtils.executeQuery(getSession(), "", idsToDelete, "DELETE FROM " + ResourceModel.class.getSimpleName() + " WHERE id in (:ids)");
}
}
Query query = getSession().createQuery("SELECT p.id FROM " + Property.class.getSimpleName() +
" p WHERE p.resourceId IS NOT NULL AND NOT EXISTS(FROM " + ResourceModel.class.getSimpleName() + " r WHERE r.id=p.resourceId)");
List<Integer> idsToDelete = query.getResultList();
- if (idsToDelete.size() > 0) {
+ if (!idsToDelete.isEmpty()) {
PurgeUtils.executeQuery(getSession(), "", idsToDelete, "DELETE FROM " + Property.class.getSimpleName() + " WHERE id in (:ids)");
}
}
Query query = getSession().createQuery("SELECT p.id FROM " + Property.class.getSimpleName() +
" p WHERE p.userId IS NOT NULL AND NOT EXISTS(FROM " + User.class.getSimpleName() + " u WHERE u.id=p.userId)");
List<Integer> idsToDelete = query.getResultList();
- if (idsToDelete.size() > 0) {
+ if (!idsToDelete.isEmpty()) {
PurgeUtils.executeQuery(getSession(), "", idsToDelete, "DELETE FROM " + Property.class.getSimpleName() + " WHERE id in (:ids)");
}
}
}
public boolean hasQualifiers() {
- return qualifiers != null && qualifiers.size() > 0;
+ return qualifiers != null && !qualifiers.isEmpty();
}
public Filter setQualifiers(Set<String> qualifiers) {
private static final View[] PAGES = {new SourceTab(), new CoverageTab(), new ViolationsTab()};
public static View[] getPages() {
- return PAGES;
+ return PAGES.clone();
}
// should be qualifier FILE only but waiting for java refactoring