use of org.entando.entando.plugins.jacms.apsadmin.content.rs.model.ContentJO in project entando-core by entando.
the class ContentFinderAction method getLastUpdateContentResponse.
@SuppressWarnings("rawtypes")
public List<ContentJO> getLastUpdateContentResponse() {
List<ContentJO> response = null;
try {
EntitySearchFilter modifyOrder = new EntitySearchFilter(IContentManager.CONTENT_MODIFY_DATE_FILTER_KEY, false);
modifyOrder.setOrder(EntitySearchFilter.DESC_ORDER);
List<String> ids = this.getContentManager().searchId(new EntitySearchFilter[] { modifyOrder });
if (null != ids && !ids.isEmpty()) {
if (this.getLastUpdateResponseSize() > ids.size() - 1)
this.setLastUpdateResponseSize(ids.size() - 1);
List<String> subList = ids.subList(0, this.getLastUpdateResponseSize());
response = new ArrayList<ContentJO>();
Iterator<String> sublist = subList.iterator();
while (sublist.hasNext()) {
String contentId = sublist.next();
Content content = this.getContentManager().loadContent(contentId, false);
ContentRecordVO vo = this.getContentManager().loadContentVO(contentId);
ContentJO contentJO = new ContentJO(content, vo);
response.add(contentJO);
}
}
} catch (Throwable t) {
_logger.error("Error loading last updated content response", t);
throw new RuntimeException("Error loading last updated content response", t);
}
return response;
}
Aggregations