Package org.infoglue.cms.entities.content

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


    {
      //RequestAnalyser.getRequestAnalyser().registerComponentStatistics("isValidContentPart3", t.getElapsedTimeNanos() / 1000000);

      //ContentVersion contentVersion = getContentVersion(content, languageId, getOperatingMode(), deliveryContext, db);
      //TODO
      ContentVersionVO contentVersion = getContentVersionVO(content.getId(), languageId, getOperatingMode(deliveryContext), deliveryContext, db);
        //SmallestContentVersionVO contentVersion = getSmallestContentVersionVO(content.getId(), languageId, getOperatingMode(deliveryContext), deliveryContext, db);
      //RequestAnalyser.getRequestAnalyser().registerComponentStatistics("isValidContentPart4", t.getElapsedTimeNanos() / 1000);
       
      RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getContentVersionVO in isValid(micro)", t.getElapsedTimeNanos() / 1000);
View Full Code Here


    {
      if(checkVersionExists)
        {
        //ContentVersion contentVersion = getContentVersion(content, languageId, getOperatingMode(), deliveryContext, db);
        //TODO
          ContentVersionVO contentVersion = getContentVersionVO(content.getId(), languageId, getOperatingMode(deliveryContext), deliveryContext, db);
          //SmallestContentVersionVO contentVersion = getSmallestContentVersionVO(content.getId(), languageId, getOperatingMode(deliveryContext), deliveryContext, db);
         
          //RequestAnalyser.getRequestAnalyser().registerComponentStatistics("isValidContentPart4.2", t.getElapsedTimeNanos() / 1000);
 
          Integer repositoryId = content.getRepositoryId();
View Full Code Here

     
                        Database db = CastorDatabaseService.getDatabase();
                        db.begin();
                       
                        LanguageVO masterLanguageVO = LanguageController.getController().getMasterLanguage(previousSiteNodeVO.getRepositoryId(), db);
                        ContentVersionVO metaInfoContentVersionVO = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(previousSiteNodeVO.getMetaInfoContentId(), masterLanguageVO.getId(), db);
                        addCacheUpdateDirective(ContentVersionImpl.class.getName(), metaInfoContentVersionVO.getId().toString(), allIGCacheCalls);
                       
                        List contentVersionIds = new ArrayList();
                        if(previousSiteNodeVO.getMetaInfoContentId() != null)
                        {
                          List<SmallestContentVersionVO> contentVersionVOList = ContentVersionController.getContentVersionController().getSmallestContentVersionVOList(previousSiteNodeVO.getMetaInfoContentId(), db);
View Full Code Here

      pageTemplateHTML += "<table border=\"0\" width=\"80%\" cellspacing=\"0\"><tr>";
     
      while(sortedPageTemplatesIterator.hasNext())
      {
        ContentVO contentVO = (ContentVO)sortedPageTemplatesIterator.next();
        ContentVersionVO contentVersionVO = this.getTemplateController().getContentVersion(contentVO.getId(), LanguageDeliveryController.getLanguageDeliveryController().getMasterLanguageForSiteNode(getDatabase(), siteNodeId).getId(), false);
        if(contentVersionVO != null)
        {
          String imageUrl = this.getTemplateController().getAssetUrl(contentVO.getId(), "thumbnail");
          if(imageUrl == null || imageUrl.equals(""))
            imageUrl = this.getRequest().getContextPath() + "/css/images/undefinedPageTemplate.jpg";
View Full Code Here

    public static ContentVersionVO changeState(Integer oldContentVersionId, ContentVO contentVO, Integer stateId, String versionComment, boolean overrideVersionModifyer, String recipientFilter, InfoGluePrincipal infoGluePrincipal, Integer contentId, List resultingEvents) throws ConstraintException, SystemException
    {
      Database db = CastorDatabaseService.getDatabase();
        ConstraintExceptionBuffer ceb = new ConstraintExceptionBuffer();
   
    ContentVersionVO newContentVersionVO = null;
   
        beginTransaction(db);
    try
    {
      if(contentId == null)
View Full Code Here

     
      //Here we create a new version if it was a state-change back to working, it's a copy of the publish-version
      if (stateId.intValue() == ContentVersionVO.WORKING_STATE.intValue())
      {
        logger.info("About to create a new working version");
        ContentVersionVO newContentVersionVO = new ContentVersionVO();
        newContentVersionVO.setStateId(stateId);
        if(versionComment != null && !versionComment.equals(""))
          newContentVersionVO.setVersionComment(versionComment);
        else
            newContentVersionVO.setVersionComment("New working version");
        newContentVersionVO.setModifiedDateTime(DateHelper.getSecondPreciseDate());
        if(overrideVersionModifyer)
            newContentVersionVO.setVersionModifier(infoGluePrincipal.getName());
          else
              newContentVersionVO.setVersionModifier(oldContentVersion.getVersionModifier());

        newContentVersionVO.setVersionValue(oldContentVersion.getVersionValue());
        newContentVersion = ContentVersionController.getContentVersionController().createMedium(oldContentVersion, contentId, oldContentVersion.getValueObject().getLanguageId(), newContentVersionVO, oldContentVersion.getContentVersionId(), (oldContentVersion.getDigitalAssets().size() > 0), true, duplicateAssets, excludedAssetId, db);
        //newContentVersion = ContentVersionController.getContentVersionController().create(contentId, oldContentVersion.getLanguage().getLanguageId(), newContentVersionVO, oldContentVersion.getContentVersionId(), true, duplicateAssets, excludedAssetId, db);

        //ContentVersionController.getContentVersionController().copyDigitalAssets(oldContentVersion, newContentVersion, db);
        if(contentVO.getIsProtected().equals(ContentVO.YES))
          copyAccessRights(oldContentVersion.getId(), newContentVersion.getId(), db);
        copyContentCategories(oldContentVersion.getId(), newContentVersion.getId(), db);

        RegistryController.getController().updateContentVersionThreaded(newContentVersion.getValueObject(), null);
      }

      //If the user changes the state to publish we create a copy and set that copy to publish.
      if (stateId.intValue() == ContentVersionVO.PUBLISH_STATE.intValue())
      {
        logger.info("About to copy the working copy to a publish-one");

        //First we update the old working-version so it gets a comment
        logger.info("Setting comment " + versionComment + " on " + oldContentVersion.getId());
        //oldContentVersion.setVersionComment(versionComment);
       
        if(CmsPropertyHandler.getUseApprovalFlow().equals("true"))
        {
          //Now we create a new version which is basically just a copy of the working-version
          ContentVersionVO newContentVersionVO = new ContentVersionVO();
          newContentVersionVO.setStateId(stateId);
          newContentVersionVO.setVersionComment(versionComment);
          newContentVersionVO.setModifiedDateTime(DateHelper.getSecondPreciseDate());
          if(overrideVersionModifyer)
              newContentVersionVO.setVersionModifier(infoGluePrincipal.getName());
            else
                newContentVersionVO.setVersionModifier(oldContentVersion.getVersionModifier());
          newContentVersionVO.setVersionValue(oldContentVersion.getVersionValue());
          newContentVersion = ContentVersionController.getContentVersionController().createMedium(oldContentVersion, contentId, oldContentVersion.getValueObject().getLanguageId(), newContentVersionVO, oldContentVersion.getContentVersionId(), (oldContentVersion.getDigitalAssets().size() > 0), false, duplicateAssets, excludedAssetId, db);
          logger.info("Creating " + newContentVersion.getId());
         
          //ContentVersionController.getContentVersionController().copyDigitalAssets(oldContentVersion, newContentVersion, db);
          if(contentVO.getIsProtected().equals(ContentVO.YES))
View Full Code Here

    String componentStructure = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><components></components>";
   
    ContentVO metaInfoContentVO = ContentController.getContentController().getContentVOWithId(this.contentId);
    Integer originalMetaInfoMasterLanguageId = LanguageController.getController().getMasterLanguage(metaInfoContentVO.getRepositoryId()).getId();
    Integer destinationMasterLanguageId = LanguageController.getController().getMasterLanguage(this.repositoryId).getId();
    ContentVersionVO originalContentVersionVO = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(this.contentId, originalMetaInfoMasterLanguageId);
    logger.info("originalMetaInfoMasterLanguageId:" + originalMetaInfoMasterLanguageId);
    logger.info("contentId:" + contentId);
    logger.info("originalContentVersionVO:" + originalContentVersionVO);
   
      componentStructure = ContentVersionController.getContentVersionController().getAttributeValue(originalContentVersionVO.getId(), "ComponentStructure", false);
      logger.info("componentStructure:" + componentStructure);
    if(componentId != null)
    {
      logger.info("We should strip all but componentId:" + componentId);
      Document document = XMLHelper.readDocumentFromByteArray(componentStructure.getBytes("UTF-8"));
      String componentXPath = "//component[@id=" + componentId + "]";

      Node node = org.apache.xpath.XPathAPI.selectSingleNode(document.getDocumentElement(), componentXPath);
      if(node != null)
      {
        Element component = (Element)node;
        component.setAttribute("pagePartTemplateContentId", "-1");
        component.setAttribute("isInherited", "true");
         
        String modifiedXML = XMLHelper.serializeDom(component, new StringBuffer()).toString();
        logger.info("modifiedXML:" + modifiedXML);
        componentStructure = "<?xml version='1.0' encoding='UTF-8'?><components>" + modifiedXML + "</components>";
      }
    }
     
    //Create initial content version also... in masterlanguage
    String versionValue = "<?xml version='1.0' encoding='UTF-8'?><article xmlns=\"x-schema:ArticleSchema.xml\"><attributes><Name><![CDATA[" + this.name + "]]></Name><GroupName><![CDATA[" + this.groupName + "]]></GroupName><ComponentStructure><![CDATA[" + componentStructure + "]]></ComponentStructure></attributes></article>";
 
    ContentVersionVO contentVersionVO = new ContentVersionVO();
    contentVersionVO.setVersionComment("Saved page template");
    contentVersionVO.setVersionModifier(this.getInfoGluePrincipal().getName());
    contentVersionVO.setVersionValue(versionValue);
    ContentVersionVO newContentVersion = ContentVersionController.getContentVersionController().create(contentVO.getId(), destinationMasterLanguageId, contentVersionVO, null);
       
   
      InputStream is = null;
    File file = null;
   
      try
      {
        MultiPartRequestWrapper mpr = ActionContext.getContext().getMultiPartRequest();
        logger.info("mpr:" + mpr);
        if(mpr != null)
        {
          Enumeration names = mpr.getFileNames();
             while (names.hasMoreElements())
             {
                String name       = (String)names.nextElement();
          String contentType    = mpr.getContentType(name);
          String fileSystemName = mpr.getFilesystemName(name);
         
          logger.info("name:" + name);
          logger.info("contentType:" + contentType);
          logger.info("fileSystemName:" + fileSystemName);
               
                file = mpr.getFile(name);
                if(file != null)
                {
            String fileName = fileSystemName;
            //fileName = new VisualFormatter().replaceNonAscii(fileName, '_');
                  fileName = new VisualFormatter().replaceNiceURINonAsciiWithSpecifiedChars(fileName, CmsPropertyHandler.getNiceURIDefaultReplacementCharacter());

            String tempFileName = "tmp_" + System.currentTimeMillis() + "_" + fileName;
                  String filePath = CmsPropertyHandler.getDigitalAssetPath();
                  fileSystemName = filePath + File.separator + tempFileName;
                 
                  DigitalAssetVO newAsset = new DigitalAssetVO();
            newAsset.setAssetContentType(contentType);
            newAsset.setAssetKey("thumbnail");
            newAsset.setAssetFileName(fileName);
            newAsset.setAssetFilePath(filePath);
            newAsset.setAssetFileSize(new Integer(new Long(file.length()).intValue()));
            is = new FileInputStream(file);
           
              DigitalAssetController.create(newAsset, is, newContentVersion.getContentVersionId(), this.getInfoGluePrincipal());                  
                }
              }
        }
        else
        {
View Full Code Here

        logger.info("contentId:" + contentId);
        logger.info("componentId:" + componentId);
       
        ContentVO pagePartContentVO = ContentController.getContentController().getContentVOWithId(pagePartContentId);
    Integer pagePartMasterLanguageId = LanguageController.getController().getMasterLanguage(pagePartContentVO.getRepositoryId()).getId();
    ContentVersionVO pagePartContentVersionVO = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(pagePartContentId, pagePartMasterLanguageId);
   
    ContentVO metaInfoContentVO = ContentController.getContentController().getContentVOWithId(this.contentId);
    Integer originalMetaInfoMasterLanguageId = LanguageController.getController().getMasterLanguage(metaInfoContentVO.getRepositoryId()).getId();
    ContentVersionVO originalContentVersionVO = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(this.contentId, originalMetaInfoMasterLanguageId);
    logger.info("originalMetaInfoMasterLanguageId:" + originalMetaInfoMasterLanguageId);
    logger.info("contentId:" + contentId);
    logger.info("originalContentVersionVO:" + originalContentVersionVO);
   
      String componentStructure = ContentVersionController.getContentVersionController().getAttributeValue(originalContentVersionVO.getId(), "ComponentStructure", false);
      logger.info("componentStructure:" + componentStructure);
    if(componentId != null)
    {
      logger.info("We should strip all but componentId:" + componentId);
      Document document = XMLHelper.readDocumentFromByteArray(componentStructure.getBytes("UTF-8"));
      String componentXPath = "//component[@id=" + componentId + "]";

      Node node = org.apache.xpath.XPathAPI.selectSingleNode(document.getDocumentElement(), componentXPath);
      if(node != null)
      {
        Element component = (Element)node;
        component.setAttribute("pagePartTemplateContentId", "-1");
        component.setAttribute("isInherited", "true");
        /*
        NodeList propertiesNL = component.getElementsByTagName("properties");
        if(propertiesNL != null && propertiesNL.getLength() > 0)
        {
          Node propertiesNode = propertiesNL.item(0);
          addPropertyElement((Element)propertiesNode, "pagePartContentId", "" + pagePartContentId, "textfield", pagePartMasterLocale);
        }
        */
        String modifiedXML = XMLHelper.serializeDom(component, new StringBuffer()).toString();
        logger.info("modifiedXML:" + modifiedXML);
        componentStructure = "<?xml version='1.0' encoding='UTF-8'?><components>" + modifiedXML + "</components>";
      }
    }
     
    String versionValue = "<?xml version='1.0' encoding='UTF-8'?><article xmlns=\"x-schema:ArticleSchema.xml\"><attributes><Name><![CDATA[" + this.name + "]]></Name><GroupName><![CDATA[" + this.groupName + "]]></GroupName><ComponentStructure><![CDATA[" + componentStructure + "]]></ComponentStructure></attributes></article>";
 
    ContentVersionVO contentVersionVO = pagePartContentVersionVO;
    contentVersionVO.setVersionComment("Saved page template");
    contentVersionVO.setVersionModifier(this.getInfoGluePrincipal().getName());
    contentVersionVO.setVersionValue(versionValue);
    ContentVersionVO updateContentVersionVO = ContentVersionController.getContentVersionController().update(pagePartContentVO.getId(), pagePartMasterLanguageId, contentVersionVO, this.getInfoGluePrincipal());

    if(this.attemptDirectPublication)
    {
      List events = new ArrayList();

      ContentStateController.changeState(updateContentVersionVO.getId(), ContentVersionVO.PUBLISH_STATE, "Auto publish", false, null, this.getInfoGluePrincipal(), updateContentVersionVO.getContentId(), events);

        PublicationVO publicationVO = new PublicationVO();
        publicationVO.setName("Direct publication by " + this.getInfoGluePrincipal().getName());
        publicationVO.setDescription("Direct publication");
        publicationVO.setRepositoryId(pagePartContentVO.getRepositoryId());
View Full Code Here

  {
    String imageHref = null;
    try
    {
      LanguageVO masterLanguage = LanguageController.getController().getMasterLanguage(ContentController.getContentController().getContentVOWithId(contentId).getRepositoryId());
      ContentVersionVO contentVersionVO = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(contentId, masterLanguage.getId());
      List digitalAssets = DigitalAssetController.getDigitalAssetVOList(contentVersionVO.getId());
      Iterator i = digitalAssets.iterator();
      while(i.hasNext())
      {
        DigitalAssetVO digitalAssetVO = (DigitalAssetVO)i.next();
        if(digitalAssetVO.getAssetKey().equals(key))
View Full Code Here

      }
      */
      SiteNodeVO siteNodeVO = SiteNodeController.getController().getSiteNodeVOWithId(siteNodeId);
      if(siteNodeVO.getMetaInfoContentId() != null && siteNodeVO.getMetaInfoContentId().intValue() != -1)
      {
        ContentVersionVO contentVersionVO = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(siteNodeVO.getMetaInfoContentId(), languageId);
        if(contentVersionVO.getStateId().equals(ContentVersionVO.WORKING_STATE))
          isMetaInfoInWorkingState = true;
     
     
      logger.info("isMetaInfoInWorkingState:" + isMetaInfoInWorkingState);
      if(isMetaInfoInWorkingState)
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.