Package org.infoglue.cms.entities.content.impl.simple

Examples of org.infoglue.cms.entities.content.impl.simple.ExportContentVersionImpl


    if(contentVersions != null)
    {
      Iterator contentVersionsIterator = contentVersions.iterator();
      while(contentVersionsIterator.hasNext())
      {
        ExportContentVersionImpl contentVersion = (ExportContentVersionImpl)contentVersionsIterator.next();
        Integer languageId = contentVersion.getLanguageId();
        Language oldLanguage = languages.get(languageId);
        if(oldLanguage == null)
        {
          logger.warn("A null language.... strange... setting master language");
          LanguageVO oldLanguageVO = LanguageController.getController().getMasterLanguage(content.getRepositoryId(), db);
          oldLanguage = LanguageController.getController().getLanguageWithId(oldLanguageVO.getId(), db);
        }
       
        Language language = LanguageController.getController().getLanguageWithCode(oldLanguage.getLanguageCode(), db);
        logger.info("Creating contentVersion for language:" + oldLanguage + " on content " + content.getName());
 
        ContentVersion cv = new ContentVersionImpl();
        cv.setValueObject(contentVersion.getValueObject());
       
        cv.setOwningContent((ContentImpl)content);
        cv.setLanguage((LanguageImpl)language);
       
        db.create(cv);

        List<SmallDigitalAssetImpl> smallDigitalAssets = (List)contentVersion.getSmallDigitalAssets();
        //logger.info("AAAAAAAAAAAAA: on " + content.getName() + "/" + contentVersion.getId() + " was " + (smallDigitalAssets == null ? "null" : smallDigitalAssets.size()) + " assets");
        if(smallDigitalAssets != null)
        {
          List initialDigitalAssets = new ArrayList();
           
          for(SmallDigitalAssetImpl asset : smallDigitalAssets)
          {
            if(!handledSmallAssets.containsKey(asset.getId()))
            {
              allSmallAssets.add(asset);
              handledSmallAssets.put(asset.getId(), true);
            }

            List<Integer> versionIdsUsingAsset = assetVersionsMap.get(asset.getId());
            if(versionIdsUsingAsset == null)
            {
              versionIdsUsingAsset = new ArrayList<Integer>();
              assetVersionsMap.put(asset.getId(), versionIdsUsingAsset);
            }
            versionIdsUsingAsset.add(cv.getId());
          }
        }
 
        Collection contentCategories = contentVersion.getContentCategories();
        logger.info("contentCategories:" + contentCategories.size());
       
        if(contentCategories != null)
        {
          List initialContentCategories = new ArrayList();
           
          Iterator contentCategoriesIterator = contentCategories.iterator();
          while(contentCategoriesIterator.hasNext())
          {
            ContentCategory contentCategory = (ContentCategory)contentCategoriesIterator.next();
            logger.info("contentCategory:" + contentCategory);
            contentCategory.setContentVersion((ContentVersionImpl)cv);
           
            Integer oldCategoryId = contentCategory.getCategoryId();
            logger.info("oldCategoryId:" + oldCategoryId);
            if(!isCopyAction)
            {
              Integer newCategoryId = (Integer)categoryIdMap.get(oldCategoryId);
              logger.info("newCategoryId:" + newCategoryId);
              if(newCategoryId == null)
                newCategoryId = oldCategoryId;
             
              if(newCategoryId != null)
              {
                Category category = CategoryController.getController().findById(newCategoryId, db);
                logger.info("Got category:" + category);
                if(category != null)
                {
                  contentCategory.setCategory((CategoryImpl)category);
                  logger.info("Creating content category:" + contentCategory);
                 
                  db.create(contentCategory);
               
                  initialContentCategories.add(contentCategory);
                }
              }
            }
            else
            {
              Category category = CategoryController.getController().findById(oldCategoryId, db);
              logger.info("Got category:" + category);
              if(category != null)
              {
                contentCategory.setCategory((CategoryImpl)category);
                logger.info("Creating content category:" + contentCategory);
               
                db.create(contentCategory);
             
                initialContentCategories.add(contentCategory);
              }
            }
          }
         
          contentVersion.setContentCategories(initialContentCategories);
        }
   
      }   
    }
   
View Full Code Here


    oql.bind(limit);
     
      QueryResults results = oql.execute(Database.READONLY);
    while (results.hasMore())
        {
      ExportContentVersionImpl contentVersion = (ExportContentVersionImpl)results.next();
      contentVersionList.add(contentVersion);
        }
   
    results.close();
    oql.close();
View Full Code Here

TOP

Related Classes of org.infoglue.cms.entities.content.impl.simple.ExportContentVersionImpl

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.