Host addStatistics(Host model, VDS entity, UriInfo ui, HttpHeaders httpHeaders) { if (DetailHelper.include(httpHeaders, "statistics")) { model.setStatistics(new Statistics()); HostStatisticalQuery query = new HostStatisticalQuery(newModel(model.getId())); List<Statistic> statistics = query.getStatistics(entity); for (Statistic statistic : statistics) { LinkHelper.addLinks(ui, statistic, query.getParentType()); } model.getStatistics().getStatistics().addAll(statistics); } return model; }