Package org.infoglue.cms.entities.content

Examples of org.infoglue.cms.entities.content.ContentVersionVO


    content.setIsBranch(Boolean.FALSE);
    content.setExpireDateTime(changeDate(Calendar.YEAR, 1));
    content = contentStore.create(null, null, REPO, content);
    allContent.add(content);

    ContentVersionVO contentVersion = new ContentVersionVO();
    contentVersion.setVersionModifier("frank");
    contentVersion.setVersionValue(getName());
    contentVersion = contentVersionStore.create(content.getId(), LANGUAGE, contentVersion, null);
    return contentVersion;
  }
View Full Code Here


    testContent.setPublishDateTime(changeDate(Calendar.YEAR, -1));
    testContent.setExpireDateTime(changeDate(Calendar.YEAR, 1));
    testContent = contentStore.create(null, null, REPO, testContent);
    allContent.add(testContent);

    testContentVersion = new ContentVersionVO();
    testContentVersion.setVersionModifier("junit");
    testContentVersion.setVersionValue(getName());
    testContentVersion = contentVersionStore.create(testContent.getId(), LANGUAGE, testContentVersion, null);

    testCategory = new CategoryVO();
View Full Code Here

    List found = contentCategoryStore.findByContentVersion(testContentVersion.getId());
    assertEquals("Wrong number of ContentCategories returned", 1, found.size());
    assertTrue("testContentCategory data not returned", found.contains(testContentCategory));

    List events = new ArrayList();
    ContentVersionVO newVersion = ContentStateController.changeState(testContentVersion.getId(), stateId, getName(), false, getAdminPrincipal(), testContentVersion.getContentId(), events);
    testEventContentVersion = newVersion;

    List newFound = contentCategoryStore.findByContentVersion(newVersion.getId());
    assertEquals("Wrong number of new ContentCategories returned", found.size(), newFound.size());

    ContentCategoryVO newContentCategory = (ContentCategoryVO)newFound.get(0);
    assertEquals("Wrong contentVersionId", newVersion.getContentVersionId(), newContentCategory.getContentVersionId());
    assertEquals("Wrong category", testContentCategory.getCategory(), newContentCategory.getCategory());
    assertEquals("Wrong attribute", testContentCategory.getAttributeName(), newContentCategory.getAttributeName());
  }
