@Override protected boolean shouldHandleEvent(final OrderCancelledEvent event) { final OrderModel order = event.getProcess().getOrder(); ServicesUtil.validateParameterNotNullStandardMessage("event.order", order); final BaseSiteModel site = order.getSite(); ServicesUtil.validateParameterNotNullStandardMessage("event.order.site", site); return SiteChannel.B2C.equals(site.getChannel()); }
/** * Processing normal request (i.e. when user goes directly to that application - not from * cmscockpit) * * <p><b>Note:</b> <br> * We preparing application by setting correct: * * <ul> * <li>Current Site * <li>Current Catalog Versions * <li>Enabled language fallback * </ul> * * @see ContextInformationLoader#initializeSiteFromRequest(String) * @see ContextInformationLoader#setCatalogVersions() * @param httpRequest current request * @param httpResponse the http response * @throws java.io.IOException */ protected boolean processNormalRequest( final HttpServletRequest httpRequest, final HttpServletResponse httpResponse) throws IOException { final String queryString = httpRequest.getQueryString(); final String currentRequestURL = httpRequest.getRequestURL().toString(); // set current site CMSSiteModel cmsSiteModel = getCurrentCmsSite(); if (cmsSiteModel == null || StringUtils.contains(queryString, CLEAR_CMSSITE_PARAM)) { final String absoluteURL = StringUtils.removeEnd(currentRequestURL, "/") + (StringUtils.isBlank(queryString) ? "" : "?" + queryString); cmsSiteModel = getContextInformationLoader().initializeSiteFromRequest(absoluteURL); } if (cmsSiteModel == null) { // Failed to lookup CMS site httpResponse.sendError(MISSING_CMS_SITE_ERROR_STATUS, MISSING_CMS_SITE_ERROR_MESSAGE); return false; } else if (!SiteChannel.B2C.equals(cmsSiteModel.getChannel())) // Restrict to B2C channel { // CMS site that we looked up was for an unsupported channel httpResponse.sendError( MISSING_CMS_SITE_ERROR_STATUS, INCORRECT_CMS_SITE_CHANNEL_ERROR_MESSAGE); return false; } if (!isActiveSite(cmsSiteModel)) { throw new IllegalStateException( "Site is not active. Active flag behaviour must be implement for this project."); } getContextInformationLoader().setCatalogVersions(); // set fall back language enabled setFallbackLanguage(httpRequest, Boolean.TRUE); return true; }