Package org.infoglue.deliver.controllers.kernel.impl.simple

Examples of org.infoglue.deliver.controllers.kernel.impl.simple.BasicTemplateController


          t.append(qc(foregroundColor));
          t.append(q(backgroundColor));
          t.append(")");
 
         
          BasicTemplateController templateController = getTemplateController(dbWrapper, siteNodeId, languageId, contentId);
          generatedImage = templateController.renderString(t.toString());
          generatedCommand = t.toString();
         
       
          closeTransaction(dbWrapper.getDatabase());
    }
View Full Code Here


        return "success";
    }

    public BasicTemplateController getTemplateController(DatabaseWrapper databaseWrapper, Integer siteNodeId, Integer languageId, Integer contentId) throws SystemException, Exception
  {
        BasicTemplateController templateController = new BasicTemplateController(databaseWrapper, this.getInfoGluePrincipal());
    templateController.setStandardRequestParameters(siteNodeId, languageId, contentId)
    templateController.setHttpRequest(getRequest())
    templateController.setBrowserBean(new BrowserBean());
    templateController.setDeliveryControllers(NodeDeliveryController.getNodeDeliveryController(siteNodeId, languageId, contentId), null, IntegrationDeliveryController.getIntegrationDeliveryController(siteNodeId,languageId, contentId))
    return templateController;   
  }
View Full Code Here

   * normal site-delivery version.
   */
 
  public TemplateController getTemplateController(DatabaseWrapper dbWrapper, Integer siteNodeId, Integer languageId, Integer contentId, HttpServletRequest request, InfoGluePrincipal infoGluePrincipal, boolean allowEditOnSightAtAll, BrowserBean browserBean, NodeDeliveryController nodeDeliveryController, IntegrationDeliveryController integrationDeliveryController) throws SystemException, Exception
  {
    TemplateController templateController = new BasicTemplateController(dbWrapper, infoGluePrincipal);
    templateController.setStandardRequestParameters(siteNodeId, languageId, contentId)
    templateController.setHttpRequest(request)
    templateController.setBrowserBean(browserBean);
    templateController.setDeliveryControllers(nodeDeliveryController, null, integrationDeliveryController)
   
    return templateController;   
  }
View Full Code Here

  public TemplateController getTemplateController(DatabaseWrapper databaseWrapper, Integer siteNodeId, Integer languageId, Integer contentId, HttpServletRequest request, InfoGluePrincipal infogluePrincipal) throws Exception
  {
      NodeDeliveryController nodeDeliveryController        = NodeDeliveryController.getNodeDeliveryController(siteNodeId, languageId, contentId);
    IntegrationDeliveryController integrationDeliveryController  = IntegrationDeliveryController.getIntegrationDeliveryController(siteNodeId, languageId, contentId);
   
    TemplateController templateController = new BasicTemplateController(databaseWrapper, infogluePrincipal);
    templateController.setStandardRequestParameters(siteNodeId, languageId, contentId)
    templateController.setHttpRequest(request)
    templateController.setDeliveryControllers(nodeDeliveryController, null, integrationDeliveryController)
    return templateController;   
  }
View Full Code Here

   * normal site-delivery version.
   */
 
  public TemplateController getTemplateController(DatabaseWrapper dbWrapper, Integer siteNodeId, Integer languageId, Integer contentId, HttpServletRequest request, InfoGluePrincipal infoGluePrincipal, boolean allowEditOnSightAtAll) throws SystemException, Exception
  {
    TemplateController templateController = new BasicTemplateController(dbWrapper, infoGluePrincipal);
    templateController.setStandardRequestParameters(siteNodeId, languageId, contentId)
    templateController.setHttpRequest(request)
    templateController.setBrowserBean(browserBean);
    templateController.setDeliveryControllers(this.nodeDeliveryController, null, this.integrationDeliveryController)
   
    String operatingMode = CmsPropertyHandler.getOperatingMode();
   
    if(operatingMode != null && (operatingMode.equals("0") || operatingMode.equals("1") || operatingMode.equals("2")))
    {
        String editOnSite = CmsPropertyHandler.getEditOnSite();
      boolean isEditOnSightDisabled = templateController.getIsEditOnSightDisabled();
     
      if(allowEditOnSightAtAll && !isEditOnSightDisabled && editOnSite != null && editOnSite.equalsIgnoreCase("true"))
      {
        templateController = new EditOnSiteBasicTemplateController(dbWrapper, infoGluePrincipal);
        templateController.setStandardRequestParameters(siteNodeId, languageId, contentId)
        templateController.setHttpRequest(request)
        templateController.setBrowserBean(browserBean);
        templateController.setDeliveryControllers(this.nodeDeliveryController, null, this.integrationDeliveryController)
      }
    }
   
    return templateController;   
  }
