Search in sources :

Example 16 with ContentDescription

use of com.salesmanager.core.model.content.ContentDescription in project shopizer by shopizer-ecommerce.

the class ShopContentController method displayContent.

@RequestMapping("/shop/pages/{friendlyUrl}.html")
public String displayContent(@PathVariable final String friendlyUrl, Model model, HttpServletRequest request, HttpServletResponse response, Locale locale) throws Exception {
    MerchantStore store = (MerchantStore) request.getAttribute(Constants.MERCHANT_STORE);
    ContentDescription contentDescription = contentService.getBySeUrl(store, friendlyUrl);
    Content content = null;
    if (contentDescription != null) {
        content = contentDescription.getContent();
        if (!content.isVisible()) {
            return "redirect:/shop";
        }
        // meta information
        PageInformation pageInformation = new PageInformation();
        pageInformation.setPageDescription(contentDescription.getMetatagDescription());
        pageInformation.setPageKeywords(contentDescription.getMetatagKeywords());
        pageInformation.setPageTitle(contentDescription.getTitle());
        pageInformation.setPageUrl(contentDescription.getName());
        request.setAttribute(Constants.REQUEST_PAGE_INFORMATION, pageInformation);
    }
    // TODO breadcrumbs
    request.setAttribute(Constants.LINK_CODE, contentDescription.getSeUrl());
    model.addAttribute("content", contentDescription);
    if (!StringUtils.isBlank(content.getProductGroup())) {
        model.addAttribute("productGroup", content.getProductGroup());
    }
    /**
     * template *
     */
    StringBuilder template = new StringBuilder().append(ControllerConstants.Tiles.Content.content).append(".").append(store.getStoreTemplate());
    return template.toString();
}
Also used : PageInformation(com.salesmanager.shop.model.shop.PageInformation) Content(com.salesmanager.core.model.content.Content) ContentDescription(com.salesmanager.core.model.content.ContentDescription) MerchantStore(com.salesmanager.core.model.merchant.MerchantStore) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

ContentDescription (com.salesmanager.core.model.content.ContentDescription)16 Content (com.salesmanager.core.model.content.Content)10 Language (com.salesmanager.core.model.reference.language.Language)8 MerchantStore (com.salesmanager.core.model.merchant.MerchantStore)6 ArrayList (java.util.ArrayList)6 ContentType (com.salesmanager.core.model.content.ContentType)4 PageInformation (com.salesmanager.shop.model.shop.PageInformation)4 ServiceException (com.salesmanager.core.business.exception.ServiceException)3 ReadableCategoryList (com.salesmanager.shop.model.catalog.category.ReadableCategoryList)3 ContentDescriptionEntity (com.salesmanager.shop.model.content.ContentDescriptionEntity)3 ReadableContentPage (com.salesmanager.shop.model.content.page.ReadableContentPage)3 ConstraintException (com.salesmanager.shop.store.api.exception.ConstraintException)3 ResourceNotFoundException (com.salesmanager.shop.store.api.exception.ResourceNotFoundException)3 ServiceRuntimeException (com.salesmanager.shop.store.api.exception.ServiceRuntimeException)3 IOException (java.io.IOException)3 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)3 ContentService (com.salesmanager.core.business.services.content.ContentService)2 LanguageService (com.salesmanager.core.business.services.reference.language.LanguageService)2 FileContentType (com.salesmanager.core.model.content.FileContentType)2 InputContentFile (com.salesmanager.core.model.content.InputContentFile)2