Package org.infoglue.deliver.util

Examples of org.infoglue.deliver.util.Timer


    
  public List<ContentVersionVO> getContentVersionVOList(Integer contentTypeDefinitionId, Integer excludeContentTypeDefinitionId, Integer languageId, boolean showDeletedItems, Integer stateId, Integer lastContentVersionId, Integer limit, Integer cvIdSpan, boolean ascendingOrder, Database db, boolean includeSiteNode, Integer maxContentVersionIdForLanguageVersion) throws Exception
  {
    logger.info("maxContentVersionIdForLanguageVersion for " + languageId + "=" + maxContentVersionIdForLanguageVersion);
    List<ContentVersionVO> contentVersionVOList = new ArrayList<ContentVersionVO>();
    Timer t = new Timer();
   
       StringBuffer SQL = new StringBuffer();
      if(CmsPropertyHandler.getUseShortTableNames() != null && CmsPropertyHandler.getUseShortTableNames().equalsIgnoreCase("true"))
      {
        SQL.append("CALL SQL select * from (select cv.contVerId, cv.stateId, cv.modifiedDateTime, cv.verComment, cv.isCheckedOut, cv.isActive, cv.contId, cv.languageId, cv.versionModifier, cv.verValue, (select count(*) from cmContVerDigAsset cvda where cvda.contVerId = cv.contVerId) AS assetCount ");
        if(includeSiteNode)
            SQL.append(", (select sn.siNoId from cmSiNo sn where sn.metaInfoContentId = c.contId) AS siNoId, (select sn.name from cmSiNo sn where sn.metaInfoContentId = c.contId) AS siteNodeName ");
        else
            SQL.append(", -1 as siNoId, '' as siteNodeName ");
        SQL.append(" from cmCont c, cmContVer cv ");
        SQL.append("WHERE ");
        SQL.append("c.isDeleted = $1 AND  ");
      SQL.append("cv.stateId >= $2 AND ");
      SQL.append("cv.isActive = $3 AND ");
      SQL.append("cv.contId = c.contId AND ");
      SQL.append("cv.contVerId = (  ");
      SQL.append("  select max(contVerId) from cmContVer cv2  ");
      SQL.append("  WHERE  ");
      SQL.append("  cv2.contId = cv.contId AND  ");
      SQL.append("    cv2.languageId = cv.languageId AND ");
      SQL.append("  cv2.isActive = cv.isActive AND ");
      SQL.append("  cv2.stateId >= $4 ");
      SQL.append("  )  ");
     
      int index = 5;
        if(contentTypeDefinitionId != null)
        {
          SQL.append(" AND c.contentTypeDefId = $" + index + "");
          index++;
        }
        if(excludeContentTypeDefinitionId != null)
        {
          SQL.append(" AND c.contentTypeDefId <> $" + index + "");
          index++;
        }
        if(languageId != null)
        {
          SQL.append(" AND cv.languageId = $" + index + "");
          index++;
        }
      if(lastContentVersionId != null && lastContentVersionId > 0)
      {
        SQL.append(" AND cv.contVerId > $" + index + " and cv.contVerId < $" + (index+1) + "");
          index++;
          index++;
      }
      else
      {
        SQL.append(" AND cv.contVerId > $" + index + " and cv.contVerId < $" + (index+1) + "");
          index++;
          index++;
      }
      //SQL.append(" AND rownum<=$" + index + " ");
     
        SQL.append(" order by cv.contVerId " + (ascendingOrder ? "" : "DESC") + ") where rownum<=$" + index + " AS org.infoglue.cms.entities.content.impl.simple.IndexFriendlyContentVersionImpl");
       }
      else
      {
        SQL.append("CALL SQL select cv.contentVersionId, cv.stateId, cv.modifiedDateTime, cv.versionComment, cv.isCheckedOut, cv.isActive, cv.contentId, cv.languageId, cv.versionModifier, cv.versionValue, (select count(*) from cmContentVersionDigitalAsset cvda where cvda.contentVersionId = cv.contentVersionId) AS assetCount ");
        if(includeSiteNode)
            SQL.append(", (select sn.siteNodeId from cmSiteNode sn where sn.metaInfoContentId = c.contentId) AS siteNodeId, (select sn.name from cmSiteNode sn where sn.metaInfoContentId = c.contentId) AS siteNodeName ");
        else
            SQL.append(", -1 as siteNodeId, '' as siteNodeName ");
        SQL.append(" from cmContent c, cmContentVersion cv ");
        SQL.append("WHERE ");
      SQL.append("c.isDeleted = $1 AND  ");
      SQL.append("cv.stateId >= $2 AND ");
      SQL.append("cv.isActive = $3 AND ");
      SQL.append("cv.contentId = c.contentId AND ");
      SQL.append("cv.contentVersionId = (  ");
      SQL.append("  select max(contentVersionId) from cmContentVersion cv2  ");
      SQL.append("  WHERE  ");
      SQL.append("  cv2.contentId = cv.contentId AND  ");
      SQL.append("    cv2.languageId = cv.languageId AND ");
      SQL.append("  cv2.isActive = cv.isActive AND ");
      SQL.append("  cv2.stateId >= $4 ");
      SQL.append("  )  ");
     
      int index = 5;
        if(contentTypeDefinitionId != null)
        {
          SQL.append(" AND c.contentTypeDefinitionId = $" + index + "");
          index++;
        }
        if(excludeContentTypeDefinitionId != null)
        {
          SQL.append(" AND c.contentTypeDefinitionId <> $" + index + "");
          index++;
        }
        if(languageId != null)
        {
          SQL.append(" AND cv.languageId = $" + index + "");
          index++;
        }
      if(lastContentVersionId != null && lastContentVersionId > 0)
      {
        SQL.append(" AND cv.contentVersionId > $" + index + " and cv.contentVersionId < $" + (index+1) + "");
          index++;
          index++;
      }
      else
      {
        SQL.append(" AND cv.contentVersionId > $" + index + " and cv.contentVersionId < $" + (index+1) + "");
          index++;
          index++;
      }

        SQL.append(" order by cv.contentVersionId " + (ascendingOrder ? "" : "DESC") + " limit $" + index + " AS org.infoglue.cms.entities.content.impl.simple.IndexFriendlyContentVersionImpl");
         }
     
      //logger.error("SQL:" + SQL);
      //logger.info("SQL:" + SQL);
      //logger.info("parentSiteNodeId:" + parentSiteNodeId);
      //logger.info("showDeletedItems:" + showDeletedItems);
      OQLQuery oql = db.getOQLQuery(SQL.toString());
    oql.bind(showDeletedItems);
    oql.bind(stateId);
    oql.bind(true);
    oql.bind(stateId);
    if(contentTypeDefinitionId != null)
        oql.bind(contentTypeDefinitionId);
    if(excludeContentTypeDefinitionId != null)
        oql.bind(excludeContentTypeDefinitionId);
    if(languageId != null)
      oql.bind(languageId);
   
    if(lastContentVersionId != null && lastContentVersionId > 0)
    {
      oql.bind(lastContentVersionId);
      oql.bind(lastContentVersionId + (ascendingOrder? cvIdSpan : -cvIdSpan));
    }
    else
    {
      oql.bind(0);
      oql.bind((ascendingOrder? cvIdSpan : -cvIdSpan));
    }
   
    //if(CmsPropertyHandler.getUseShortTableNames() == null || !CmsPropertyHandler.getUseShortTableNames().equalsIgnoreCase("true"))
      oql.bind(limit);
   
    QueryResults results = oql.execute(Database.READONLY);
   
    logger.info("Getting all IndexFriendlyContentVersionImpl took:" +  t.getElapsedTime());
    while (results.hasMore())
    {
      IndexFriendlyContentVersionImpl contentVersion = (IndexFriendlyContentVersionImpl)results.next();
      contentVersionVOList.add(contentVersion.getValueObject());
      //System.out.print(".");
      //String versionKey = "" + contentVersion.getValueObject().getContentId() + "_" + contentVersion.getLanguageId() + "_" + stateId + "_contentVersionVO";
          //CacheController.cacheObjectInAdvancedCache("contentVersionCache", versionKey, contentVersion.getValueObject(), new String[]{CacheController.getPooledString(2, contentVersion.getValueObject().getId()), CacheController.getPooledString(1, contentVersion.getValueObject().getContentId())}, true);
      //CacheController.cacheObjectInAdvancedCache("contentVersionCache", "" + contentVersion.getId(), contentVersion.getValueObject(), new String[]{CacheController.getPooledString(2, contentVersion.getValueObject().getId()), CacheController.getPooledString(1,  contentVersion.getValueObject().getContentId())}, true);
    }
    logger.info("Fetching all IndexFriendlyContentVersionImpl took:" +  t.getElapsedTime() + " and returned " + contentVersionVOList.size());

    results.close();
    oql.close();

    if(maxContentVersionIdForLanguageVersion < 1000)
View Full Code Here


   * @param attribute
   * @return
   */
  public List getRelatedCategories(String attribute)
  {
    Timer t = new Timer();
    List relatedCategories = Collections.EMPTY_LIST;
   
    try
    {
      if(this.groupPropertiesVO != null && this.groupPropertiesVO.getId() != null)
        relatedCategories = getPropertiesCategoryController().findByPropertiesAttribute(attribute, GroupProperties.class.getName()this.groupPropertiesVO.getId());
    }
    catch(Exception e)
    {
      logger.warn("We could not fetch the list of defined category keys: " + e.getMessage(), e);
    }
    t.printElapsedTime("getRelatedCategories took");

    return relatedCategories;
  }
View Full Code Here

 
  /*sss*/
 
  public SmallestContentVersionVO getLatestContentVersionVO(Set<String> contentVersionIds, Database db) throws SystemException, Bug, Exception
    {
    Timer t = new Timer();
    if(contentVersionIds == null || contentVersionIds.size() == 0)
      return null;
   
    SmallestContentVersionVO result = null;
   
    StringBuilder variables = new StringBuilder();
   
    int i = 0;
      for(String contentVersionId : contentVersionIds)
      {
        if(contentVersionId.indexOf("contentVersion_") > -1)
        {
          if(variables.length() > 0)
            variables.append(",");
          variables.append("$" + (i+1));
          i++;
        }
      }
   
      //System.out.println("variables:" + variables);
      //System.out.println("variables:" + variables);

      String SQL = "select cv.contentVersionId, cv.stateId, cv.modifiedDateTime, cv.versionComment, cv.isCheckedOut, cv.isActive, cv.contentId, cv.languageId, cv.versionModifier FROM cmContentVersion cv where cv.contentVersionId IN (" + variables + ") AND cv.stateId >= " + CmsPropertyHandler.getOperatingMode() + " ORDER BY cv.modifiedDateTime DESC";
      if(CmsPropertyHandler.getUseShortTableNames() != null && CmsPropertyHandler.getUseShortTableNames().equalsIgnoreCase("true"))
        SQL = "select cv.contVerId, cv.stateId, cv.modifiedDateTime, cv.verComment, cv.isCheckedOut, cv.isActive, cv.contId, cv.languageId, cv.versionModifier FROM cmContVer cv where cv.contVerId IN (" + variables + ") AND cv.stateId >= " + CmsPropertyHandler.getOperatingMode() + " ORDER BY cv.modifiedDateTime DESC";
     
      //System.out.println("SQL:" + SQL);
     
      OQLQuery oql = db.getOQLQuery("CALL SQL " + SQL + " AS org.infoglue.cms.entities.content.impl.simple.SmallestContentVersionImpl");
      if(CmsPropertyHandler.getUseShortTableNames() != null && CmsPropertyHandler.getUseShortTableNames().equalsIgnoreCase("true"))
        oql = db.getOQLQuery("CALL SQL " + SQL + " AS org.infoglue.cms.entities.content.impl.simple.SmallestContentVersionImpl");
 
    for(String contentVersionId : contentVersionIds)
    {
        if(contentVersionId.indexOf("contentVersion_") > -1)
        {
          logger.info("contentVersionId:" +contentVersionId);
        oql.bind(contentVersionId.replaceAll("contentVersion_", "").replaceAll("_.*", ""));
        }
    }
   
    QueryResults results = oql.execute(Database.READONLY);
      if (results.hasMore())
    {
      SmallestContentVersionImpl contentVersion = (SmallestContentVersionImpl)results.next();
      result = contentVersion.getValueObject();
    }

    results.close();
    oql.close();
   
    t.printElapsedTime("getLatestContentVersion from ids took", 20);
    return result;
  }
View Full Code Here

    return result;
  }
 
  public SmallestContentVersionVO getLatestContentVersionVOByContentIds(Set<String> contentIds, Database db) throws SystemException, Bug, Exception
    {
    Timer t = new Timer();
    if(contentIds == null || contentIds.size() == 0)
      return null;
   
    SmallestContentVersionVO result = null;
   
    StringBuilder variables = new StringBuilder();
    int i = 0;
      for(String contentId : contentIds)
      {
        if(contentId.indexOf("content") > -1)
        {
          if(variables.length() > 0)
            variables.append(",");
          variables.append("$" + (i+1));
          i++;
        }
      }
   
      //System.out.println("variables:" + variables);
      //System.out.println("variables:" + variables);

      String SQL = "select cv.contentVersionId, cv.stateId, cv.modifiedDateTime, cv.versionComment, cv.isCheckedOut, cv.isActive, cv.contentId, cv.languageId, cv.versionModifier FROM cmContentVersion cv where cv.contentId IN (" + variables + ") AND cv.stateId >= " + CmsPropertyHandler.getOperatingMode() + " ORDER BY cv.modifiedDateTime DESC";
      if(CmsPropertyHandler.getUseShortTableNames() != null && CmsPropertyHandler.getUseShortTableNames().equalsIgnoreCase("true"))
        SQL = "select cv.contVerId, cv.stateId, cv.modifiedDateTime, cv.verComment, cv.isCheckedOut, cv.isActive, cv.contId, cv.languageId, cv.versionModifier FROM cmContVer cv where cv.contId IN (" + variables + ") AND cv.stateId >= " + CmsPropertyHandler.getOperatingMode() + " ORDER BY cv.modifiedDateTime DESC";
     
      //System.out.println("SQL:" + SQL);
     
      OQLQuery oql = db.getOQLQuery("CALL SQL " + SQL + " AS org.infoglue.cms.entities.content.impl.simple.SmallestContentVersionImpl");
      if(CmsPropertyHandler.getUseShortTableNames() != null && CmsPropertyHandler.getUseShortTableNames().equalsIgnoreCase("true"))
        oql = db.getOQLQuery("CALL SQL " + SQL + " AS org.infoglue.cms.entities.content.impl.simple.SmallestContentVersionImpl");
 
    for(String contentId : contentIds)
    {
        logger.info("contentId:" +contentId);
        if(contentId.indexOf("content_") > -1)
        {
          oql.bind(contentId.replaceAll("content_", "").replaceAll("_.*", ""));
        }
    }
   
    QueryResults results = oql.execute(Database.READONLY);
      if (results.hasMore())
    {
      SmallestContentVersionImpl contentVersion = (SmallestContentVersionImpl)results.next();
      result = contentVersion.getValueObject();
    }

    results.close();
    oql.close();
   
    t.printElapsedTime("getLatestContentVersion from content ids took", 100);
    return result;
  }