View Full Code Here

   * normal site-delivery version.
   */
 
  public TemplateController getTemplateController(DatabaseWrapper dbWrapper, Integer siteNodeId, Integer languageId, Integer contentId, HttpServletRequest request, InfoGluePrincipal infoGluePrincipal, boolean allowEditOnSightAtAll, BrowserBean browserBean, NodeDeliveryController nodeDeliveryController, IntegrationDeliveryController integrationDeliveryController) throws SystemException, Exception
  {
    TemplateController templateController = new BasicTemplateController(dbWrapper, infoGluePrincipal);
    templateController.setStandardRequestParameters(siteNodeId, languageId, contentId)
    templateController.setHttpRequest(request)
    templateController.setBrowserBean(browserBean);
    templateController.setDeliveryControllers(nodeDeliveryController, null, integrationDeliveryController)
   
    return templateController;   
  }
View Full Code Here

            try
            {
              dbWrapperCached.getDatabase().begin();
             
              InfoGluePrincipal user = UserControllerProxy.getController(dbWrapperCached.getDatabase()).getUser(bean.getUserName());
              BasicTemplateController tc = new BasicTemplateController(dbWrapperCached, user);
              DeliveryContext deliveryContext = DeliveryContext.getDeliveryContext(false);
              tc.setDeliveryControllers(NodeDeliveryController.getNodeDeliveryController(null, deliveryContext.getLanguageId(), null, deliveryContext), null, null)
              tc.setDeliveryContext(deliveryContext);
 
              cachedMatchingContents = tc.getMatchingContents(bean.getContentTypeDefinitionNames(),
                     bean.getCategoryCondition(),
                     bean.getFreeText(),
                     bean.getFreeTextAttributeNamesList(),
                     bean.getFromDate(),
                     bean.getToDate(),
                     bean.getExpireFromDate(),
                     bean.getExpireToDate(),
                     bean.getVersionModifier(),
                     bean.getMaximumNumberOfItems(),
                     true,
                     true,
                     bean.getCacheInterval(),
                     bean.getCacheName(),
                     bean.getCacheKey(),
                     bean.getScheduleFetch(),
                     bean.getScheduleInterval(),
                     bean.getRepositoryIdsList(),
                     bean.getLanguageId(),
                     bean.getSkipLanguageCheck(),
                     bean.getStartNodeId(),
                     bean.getSortColumn(),
                     bean.getSortOrder(),
                     false,
                     bean.getValidateAccessRightsAsAnonymous(),
                     true,
                     true);

             
              //This part check the matching contents cache for directives to recache... it is a cache entry marking when the cache-refresh request was made
              if(bean.getContentTypeDefinitionNames() != null && !bean.getContentTypeDefinitionNames().equals(""))
              {
                String[] contentTypeDefinitionNames = bean.getContentTypeDefinitionNames().split(",");
                for(String contentTypeDefinitionName : contentTypeDefinitionNames)
                {
                  try
                  {
                    ContentTypeDefinitionVO contentTypeDefinitionVO = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOWithName(contentTypeDefinitionName, dbWrapperCached.getDatabase());
                    if(contentTypeDefinitionVO != null)
                    {
                      logger.info("Do not throw page cache on this if it's not a content of type:" + contentTypeDefinitionVO.getName());
                        String recacheMark = (String)CacheController.getCachedObjectFromAdvancedCache("matchingContentsCache", "recacheAllMark");
                        logger.info("recacheMark:" + recacheMark);
                        if(recacheMark == null)
                          recacheMark = (String)CacheController.getCachedObjectFromAdvancedCache("matchingContentsCache", "recacheMark_" + contentTypeDefinitionVO.getId());
                       
                        logger.info("recacheMark:" + recacheMark);
                        if(recacheMark != null)
                        {
                          long markTime = Long.parseLong(recacheMark);
                          long diffMark = System.currentTimeMillis() - markTime;
                          logger.info("It was " + diffMark + " since the recache directive was added.");
                          logger.info("Bean was last fetched " + bean.getLastFetched() + ".");
                          if(diffMark > 30000)
                          {
                            logger.info("Deleting the mark..");
                            CacheController.clearCache("matchingContentsCache", "recacheMark_" + contentTypeDefinitionVO.getId());
                          }
                          else if(markTime > bean.getLastFetched())
                          {
                            logger.info("Forcing a recache as the mark was later than the last fetched.");
                            forceRecache = true;
                          }
                          else
                          {
                            logger.info("Doing nothing:" + markTime + "/" + bean.getLastFetched() + "/" + diffMark);
                          }
                        }
                      }
                  }
                  catch (Exception e)
                  {
                    logger.warn("Error reading content type: " + e.getMessage(), e);
                  }
                }
              }
              else
              {
                  String recacheMark = (String)CacheController.getCachedObjectFromAdvancedCache("matchingContentsCache", "recacheMark");
                  logger.info("recacheMark:" + recacheMark);
                  if(recacheMark != null)
                  {
                    long markTime = Long.getLong(recacheMark);
                    long diffMark = System.currentTimeMillis() - markTime;
                    logger.info("It was " + diffMark + " since the recache directive was added.");
                    logger.info("Bean was last fetched " + bean.getLastFetched() + ".");
                    if(diffMark > 3600000)
                    {
                      logger.info("Deleting the mark..");
                      CacheController.clearCache("matchingContentsCache", "recacheMark");
                    }
                    else if(markTime > bean.getLastFetched())
                    {
                      logger.info("Forcing a recache as the mark was later than the last fetched.");
                      forceRecache = true;
                    }
                    else
                    {
                      logger.info("Doing nothing:" + markTime + "/" + bean.getLastFetched() + "/" + diffMark);
                    }
                  }
              }
              //END TEST

              dbWrapperCached.getDatabase().rollback();
            }
            catch (Exception e)
            {
              removeQueueBean = true;
              dbWrapperCached.getDatabase().rollback();
              logger.error("Error in matching contents:" + e.getMessage(), e);
            }
            finally
            {
              dbWrapperCached.getDatabase().close();
            }
                       
            logger.info("diff:" + diff);
            logger.info("bean.getScheduleInterval()" + bean.getScheduleInterval());
            logger.info("Cached matches:" + (cachedMatchingContents == null ? "null" : cachedMatchingContents.size()));
            logger.info("removeQueueBean:" + removeQueueBean);

            logger.info("cachedMatchingContents:" + (cachedMatchingContents == null ? "null" : cachedMatchingContents.size()));

            if(!removeQueueBean && (diff > bean.getScheduleInterval() || cachedMatchingContents == null || forceRecache)) //|| cachedMatchingContents.size() == 0
            {
              logger.info("Running match either because the time was now or because no cached result was found or there was a recache directive in the cache");
              logger.info("forceRecache:" + forceRecache);
              logger.info("removeQueueBean:" + removeQueueBean);
              logger.info("diff:" + diff);
              logger.info("bean.getScheduleInterval():" + bean.getScheduleInterval());
               
              DatabaseWrapper dbWrapper = new DatabaseWrapper(CastorDatabaseService.getDatabase());
              try
              {
                dbWrapper.getDatabase().begin();
               
                InfoGluePrincipal user = UserControllerProxy.getController(dbWrapper.getDatabase()).getUser(bean.getUserName());
                BasicTemplateController tc = new BasicTemplateController(dbWrapper, user);
                DeliveryContext deliveryContext = DeliveryContext.getDeliveryContext(false);
                tc.setDeliveryControllers(NodeDeliveryController.getNodeDeliveryController(null, deliveryContext.getLanguageId(), null, deliveryContext), null, null)
                tc.setDeliveryContext(deliveryContext);
               
                List matchingContents = tc.getMatchingContents(bean.getContentTypeDefinitionNames(),
                             bean.getCategoryCondition(),
                             bean.getFreeText(),
                             bean.getFreeTextAttributeNamesList(),
                             bean.getFromDate(),
                             bean.getToDate(),
View Full Code Here

TOP

Related Classes of org.infoglue.deliver.controllers.kernel.impl.simple.BasicTemplateController

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.