queryContext.setPage(pageIndex, 50);
Result<QProfileActivity> result = service.searchActivities(query, queryContext);
- return new QProfileActivityResult(result.getHits(), Paging.create(queryContext.getLimit(), pageIndex, Long.valueOf(result.getTotal()).intValue()));
+ return new QProfileActivityResult(result.getHits(), Paging.create(queryContext.getLimit(), pageIndex, (int) result.getTotal()));
}
@Override
import java.util.Date;
import java.util.Map;
+import static com.google.common.collect.Maps.newHashMap;
+
/**
* Base implementation for business objects based on elasticsearch document
*/
protected final Map<String, Object> fields;
+ protected BaseDoc() {
+ this.fields = newHashMap();
+ }
+
protected BaseDoc(Map<String, Object> fields) {
this.fields = fields;
}
@Override
public DOMAIN next() {
- if (hits.isEmpty()) {
- fillQueue();
+ if (!hasNext()) {
+ throw new NoSuchElementException();
}
return toDoc(hits.poll().getSource());
}
@Override
public void remove() {
- throw new IllegalStateException("Cannot remove item from scroll Iterable!!!" +
- " Use Service or DAO classes instead");
+ throw new UnsupportedOperationException("Cannot remove item from scroll");
}
};
}
.setQuery(QueryBuilders.filteredQuery(
QueryBuilders.matchAllQuery(),
getLastSynchronizationBuilder(params)
- ))
+ ))
.setSize(0)
.addAggregation(AggregationBuilders.max("latest")
.field(BaseNormalizer.UPDATED_AT_FIELD));
Max max = response.getAggregations().get("latest");
if (max.getValue() > 0) {
- Date date = new DateTime(Double.valueOf(max.getValue()).longValue()).toDate();
+ Date date = new DateTime((long) max.getValue()).toDate();
LOG.debug("Index {}:{} has last update of {}", this.getIndexName(), this.getIndexType(), date);
return date;
} else {
/**
* Decorator that computes Sqale Rating metric
*/
-public final class SqaleRatingDecorator implements Decorator {
+public class SqaleRatingDecorator implements Decorator {
private final SqaleRatingSettings sqaleRatingSettings;
private final Metric[] metrics;
} else if (nbHours < 48) {
return message("day");
} else if (nbDays < 30) {
- return message("days", Double.valueOf(Math.floor(nbDays)).longValue());
+ return message("days", (long)(Math.floor(nbDays)));
} else if (nbDays < 60) {
return message( "month");
} else if (nbDays < 365) {
- return message("months", Double.valueOf(Math.floor(nbDays / 30)).longValue());
+ return message("months", (long)(Math.floor(nbDays / 30)));
} else if (nbYears < 2) {
return message("year");
}
- return message("years", Double.valueOf(Math.floor(nbYears)).longValue());
+ return message("years", (long)(Math.floor(nbYears)));
}
private static Result message(String key) {
import org.sonar.core.rule.RuleDto;
import javax.annotation.Nullable;
-import java.util.Date;
+
import java.util.List;
public interface IssueMapper {