View Full Code Here

        beginTransaction(db);

        try
        {
          Timer t = new Timer();
          Map<Integer,CategoryVO> categoriesMap = new HashMap<Integer,CategoryVO>();
        OQLQuery oql1 = db.getOQLQuery("SELECT c FROM org.infoglue.cms.entities.management.impl.simple.CategoryImpl c ORDER BY c.categoryId");

        QueryResults results1 = oql1.execute(Database.READONLY);
        while (results1.hasMore())
        {
          Category category = (Category)results1.next();
          categoriesMap.put(category.getId(), category.getValueObject());
        }

        results1.close();
        oql1.close();
        logger.warn("Categories took: " + t.getElapsedTime());
          //getCastorCategory().setLevel(Level.DEBUG);
        //getCastorJDOCategory().setLevel(Level.DEBUG);
         
        OQLQuery oql = db.getOQLQuery("SELECT c FROM org.infoglue.cms.entities.management.impl.simple.SmallPropertiesCategoryImpl c ORDER BY c.propertiesCategoryId");

        QueryResults results = oql.execute(Database.READONLY);
        while (results.hasMore())
        {
          PropertiesCategory propertiesCategory = (PropertiesCategory)results.next();
         
          String key = "categoryVOList_" + propertiesCategory.getAttributeName() + "_" + propertiesCategory.getEntityName() + "_" + propertiesCategory.getEntityId();
          List<CategoryVO> categoryVOList = (List<CategoryVO>)CacheController.getCachedObject("propertiesCategoryCache", key);
          if(categoryVOList == null)
          {
            categoryVOList = new ArrayList<CategoryVO>();
            CacheController.cacheObject("propertiesCategoryCache", key, categoryVOList);
          }
         
          if(propertiesCategory.getValueObject().getCategoryId() != null)
          {
            CategoryVO categoryVO = categoriesMap.get(propertiesCategory.getValueObject().getCategoryId());
            if(categoryVO != null)
              categoryVOList.add(categoryVO);
            else
              logger.info("An inconsistency found. The propertyCategory " + propertiesCategory.getId() + " pointed to a missing categoryID: " + propertiesCategory.getValueObject().getCategoryId());
            /*
            try
            {
              CategoryVO categoryVO = CategoryController.getController().findById(propertiesCategory.getValueObject().getCategoryId(), db).getValueObject();
              categoryVOList.add(categoryVO);
            }
            catch (Exception e)
            {
              logger.error("An inconsistency found. The propertyCategory " + propertiesCategory.getId() + " pointed to a missing category:" + e.getMessage());
          }
          */
          }

          /*
          if(propertiesCategory.getCategory() != null)
          {
            categoryVOList.add(propertiesCategory.getCategory().getValueObject());
            //System.out.println("Category was ok for: " + key);           
          }
          //else
            //System.out.println("Category was null for: " + key);
          */
        }

          //getCastorCategory().setLevel(Level.WARN);
        //getCastorJDOCategory().setLevel(Level.WARN);

        results.close();
        oql.close();
       
        CacheController.cacheObject("propertiesCategoryCache", "allValuesCached", true);
       
           logger.warn("PropCategories took: " + t.getElapsedTime());
                 
            commitTransaction(db);
        }
        catch(Exception e)
        {
View Full Code Here

   * @return indication of whether to continue evaluating the JSP page.
   * @throws JspException if an error occurred while processing this tag.
   */
  public int doEndTag() throws JspException
    {
    Timer timer = new Timer();
   
    java.lang.System.setProperty("javax.xml.transform.TransformerFactory", "net.sf.saxon.TransformerFactoryImpl");
   
    Source xmlSource = null;
   
    if(xml != null)
    {
      if(xml instanceof String)
        xmlSource = new StreamSource(new StringReader(this.xmlString))
      else if(xml instanceof Reader)
        xmlSource = new StreamSource((Reader)xml);
    }
    else if(this.source != null)
    {
      if(logger.isDebugEnabled()) 
        logger.info("Input:" + this.source.getClass().getName());
     
      if(this.source instanceof DOMResult)
        xmlSource = new DOMSource(((DOMResult)this.source).getNode());
      else if(this.source instanceof DOMSource)
        xmlSource = (DOMSource)this.source;
      else if(this.source instanceof SAXSource)
        xmlSource = (SAXSource)this.source;
      else if(this.source instanceof StreamSource)
        xmlSource = (StreamSource)this.source;
      else if(this.source instanceof Document)
        xmlSource = new DOMSource((Document)this.source);
      else if(this.source instanceof NodeInfo)
        xmlSource = (Source)this.source;
      else if(this.source instanceof TinyDocumentImpl)
        xmlSource = (TinyDocumentImpl)this.source;
     
      else
        throw new JspException("Bad source - must be either org.w3c.Document or javax.xml.transform.Source");
    }
    else if(this.xmlFile != null)
    {
      xmlSource = new StreamSource(new File(this.xmlFile));
    }
    else if(this.xmlString != null)
    {
      xmlSource = new StreamSource(new StringReader(this.xmlString));     
    }
   
    Templates pss = null;
        Transformer transformer = null;
       
    try
    {
            pss = tryCache(this.styleFile, this.styleString, cacheStyle);
            transformer = pss.newTransformer();
           
            if(logger.isDebugEnabled()) 
        logger.info("outputFormat:" + this.outputFormat);

      if(this.outputFormat.equalsIgnoreCase("string"))
            {
              java.io.ByteArrayOutputStream outputXmlResult = new java.io.ByteArrayOutputStream();
              BufferedOutputStream bos = new BufferedOutputStream(outputXmlResult);
             
              Iterator parametersIterator = parameters.keySet().iterator();
              while(parametersIterator.hasNext())
              {
                String name = (String)parametersIterator.next();
                Object value = parameters.get(name);
                transformer.setParameter(name, value);
              }
              Iterator outputParametersIterator = outputParameters.keySet().iterator();
              while(parametersIterator.hasNext())
              {
                String name = (String)parametersIterator.next();
                String value = (String)parameters.get(name);
                transformer.setOutputProperty(name, value);
              }
              transformer.transform(xmlSource, new StreamResult(bos));
              bos.close();
             
              String result = outputXmlResult.toString();
              setResultAttribute(result);
            }
            else if(this.outputFormat.equalsIgnoreCase("document"))
            {
              DOMResult domResult = new DOMResult();
               
              Iterator parametersIterator = parameters.keySet().iterator();
              while(parametersIterator.hasNext())
              {
                String name = (String)parametersIterator.next();
                Object value = parameters.get(name);
                transformer.setParameter(name, value);
              }
              Iterator outputParametersIterator = outputParameters.keySet().iterator();
              while(parametersIterator.hasNext())
              {
                String name = (String)parametersIterator.next();
                String value = (String)parameters.get(name);
                transformer.setOutputProperty(name, value);
              }

              transformer.transform(xmlSource, domResult);
              setResultAttribute(domResult.getNode());
          }
            else if(this.outputFormat.equalsIgnoreCase("tinyDocument"))
            {
              Iterator parametersIterator = parameters.keySet().iterator();
              while(parametersIterator.hasNext())
              {
                String name = (String)parametersIterator.next();
                Object value = parameters.get(name);
                transformer.setParameter(name, value);
              }
              Iterator outputParametersIterator = outputParameters.keySet().iterator();
              while(parametersIterator.hasNext())
              {
                String name = (String)parametersIterator.next();
                String value = (String)parameters.get(name);
                transformer.setOutputProperty(name, value);
              }

              TinyBuilder builder = new TinyBuilder();

              transformer.transform(xmlSource, builder);
              setResultAttribute(builder.getCurrentRoot());
            }
     
      if(logger.isInfoEnabled())
        timer.printElapsedTime("Saxon Transform to dom document took");           
    }
    catch (Exception e)
    {
            logger.error("Error transforming with SAXON:" + e.getMessage(), e);
        }
View Full Code Here

  private String getContentAttributeValue(Integer languageId) throws JspException
  {
      String result = null;
     
      Timer t = new Timer();
      if(contentVersionVO != null)
      {
        if(!parse)
            {
                result = getController().getContentAttribute(contentVersionVO, attributeName, disableEditOnSight);
                if(escapeVelocityCode)
                  result = result.replaceAll("\\$(?!(\\.|\\(|templateLogic\\.(getPageUrl|getInlineAssetUrl|languageId)))", "&#36;");
            }
          else
          {
              result = getController().getParsedContentAttribute(contentVersionVO, attributeName, disableEditOnSight);
            }
      }
      else if(contentId != null)
        {
            if(!parse)
            {
                result = getController().getContentAttribute(contentId, languageId, attributeName, disableEditOnSight);
              //result = result.replaceAll("#", "&#35;");
                if(escapeVelocityCode)
                  result = result.replaceAll("\\$(?!(\\.|\\(|templateLogic\\.(getPageUrl|getInlineAssetUrl|languageId)))", "&#36;");
            }
          else
          {
        if(!escapeVelocityCode)
                result = getController().getParsedContentAttribute(contentId, languageId, attributeName, disableEditOnSight);
        else
                result = getController().getEscapedParsedContentAttribute(contentId, languageId, attributeName, disableEditOnSight);
        }
        }
        else if(propertyName != null)
        {
          if(!parse)
            {
                result = getComponentLogic().getContentAttribute(propertyName, languageId, attributeName, disableEditOnSight, useInheritance, useRepositoryInheritance, useStructureInheritance);
              //result = result.replaceAll("#", "&#35;");
                if(escapeVelocityCode)
                  result = result.replaceAll("\\$(?!(\\.|\\(|templateLogic\\.(getPageUrl|getInlineAssetUrl|languageId)))", "&#36;");
            }
          else
            {
            result = getComponentLogic().getParsedContentAttribute(propertyName, languageId, attributeName, disableEditOnSight, useInheritance, useRepositoryInheritance, useStructureInheritance, escapeVelocityCode);
            }
        }
        else
        {
            throw new JspException("You must specify either contentId or propertyName");
        }
     
      if(logger.isInfoEnabled())
        RequestAnalyser.getRequestAnalyser().registerComponentStatistics("contentAttribute tag", t.getElapsedTimeNanos() / 1000);

      return result;
  }
View Full Code Here

  /**
   *
   */
  public int doEndTag() throws JspException
    {
    Timer t = new Timer();
    if(comparatorClass!=null && !comparatorClass.equals(""))
    {
      produceResult(sorter.getContentResult(comparatorClass));
    }
    else
    {
      produceResult(sorter.getContentResult())
    }

      if(logger.isInfoEnabled())
        RequestAnalyser.getRequestAnalyser().registerComponentStatistics("ContentSort tag", t.getElapsedTimeNanos() / 1000);       

    this.sorter.clear();
    this.sorter = null;
    this.input = new ArrayList();
    this.comparatorClass = null;
View Full Code Here

        super();
    }

  public int doEndTag() throws JspException
    {
    Timer t = new Timer();
   
    List freeTextAttributeNamesList = null;
    if(freeTextAttributeNames != null && !freeTextAttributeNames.equals(""))
    {
      String[] freeTextAttributeNamesArray = freeTextAttributeNames.split(",");
      if(freeTextAttributeNamesArray.length > 0)
        freeTextAttributeNamesList = Arrays.asList(freeTextAttributeNamesArray);
    }

    List<Integer> repositoryIdList = null;
    if(repositoryIds != null && !repositoryIds.equals(""))
    {
      String[] repositoryIdsArray = repositoryIds.split(",");
      if(repositoryIdsArray.length > 0)
      {
        repositoryIdList = new ArrayList<Integer>();
        for(int i=0; i<repositoryIdsArray.length; i++)
        {
          repositoryIdList.add(new Integer(repositoryIdsArray[i]));
        }
      }
    }

    if(languageId == null)
      this.languageId = getController().getLanguageId();

    try
    {
      String maximumNumberOfItemsInMatchingContentsSearch = CmsPropertyHandler.getServerNodeProperty("maximumNumberOfItemsInMatchingContentsSearch", true, null);
      if(maximumNumberOfItemsInMatchingContentsSearch != null && !maximumNumberOfItemsInMatchingContentsSearch.equals("") && !maximumNumberOfItemsInMatchingContentsSearch.equals("-1"))
        this.maximumNumberOfItems = new Integer(maximumNumberOfItemsInMatchingContentsSearch);
    }
    catch (Exception e)
    {
      logger.warn("Problem setting maximumNumberOfItemsInMatchingContentsSearch:" + e.getMessage());
    }
    if(scheduleFetch && scheduleInterval != null)
    {
      cacheInterval = -1;
    }
   
    logger.info("cacheInterval:" + cacheInterval);
   
    List result = getController().getMatchingContents(contentTypeDefinitionNames, categoryCondition, freeText, freeTextAttributeNamesList, fromDate, toDate, expireFromDate, expireToDate, versionModifier, maximumNumberOfItems, true, cacheResult, cacheInterval, cacheName, cacheKey, scheduleFetch, scheduleInterval, repositoryIdList, this.languageId, skipLanguageCheck, startNodeId, sortColumn, sortOrder, false, validateAccessRightsAsAnonymous, false, false);
      logger.info("result:" + result.size());
    setResultAttribute(result);
     
      this.contentTypeDefinitionNames = null;
      this.categoryCondition = null;
      this.freeText = null;
    this.freeTextAttributeNames = null;
    this.fromDate = null;
    this.toDate = null;
    this.versionModifier = null;
    this.maximumNumberOfItems = null;
    this.expireFromDate = null;
    this.expireToDate = null;
   
    this.cacheResult = true;
    this.cacheInterval = 1800;
    this.cacheName = null;
    this.cacheKey = null;
    this.repositoryIds = null;
    this.languageId = null;
    this.skipLanguageCheck = false;

    this.startNodeId = null;
    this.scheduleFetch = false;
    this.scheduleInterval = 900;
    this.validateAccessRightsAsAnonymous = false;
    this.sortColumn = null;
    this.sortOrder = null;
   
    this.useLucene = false;
   
      long runningTime = t.getElapsedTime();
      if(runningTime > 500)
        logger.info("Running matching contents took:" + runningTime + " ms");
     
      return EVAL_PAGE;
    }
View Full Code Here

   {
    try
    {
      if(classLoader == null)
      {
        Timer t = new Timer();
        //logger.info("Setting our own classloaders - smart for:" + CmsPropertyHandler.getContextRootPath());
        String extensionBasePath = CmsPropertyHandler.getContextRootPath() + "WEB-INF" + File.separator + "libextensions";
        File extensionBaseFile = new File(extensionBasePath);
        extensionBaseFile.mkdirs();
        File[] extensionFiles = extensionBaseFile.listFiles();
        List<URL> urls = new ArrayList<URL>();
 
        for(File extensionFile : extensionFiles)
        {
          if(extensionFile.getName().endsWith(".jar"))
          {
            //ClassLoaderUtil.addFile(extensionFile.getPath());
            //logger.info("extensionFile:" + extensionFile.getPath()); 
         
            URL url = extensionFile.toURL();
            urls.add(url);
          }
        }
       
        URL[] urlsArray = new URL[urls.size()];
        int i = 0;
        for(URL url : urls)
        {
          urlsArray[i] = url;
          i++;
        }
       
        classLoader = new URLClassLoader(urlsArray, this.getClass().getClassLoader());
        //t.printElapsedTime("Creating classloader took");
      }

      Thread.currentThread().setContextClassLoader(classLoader);
      //logger.info("ClassLoader in context for thread:" + Thread.currentThread().getId() + ":" + Thread.currentThread().getContextClassLoader().getClass().getName());
    }
    catch (Throwable t)
    {
      t.printStackTrace();
    }


       //wrap request if needed
       if(CmsPropertyHandler.getApplicationName().equalsIgnoreCase("cms"))
View Full Code Here

TOP

Related Classes of org.infoglue.deliver.util.Timer

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.