use of org.craftercms.studio.model.rest.dashboard.ContentDashboardItem in project studio by craftercms.
the class DashboardServiceImpl method prepareContentDashboardResult.
private List<ContentDashboardItem> prepareContentDashboardResult(List<ItemMetadata> itemMetadataList) {
List<ContentDashboardItem> contentDashboardItemList = new ArrayList<ContentDashboardItem>();
if (itemMetadataList != null && itemMetadataList.size() > 0) {
for (ItemMetadata item : itemMetadataList) {
ContentDashboardItem contentDashboardItem = new ContentDashboardItem();
contentDashboardItem.setSiteId(item.getSite());
contentDashboardItem.setPath(item.getPath());
contentDashboardItem.setLabel(item.getName());
contentDashboardItem.setModifier(item.getModifier());
contentDashboardItem.setModifiedDate(item.getModified());
contentDashboardItemList.add(contentDashboardItem);
}
}
return contentDashboardItemList;
}
use of org.craftercms.studio.model.rest.dashboard.ContentDashboardItem in project studio by craftercms.
the class DashboardController method getContentDashboard.
@GetMapping(value = CONTENT_DASHBOARD, produces = APPLICATION_JSON_VALUE)
public ResponseBody getContentDashboard(@Valid ContentDashboardRequestParameters requestParameters) {
String modifier = null;
String path = null;
ZonedDateTime dateFrom = null;
ZonedDateTime dateTo = null;
String contentType = null;
long state = 0;
if (requestParameters.getFilters() != null) {
modifier = requestParameters.getFilters().getModifier();
path = requestParameters.getFilters().getPath();
dateFrom = requestParameters.getFilters().getModifiedDateFrom();
dateTo = requestParameters.getFilters().getModifiedDateTo();
contentType = requestParameters.getFilters().getContentType();
state = requestParameters.getFilters().getState();
}
int total = dashboardService.getContentDashboardTotal(requestParameters.getSiteId(), path, modifier, contentType, state, dateFrom, dateTo);
List<ContentDashboardItem> contentDashboardItems = dashboardService.getContentDashboard(requestParameters.getSiteId(), path, modifier, contentType, state, dateFrom, dateTo, requestParameters.getSortBy(), requestParameters.getOrder(), requestParameters.getOffset(), requestParameters.getLimit());
ResponseBody responseBody = new ResponseBody();
PaginatedResultList<ContentDashboardItem> result = new PaginatedResultList<ContentDashboardItem>();
result.setTotal(total);
result.setLimit(CollectionUtils.isEmpty(contentDashboardItems) ? 0 : contentDashboardItems.size());
result.setOffset(requestParameters.getOffset());
result.setEntities(RESULT_KEY_ITEMS, contentDashboardItems);
result.setResponse(OK);
responseBody.setResult(result);
return responseBody;
}
Aggregations