Package org.infoglue.cms.entities.content

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


        if(event.getTypeId().intValue() == EventVO.PUBLISH.intValue())
        {
          event.setTypeId(EventVO.PUBLISH_DENIED);
          if(event.getEntityClass().equals(ContentVersion.class.getName()))
          {
            ContentVersion contentVersion = ContentVersionController.getContentVersionController().getContentVersionWithId(event.getEntityId(), db);
            if(contentVersion.getStateId().intValue() == ContentVersionVO.PUBLISHED_STATE.intValue())
            {
              //If its a published version we just deletes the event - we don't want to delete the version.
              EventController.delete(event, db);
            }
            else
            {
              Content content = contentVersion.getOwningContent();
              Language language = contentVersion.getLanguage();
              //event.setEntityId(ContentVersionController.getPreviousContentVersionVO(content.getId(), language.getId(), contentVersion.getId()).getId());
              ContentVersionVO contentVersionVO = ContentVersionController.getContentVersionController().getPreviousActiveContentVersionVO(content.getId(), language.getId(), contentVersion.getId(), db);
              if(contentVersionVO != null && event != null)
                event.setEntityId(contentVersionVO.getId());
             
              ContentVersionController.getContentVersionController().delete(contentVersion, db);
            }
View Full Code Here


    logger.info("typeId:" + typeId);
   
    // Publish contentversions
        if(entityClass.equals(ContentVersion.class.getName()))
    {
      ContentVersion contentVersion = null;
      ContentVersion oldContentVersion = null;
      if(!isDeleteOperation)
        oldContentVersion = ContentVersionController.getContentVersionController().getMediumContentVersionWithId(entityId, db);
      else
        oldContentVersion = ContentVersionController.getContentVersionController().getReadOnlyMediumContentVersionWithId(entityId, db);
     
      if(oldContentVersion != null && typeId.intValue() == EventVO.UNPUBLISH_LATEST.intValue())
      {
          oldContentVersion.setIsActive(new Boolean(false));
          contentVersion = oldContentVersion;
          /*
        contentVersion = ContentVersionController.getContentVersionController().getLatestPublishedContentVersion(oldContentVersion.getOwningContent().getContentId(), oldContentVersion.getLanguage().getLanguageId(), db);
        if(contentVersion != null)
        {
          //We just set the published version to not active.
          contentVersion.setIsActive(new Boolean(false));
        }
        */
      }
      /*
      else if(oldContentVersion != null && oldContentVersion.getOwningContent() != null && typeId.intValue() == EventVO.UNPUBLISH_ALL.intValue())
      {
        //We just set the published version to not active.
          oldContentVersion.setIsActive(new Boolean(false));
      }
      */
      else if(oldContentVersion != null && oldContentVersion.getValueObject().getContentId() != null)
      {
          List events = new ArrayList();
        Integer contentId = oldContentVersion.getValueObject().getContentId();
          ContentVersion newContentVersion = ContentStateController.changeState(entityId, contentVO, ContentVersionVO.PUBLISHED_STATE, "Published", overrideVersionModifyer, null, infoGluePrincipal, contentId, db, events);
          contentVersion = null;
          if(!isDeleteOperation)
            contentVersion = ContentVersionController.getContentVersionController().getMediumContentVersionWithId(newContentVersion.getContentVersionId(), db);
          else
            contentVersion = ContentVersionController.getContentVersionController().getReadOnlyMediumContentVersionWithId(newContentVersion.getContentVersionId(), db);
      }

      if(contentVersion != null)
      {
        //The contentVersion in here is the version we have done something with...
View Full Code Here

    try
    {
      if(publicationDetail.getEntityClass().equals(ContentVersion.class.getName()))
      {
        ContentVersion contentVersion = ContentVersionController.getContentVersionController().getContentVersionWithId(publicationDetail.getEntityId(), db);
        contentVersion.setIsActive(new Boolean(false));
        repositoryId = contentVersion.getOwningContent().getRepository().getId();
      }
      else if(publicationDetail.getEntityClass().equals(SiteNodeVersion.class.getName()))
      {
          SiteNodeVersion siteNodeVersion = SiteNodeVersionController.getController().getSiteNodeVersionWithId(publicationDetail.getEntityId(), db);
          siteNodeVersion.setIsActive(new Boolean(false));
View Full Code Here

    {
        boolean createEvent = false;
       
      if(publicationDetail.getEntityClass().equals(ContentVersion.class.getName()))
      {
        ContentVersion contentVersion = ContentVersionController.getContentVersionController().getContentVersionWithId(publicationDetail.getEntityId(), db);
        if(contentVersion.getOwningContent() != null)
        {
          contentVersion.setIsActive(new Boolean(true));
          repositoryId = contentVersion.getOwningContent().getRepository().getId();
             createEvent = true;
        }
         else
         {
             logger.warn("The contentVersion:" + contentVersion.getId() + " had no content - this should never happen, investigate why. Removing invalid content version.");
          ContentVersionController.getContentVersionController().delete(contentVersion, db);
         }
      }
      else if(publicationDetail.getEntityClass().equals(SiteNodeVersion.class.getName()))
      {
View Full Code Here

  public static ContentVO getOwningContentVO(Integer id) throws SystemException
    {
      ContentVO contentVO = null;

      Database db = CastorDatabaseService.getDatabase();
    ContentVersion contentVersion = null;
        beginTransaction(db);
        try
        {
        contentVersion = ContentVersionController.getContentVersionController().getContentVersionWithId(id, db);
        contentVO = contentVersion.getOwningContent().getValueObject();
        //Content content = ContentController.getContentController().getContentWithId(contentVersion.getValueObject().getContentId(), db);
        //contentVO = content.getValueObject();

        commitTransaction(db);
        }
View Full Code Here

        beginTransaction(db);

        try
        {
          ContentVersion contentVersion = getAndRepairLatestContentVersion(db, contentId, languageId);
          if(contentVersion != null)
            contentVersionVO = contentVersion.getValueObject();
             
            commitTransaction(db);
        }
        catch(Exception e)
        {
View Full Code Here

    return contentVersionVO;
    }

  public ContentVersion getAndRepairLatestContentVersion(Database db, Integer contentId, Integer languageId) throws SystemException, Bug, Exception
    {
      ContentVersion contentVersion = ContentVersionController.getContentVersionController().getLatestContentVersion(contentId, languageId, db);
      if(contentVersion != null)
      {
        contentVersion.setIsActive(true);
        contentVersion.setStateId(ContentVersionVO.WORKING_STATE);
        }
       
    return contentVersion;
    }
View Full Code Here

      Integer previousContentId  = new Integer(-1);
      Integer previousLanguageId = new Integer(-1);   
      int currentCount = 0;
      while(results.hasMore() && currentCount < maxRows)
      {
        ContentVersion contentVersion = (ContentVersion)results.next();
        logger.info("Found a version matching " + searchString + ":" + contentVersion.getId() + "=" + contentVersion.getOwningContent().getName());
        if(contentVersion.getOwningContent().getId().intValue() != previousContentId.intValue() || contentVersion.getLanguage().getId().intValue() != previousLanguageId.intValue())
        {
            ContentVersion latestContentVersion = ContentVersionController.getContentVersionController().getLatestActiveContentVersion(contentVersion.getOwningContent().getId(), contentVersion.getLanguage().getId(), db);
          if(latestContentVersion.getId().intValue() == contentVersion.getId().intValue() && (caseSensitive == null || contentVersion.getVersionValue().indexOf(searchString) > -1))
          {
            if(!searchAssets || (contentVersion.getDigitalAssets() != null && contentVersion.getDigitalAssets().size() > 0))
            {
                matchingContents.add(contentVersion.getValueObject());
                previousContentId = contentVersion.getOwningContent().getId();
                previousLanguageId = contentVersion.getLanguage().getId();
                currentCount++;
            }
          }
        }
      }

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

      if(searchAssets)
      {
        String assetSQL = "SELECT da FROM org.infoglue.cms.entities.content.impl.simple.SmallDigitalAssetImpl da WHERE (da.assetKey LIKE $1 OR da.assetFileName LIKE $2) ORDER BY da.digitalAssetId asc";
        logger.info("assetSQL:" + assetSQL);
        OQLQuery assetOQL = db.getOQLQuery(assetSQL);
        assetOQL.bind("%" + searchString + "%");
        assetOQL.bind("%" + searchString + "%");
           
        QueryResults assetResults = assetOQL.execute(Database.READONLY);
       
        previousContentId  = new Integer(-1);
        previousLanguageId = new Integer(-1);   
        currentCount = 0;
       
        while(assetResults.hasMore() && currentCount < maxRows)
        {
          SmallDigitalAssetImpl smallAsset = (SmallDigitalAssetImpl)assetResults.next();
          DigitalAsset asset = DigitalAssetController.getMediumDigitalAssetWithId(smallAsset.getId(), db);
          logger.info("Found a asset matching " + searchString + ":" + asset.getId());
          Collection versions = asset.getContentVersions();
          Iterator versionsIterator = versions.iterator();
          while(versionsIterator.hasNext())
          {
            ContentVersion contentVersion = (ContentVersion)versionsIterator.next();
            if(contentVersion.getOwningContent().getId().intValue() != previousContentId.intValue() || contentVersion.getLanguage().getId().intValue() != previousLanguageId.intValue())
            {
                ContentVersion latestContentVersion = ContentVersionController.getContentVersionController().getLatestActiveContentVersion(contentVersion.getOwningContent().getId(), contentVersion.getLanguage().getId(), db);
              if(latestContentVersion.getId().intValue() == contentVersion.getId().intValue() && (caseSensitive == null || contentVersion.getVersionValue().indexOf(searchString) > -1))
              {
                  matchingContents.add(contentVersion.getValueObject());
                  previousContentId = contentVersion.getOwningContent().getId();
                  previousLanguageId = contentVersion.getLanguage().getId();
                  currentCount++;
View Full Code Here

     
      QueryResults results = oql.execute(Database.READONLY);
     
      while(results.hasMore())
      {
        ContentVersion contentVersion = (ContentVersion)results.next();
        if(logger.isInfoEnabled())
          logger.info("Found a version matching:" + contentVersion.getId() + ":" + contentVersion.getOwningContent().getExpireDateTime());
       
        ContentVersion latestContentVersion = ContentVersionController.getContentVersionController().getLatestActiveContentVersion(contentVersion.getValueObject().getContentId(), contentVersion.getValueObject().getLanguageId(), db);
        if(latestContentVersion.getId().intValue() == contentVersion.getId().intValue())
        {
          matchingContentVersions.add(contentVersion.getValueObject());
        }
      }
View Full Code Here

          logger.info("Found a asset matching " + searchString + ":" + asset.getId());
          Collection versions = asset.getContentVersions();
          Iterator versionsIterator = versions.iterator();
          while(versionsIterator.hasNext())
          {
            ContentVersion contentVersion = (ContentVersion)versionsIterator.next();
            if(contentVersion.getValueObject().getContentId().intValue() != previousContentId.intValue() || contentVersion.getValueObject().getLanguageId().intValue() != previousLanguageId.intValue())
            {
                ContentVersion latestContentVersion = ContentVersionController.getContentVersionController().getLatestActiveContentVersion(contentVersion.getValueObject().getContentId(), contentVersion.getValueObject().getLanguageId(), db);
              if(latestContentVersion != null && latestContentVersion.getId().intValue() == contentVersion.getId().intValue())
              {
                asset.getValueObject().setContentPath(ContentController.getContentController().getContentPath(latestContentVersion.getValueObject().getContentId(), false, true, db));
                asset.getValueObject().setContentId(latestContentVersion.getValueObject().getContentId());

                String assetUrl = getDigitalAssetUrl(asset.getValueObject(), db);
                String assetThumbnailUrl = getDigitalAssetThumbnailUrl(asset.getValueObject().getId(), 100, 60, "ffffff", "center", "middle", 100, 60, 75, db);
                asset.getValueObject().setAssetUrl(assetUrl);
                asset.getValueObject().setAssetThumbnailUrl(assetThumbnailUrl);
View Full Code Here

TOP

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

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.