use of org.craftercms.studio.model.rest.dashboard.PublishingDashboardItem in project studio by craftercms.
the class DashboardServiceImpl method preparePublishingResult.
private List<PublishingDashboardItem> preparePublishingResult(List<PublishingHistoryItem> publishingHistory) {
List<PublishingDashboardItem> publishingDashboardItems = new ArrayList<PublishingDashboardItem>();
for (PublishingHistoryItem historyItem : publishingHistory) {
PublishingDashboardItem dashboardItem = new PublishingDashboardItem();
ItemMetadata itemMetadata = objectMetadataManager.getProperties(historyItem.getSiteId(), historyItem.getPath());
dashboardItem.setSiteId(historyItem.getSiteId());
dashboardItem.setPath(historyItem.getPath());
dashboardItem.setLabel(itemMetadata.getName());
dashboardItem.setEnvironment(historyItem.getEnvironment());
dashboardItem.setPublishedDate(historyItem.getPublishedDate());
dashboardItem.setPublisher(historyItem.getPublisher());
publishingDashboardItems.add(dashboardItem);
}
return publishingDashboardItems;
}
use of org.craftercms.studio.model.rest.dashboard.PublishingDashboardItem in project studio by craftercms.
the class PublishServiceImpl method preparePublishingResult.
private List<PublishingDashboardItem> preparePublishingResult(List<PublishingHistoryItem> publishingHistory) {
List<PublishingDashboardItem> publishingDashboardItems = new ArrayList<PublishingDashboardItem>();
for (PublishingHistoryItem historyItem : publishingHistory) {
PublishingDashboardItem dashboardItem = new PublishingDashboardItem();
ItemMetadata itemMetadata = objectMetadataManager.getProperties(historyItem.getSiteId(), historyItem.getPath());
dashboardItem.setSiteId(historyItem.getSiteId());
dashboardItem.setPath(historyItem.getPath());
dashboardItem.setLabel(itemMetadata.getName());
dashboardItem.setEnvironment(historyItem.getEnvironment());
dashboardItem.setPublishedDate(historyItem.getPublishedDate());
dashboardItem.setPublisher(historyItem.getPublisher());
publishingDashboardItems.add(dashboardItem);
}
return publishingDashboardItems;
}
use of org.craftercms.studio.model.rest.dashboard.PublishingDashboardItem in project studio by craftercms.
the class DashboardController method getPublishingDashboard.
@GetMapping(value = PUBLISHING_DASHBOARD, produces = APPLICATION_JSON_VALUE)
public ResponseBody getPublishingDashboard(@Valid PublishingDashboardRequestParameters requestParameters) {
String user = null;
String environment = null;
String path = null;
ZonedDateTime dateFrom = null;
ZonedDateTime dateTo = null;
String contentType = null;
long state = 0;
if (requestParameters.getFilters() != null) {
user = requestParameters.getFilters().getPublisher();
path = requestParameters.getFilters().getPath();
environment = requestParameters.getFilters().getEnvironment();
dateFrom = requestParameters.getFilters().getPublishedDateFrom();
dateTo = requestParameters.getFilters().getPublishedDateTo();
contentType = requestParameters.getFilters().getContentType();
}
int total = 0;
List<PublishingDashboardItem> publishingHistory = dashboardService.getPublishingHistory(requestParameters.getSiteId(), environment, path, user, dateFrom, dateTo, contentType, state, requestParameters.getSortBy(), requestParameters.getOrder(), requestParameters.getOffset(), requestParameters.getLimit());
ResponseBody responseBody = new ResponseBody();
PaginatedResultList<PublishingDashboardItem> result = new PaginatedResultList<PublishingDashboardItem>();
result.setTotal(total);
result.setLimit(CollectionUtils.isEmpty(publishingHistory) ? 0 : publishingHistory.size());
result.setOffset(requestParameters.getOffset());
result.setEntities(RESULT_KEY_ITEMS, publishingHistory);
result.setResponse(OK);
responseBody.setResult(result);
return responseBody;
}
Aggregations