if (entity == null)
return null;
List<ProductSummaryDTO> products = new ArrayList<ProductSummaryDTO>();
Publisher publisher = null;
PublisherSummaryDTO publisherSummary = null;
CompanySummaryDTO companySummary = null;
for (Long id : entity.getProductIds()) {
products.add(Product.toSummaryDTO(DatastoreProxy.getProductById(id)));
}
publisher = DatastoreProxy.getPublisherById(entity.getOwnerId());
if (publisher == null) {
// Slot has been booked by company
companySummary = Company.toSummaryDTO(DatastoreProxy.getCompanyById(entity.getOwnerId()));
publisherSummary = new PublisherSummaryDTO();
if (companySummary == null) {
// should not happen
companySummary = new CompanySummaryDTO();
}
} else {
publisherSummary = Publisher.toSummaryDTO(publisher);
companySummary = Company.toSummaryDTO(DatastoreProxy.getCompanyById(publisher.getCompanyId()));
}