View Full Code Here

          }
         
          if(showPageNotifications)
            sb.append("        <li style='margin: 0px; margin-left: 4px; padding: 2px 0px 2px 2px; list-style-type:none;'><a href=\"javascript:openInlineDiv('" + pageSubscriptionUrl + "', 700, 750, true);\" class=\"editOnSightHref linkTakePage\">" + subscribeToPageLabel + "</a></li>");
                 
          ContentVersionVO contentVersionVO = this.getController().getContentVersion(contentId, this.getController().getLanguageId(), true);
          if(contentVersionVO != null && showTranslateArticle)
          {
            List languages = this.getController().getPageLanguages();
           
            Iterator languagesIterator = languages.iterator();
            while(languagesIterator.hasNext())
            {
              LanguageVO languageVO = (LanguageVO)languagesIterator.next();
              if(!contentVersionVO.getLanguageId().equals(languageVO.getId()))
              {
                String translateUrl = componentEditorUrl + "ViewContentVersion!standalone.action?contentId=" + this.contentId + "&languageId=" + languageVO.getLanguageId() + "&anchorName=contentVersionBlock&translate=true&fromLanguageId=" + contentVersionVO.getLanguageId() + "&toLanguageId=" + languageVO.getId(); // + "&KeepThis=true&TB_iframe=true&height=700&width=1000&modal=true";
             
                sb.append("  <li style='margin: 0px; margin-left: 4px; padding: 2px 0px 2px 2px; list-style-type:none;'>");
                sb.append("      <a href=\"javascript:openInlineDiv('" + translateUrl + "', 700, 1000, true);\" class=\"editOnSightHref linkTranslate\">" + translateContentLabel + " &quot;" + languageVO.getLocalizedDisplayLanguage() + "&quot;</a>");
                sb.append(" </li>");
              }
View Full Code Here

      try
      {
        db = CastorDatabaseService.getDatabase();
        db.begin();

        ContentVersionVO contentVersionVO;
        for (Integer contentVersionId : contentVersions)
        {
          contentVersionVO = ContentVersionController.getContentVersionController().getContentVersionVOWithId(contentVersionId, db);
          Integer contentId = contentVersionVO.getContentId();
          Integer languageId = contentVersionVO.getLanguageId();
          @SuppressWarnings("static-access")
          List<DigitalAssetVO> digitalAssetVOs = DigitalAssetController.getController().getDigitalAssetVOList(contentVersionVO.getContentVersionId(), db);

          for (DigitalAssetVO digitalAssetVO : digitalAssetVOs)
          {
            if (deletedFiles.contains(digitalAssetVO.getDigitalAssetId()))
            {
View Full Code Here

   * also has the correct state for this delivery-instance.
   */
 
  public ContentVersionVO getContentVersionVO(Database db, Integer siteNodeId, Integer contentId, Integer languageId, boolean useLanguageFallback, DeliveryContext deliveryContext, InfoGluePrincipal infoGluePrincipal) throws SystemException, Exception
  {
    ContentVersionVO contentVersionVO = null;
    SiteNodeVO siteNodeVO = SiteNodeController.getController().getSiteNodeVOWithId(siteNodeId, db);
    String contentVersionKey = "contentVersionVO_" + siteNodeVO.getRepositoryId() + "_" + contentId + "_" + languageId + "_" + useLanguageFallback;
    contentVersionVO = (ContentVersionVO)CacheController.getCachedObjectFromAdvancedCache("contentVersionCache", contentVersionKey);
   
    if(contentVersionVO != null)
    {
      //logger.info("There was an cached contentVersionVO:" + contentVersionVO.getContentVersionId());
    }
    else
    {
      contentVersionVO = this.getContentVersionVO(siteNodeId, contentId, languageId, db, useLanguageFallback, deliveryContext, infoGluePrincipal);
      if(contentVersionVO != null)
      {
        CacheController.cacheObjectInAdvancedCache("contentVersionCache", contentVersionKey, contentVersionVO, new String[]{CacheController.getPooledString(2, contentVersionVO.getId()), CacheController.getPooledString(1, contentVersionVO.getContentId())}, true);
      }
     
        }
   
    if(contentVersionVO != null && deliveryContext != null)
        deliveryContext.addUsedContentVersion(CacheController.getPooledString(2, contentVersionVO.getId()));
   
    return contentVersionVO;
  }
View Full Code Here

    if(contentId == null || contentId.intValue() < 1)
      return null;
   
    Timer t = new Timer();
   
    ContentVersionVO contentVersion = null;
   
    //MediumContentImpl content = (MediumContentImpl)getObjectWithId(MediumContentImpl.class, contentId, db);
    ContentVO content = getContentVO(db, contentId, deliveryContext);
    boolean isValidContent = isValidContent(infoGluePrincipal, content, languageId, useLanguageFallback, false, db, deliveryContext);
    //deliveryContext.addDebugInformation("isValidContent:" + isValidContent);
View Full Code Here

  public ContentVersionVO getContentVersionVOInState(Integer contentId, Integer languageId, Integer stateId, Database db, DeliveryContext deliveryContext, InfoGluePrincipal infoGluePrincipal) throws SystemException, Exception
  {
    if(contentId == null || contentId.intValue() < 1)
      return null;
   
    ContentVersionVO contentVersion = null;
   
    //MediumContentImpl content = (MediumContentImpl)getObjectWithId(MediumContentImpl.class, contentId, db);
    ContentVO content = ContentController.getContentController().getSmallContentVOWithId(contentId, db, deliveryContext);

    boolean isValidContent = isValidContent(infoGluePrincipal, content, languageId, false, false, db, deliveryContext);
View Full Code Here

   * This method gets a contentVersion with a state and a language which is active.
   */

  private ContentVersionVO getContentVersionVO(Integer contentId, Integer languageId, Integer operatingMode, DeliveryContext deliveryContext, Database db) throws Exception
    {
    ContentVersionVO contentVersionVO = null;
   
      String versionKey = "" + contentId + "_" + languageId + "_" + operatingMode + "_contentVersionVO";
   
    Object object = CacheController.getCachedObjectFromAdvancedCache("contentVersionCache", versionKey);
    if(object instanceof NullObject)
    {
      logger.info("There was an cached contentVersionVO but it was null:" + object);
    }
    else if(object != null)
    {
      if(object instanceof SmallestContentVersionVO)
      {
        logger.warn("Object was instanceof SmallestContentVersionVO for key:" + versionKey);
        contentVersionVO = (ContentVersionVO)getVOWithId(SmallContentVersionImpl.class, ((SmallestContentVersionVO)object).getId(), db);
        CacheController.cacheObjectInAdvancedCache("contentVersionCache", versionKey, contentVersionVO, new String[]{CacheController.getPooledString(2, contentVersionVO.getId()), CacheController.getPooledString(1, contentVersionVO.getContentId())}, true);
      }
      else
      {
        contentVersionVO = (ContentVersionVO)object;
      }
    }
    else
    {
      Timer t = new Timer();

      String smallVersionKey = "" + contentId + "_" + languageId + "_" + operatingMode + "_smallestContentVersionVO";
      Object smallestContentVersionVOCandidate = CacheController.getCachedObjectFromAdvancedCache("contentVersionCache", smallVersionKey);
      if(smallestContentVersionVOCandidate instanceof NullObject)
      {
        //logger.info("There was an cached content version but it was null:" + smallestContentVersionVOCandidate);
      }
      else if(smallestContentVersionVOCandidate != null)
      {
        if(smallestContentVersionVOCandidate instanceof SmallestContentVersionVO)
        {
          contentVersionVO = (ContentVersionVO)getVOWithId(SmallContentVersionImpl.class, ((SmallestContentVersionVO)smallestContentVersionVOCandidate).getId(), db);
          CacheController.cacheObjectInAdvancedCache("contentVersionCache", versionKey, contentVersionVO, new String[]{CacheController.getPooledString(2, contentVersionVO.getId()), CacheController.getPooledString(1, contentVersionVO.getContentId())}, true);
          RequestAnalyser.getRequestAnalyser().registerComponentStatistics("Getting SmallContentVersionImpl", t.getElapsedTime());
        }
        else
        {
          logger.warn("Object was instanceof ContentVersionVO for key:" + versionKey);
          contentVersionVO = (ContentVersionVO)smallestContentVersionVOCandidate;         
        }
           
        CacheController.cacheObjectInAdvancedCache("contentVersionCache", versionKey, contentVersionVO, new String[]{CacheController.getPooledString(2, contentVersionVO.getId()), CacheController.getPooledString(1, contentVersionVO.getContentId())}, true);
      }
      else
      {
        //logger.info("Querying for verson: " + versionKey);
        OQLQuery oql = db.getOQLQuery( "SELECT cv FROM org.infoglue.cms.entities.content.impl.simple.SmallContentVersionImpl cv WHERE cv.contentId = $1 AND cv.languageId = $2 AND cv.stateId >= $3 AND cv.isActive = $4 ORDER BY cv.contentVersionId desc");
          oql.bind(contentId);
          oql.bind(languageId);
          oql.bind(operatingMode);
          oql.bind(true);
   
          QueryResults results = oql.execute(Database.READONLY);
         
        if (results.hasMore())
            {
          ContentVersion contentVersion = (ContentVersion)results.next();
              contentVersionVO = contentVersion.getValueObject();

          CacheController.cacheObjectInAdvancedCache("contentVersionCache", versionKey, contentVersionVO, new String[]{CacheController.getPooledString(2, contentVersionVO.getId()), CacheController.getPooledString(1, contentVersionVO.getContentId())}, true);
            }
        else
        {
          CacheController.cacheObjectInAdvancedCache("contentVersionCache", versionKey, new NullObject(), new String[]{CacheController.getPooledString(1, contentId)}, true);
        }

        results.close();
        oql.close();
      }
     
      if(logger.isInfoEnabled())
        RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getContentVersionVO(Integer contentId, Integer languageId, Integer operatingMode, DeliveryContext deliveryContext, Database db)", t.getElapsedTimeNanos() / 1000);
    }
   
    if(contentVersionVO != null)
        deliveryContext.addUsedContentVersion(CacheController.getPooledString(2, contentVersionVO.getId()));
   
    return contentVersionVO;
    }
View Full Code Here

        contentVersionId = (Integer)CacheController.getCachedObjectFromAdvancedCache(contentVersionIdCacheName, versionKey);
        //logger.info("There was an cached content attribute:" + attribute);
      }
      else
      {
        ContentVersionVO contentVersionVO = getContentVersionVO(db, siteNodeId, contentId, languageId, useLanguageFallback, deliveryContext, infogluePrincipal);
        deliveryContext.addDebugInformation("contentVersionVO:" + contentVersionVO);
        if(contentVersionVO != null)
        {
          deliveryContext.addDebugInformation("contentVersionVO.versionValue:" + contentVersionVO.getVersionValue().length());

            attribute = getAttributeValue(db, contentVersionVO, attributeName, escapeHTML)
          contentVersionId = contentVersionVO.getId();
        }
        else
        {
          attribute = "";
        }
View Full Code Here

TOP

Related Classes of org.infoglue.cms.entities.content.ContentVersionVO

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.