Search in sources :

Example 1 with ContentJO

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;
}
Also used : ContentJO(org.entando.entando.plugins.jacms.apsadmin.content.rs.model.ContentJO) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) ContentRecordVO(com.agiletec.plugins.jacms.aps.system.services.content.model.ContentRecordVO) EntitySearchFilter(com.agiletec.aps.system.common.entity.model.EntitySearchFilter)

Aggregations

EntitySearchFilter (com.agiletec.aps.system.common.entity.model.EntitySearchFilter)1 Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)1 ContentRecordVO (com.agiletec.plugins.jacms.aps.system.services.content.model.ContentRecordVO)1 ContentJO (org.entando.entando.plugins.jacms.apsadmin.content.rs.model.ContentJO)1