com.acc.storefront.interceptors.beforeview.ConfigGranuleBeforeViewHandler.java Source code

Java tutorial

Introduction

Here is the source code for com.acc.storefront.interceptors.beforeview.ConfigGranuleBeforeViewHandler.java

Source

/*
 * [y] hybris Platform
 *
 * Copyright (c) 2000-2013 hybris AG
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of hybris
 * ("Confidential Information"). You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the
 * license agreement you entered into with hybris.
 * 
 *  
 */
package com.acc.storefront.interceptors.beforeview;

import de.hybris.platform.acceleratorservices.config.SiteConfigService;
import com.acc.storefront.interceptors.BeforeViewHandler;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Required;
import org.springframework.web.servlet.ModelAndView;

/**
 */
public class ConfigGranuleBeforeViewHandler implements BeforeViewHandler {
    private SiteConfigService siteConfigService;

    protected SiteConfigService getSiteConfigService() {
        return siteConfigService;
    }

    @Required
    public void setSiteConfigService(final SiteConfigService siteConfigService) {
        this.siteConfigService = siteConfigService;
    }

    @Override
    public void beforeView(final HttpServletRequest request, final HttpServletResponse response,
            final ModelAndView modelAndView) throws Exception {
        modelAndView.addObject("granuleEnabled",
                Boolean.valueOf(getSiteConfigService().getBoolean("storefront.granule.enabled", false)));
    }
}