Package org.infoglue.cms.entities.content

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


        List initialContentCategories = new ArrayList();
         
        Iterator contentCategoriesIterator = contentCategories.iterator();
        while(contentCategoriesIterator.hasNext())
        {
          ContentCategory contentCategory = (ContentCategory)contentCategoriesIterator.next();
          logger.info("contentCategory:" + contentCategory);
          contentCategory.setContentVersion((ContentVersionImpl)contentVersion);
         
          Integer oldCategoryId = contentCategory.getCategoryId();
          logger.info("oldCategoryId:" + oldCategoryId);
          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);
View Full Code Here


    if(contentCategories != null)
    {
        Iterator contentCategoriesIterator = contentCategories.iterator();
        while(contentCategoriesIterator.hasNext())
        {
            ContentCategory contentCategory = (ContentCategory)contentCategoriesIterator.next();
            if(contentCategory.getAttributeName().equals(attribute))
            {
                contentCategoryList.add(contentCategory);
            }
        }
    }
View Full Code Here

      if(contentCategories != null)
      {
          Iterator contentCategoriesIterator = contentCategories.iterator();
          while(contentCategoriesIterator.hasNext())
          {
              ContentCategory contentCategory = (ContentCategory)contentCategoriesIterator.next();
              if(contentCategory.getAttributeName().equals(attribute))
              {
                  contentCategoryList.add(contentCategory);
              }
          }
      }
View Full Code Here

  {
    Database db = beginTransaction();

    try
    {
      ContentCategory contentCategory = createWithDatabase(c, db);
      commitTransaction(db);
      return contentCategory.getValueObject();
    }
    catch (Exception e)
    {
      rollbackTransaction(db);
      throw new SystemException(e.getMessage());
View Full Code Here

    // TODO: When hibernate comes, just save the VOs and if it has a child VO with an id set
    // TODO: it is used to make the relationship...ask me for clarification -frank
    Category category = (Category)getObjectWithId(CategoryImpl.class, c.getCategory().getId(), db);
    //ContentVersion contentVersion = (ContentVersion)getObjectWithId(ContentVersionImpl.class, c.getContentVersionId(), db);
    ContentVersion contentVersion = ContentVersionController.getContentVersionController().getMediumContentVersionWithId(c.getContentVersionId(), db);
    ContentCategory contentCategory = null;
   
    List existingContentCategories = ContentCategoryController.getController().findByContentVersionAttribute(c.getAttributeName(), contentVersion.getContentVersionId(), db);
    boolean exists = false;
    Iterator existingContentCategoriesIterator = existingContentCategories.iterator();
    while(existingContentCategoriesIterator.hasNext())
    {
      ContentCategory contentCategoryCandidate = (ContentCategory)existingContentCategoriesIterator.next();
      if(contentCategoryCandidate.getCategoryId().equals(category.getId()))
      {
        exists = true;
        contentCategory = contentCategoryCandidate;
        logger.info("The category " + category.getName() + " was allready set on this version");
        break;
View Full Code Here

        List existingContentCategories = ContentCategoryController.getController().findByContentVersionAttribute(attributeName, contentVersion.getContentVersionId(), db, true);
        boolean exists = false;
        Iterator existingContentCategoriesIterator = existingContentCategories.iterator();
        while(existingContentCategoriesIterator.hasNext())
        {
          ContentCategory contentCategory = (ContentCategory)existingContentCategoriesIterator.next();
          if(contentCategory.getCategoryId().equals(category.getId()))
          {
            exists = true;
            logger.info("The category " + category.getName() + " was allready set on this version");
            break;
          }
        }
       
        if(!exists)
        {
          logger.info("Creating the category " + category.getName() + " as it was not set on this version");

            ContentCategoryVO contentCategoryVO = new ContentCategoryVO();
            contentCategoryVO.setAttributeName(attributeName);
            contentCategoryVO.setContentVersionId(contentVersionVO.getId());
            ContentCategory contentCategory = createWithDatabase(contentCategoryVO, category, contentVersion, db);
               
            contentCategoryVOList.add(contentCategory.getValueObject());
        }
        else
        {
          logger.info("Skipping the category " + category.getName() + " as it was allready set on this version");
        }
View Full Code Here

      List existingContentCategories = ContentCategoryController.getController().findByContentVersionAttribute(attributeName, contentVersion.getContentVersionId(), db, true);
      boolean exists = false;
      Iterator existingContentCategoriesIterator = existingContentCategories.iterator();
      while(existingContentCategoriesIterator.hasNext())
      {
        ContentCategory contentCategory = (ContentCategory)existingContentCategoriesIterator.next();
        if(contentCategory.getCategoryId().equals(category.getId()))
        {
          exists = true;
          logger.info("The category " + category.getName() + " was allready set on this version");
          break;
        }
      }
     
      if(!exists)
      {
        logger.info("Creating the category " + category.getName() + " as it was not set on this version");

        ContentCategoryVO contentCategoryVO = new ContentCategoryVO();
          contentCategoryVO.setAttributeName(attributeName);
          contentCategoryVO.setContentVersionId(contentVersion.getId());
          ContentCategory contentCategory = createWithDatabase(contentCategoryVO, category, contentVersion, db);
        contentVersion.getContentCategories().add(contentCategory);
           
        contentCategoryList.add(contentCategory);
      }
      else
View Full Code Here

      List existingContentCategories = ContentCategoryController.getController().findByContentVersionAttribute(attributeName, contentVersion.getContentVersionId(), db);
      boolean exists = false;
      Iterator existingContentCategoriesIterator = existingContentCategories.iterator();
      while(existingContentCategoriesIterator.hasNext())
      {
        ContentCategory contentCategory = (ContentCategory)existingContentCategoriesIterator.next();
        if(contentCategory.getCategoryId().equals(category.getId()))
        {
          exists = true;
          logger.info("The category " + category.getName() + " was allready set on this version");
          break;
        }
      }
     
      if(!exists)
      {
        logger.info("Creating the category " + category.getName() + " as it was not set on this version");

        ContentCategoryVO contentCategoryVO = new ContentCategoryVO();
          contentCategoryVO.setAttributeName(attributeName);
          contentCategoryVO.setContentVersionId(contentVersion.getId());
          ContentCategory contentCategory = createMediumWithDatabase(contentCategoryVO, category, contentVersion, db);
        contentVersion.getContentCategories().add(contentCategory);
           
        contentCategoryList.add(contentCategory);
      }
      else
View Full Code Here

    return contentCategoryList;
  }

  public ContentCategory createWithDatabase(ContentCategoryVO c, Category category, ContentVersion contentVersion, Database db) throws SystemException, PersistenceException
  {
    ContentCategory contentCategory = new ContentCategoryImpl();
    contentCategory.setValueObject(c);
    contentCategory.setCategory((CategoryImpl)category);
    contentCategory.setContentVersion((ContentVersionImpl)contentVersion);
    db.create(contentCategory);
    return contentCategory;
  }
View Full Code Here

    return contentCategory;
  }

  public ContentCategory createMediumWithDatabase(ContentCategoryVO c, Category category, ContentVersion contentVersion, Database db) throws SystemException, PersistenceException
  {
    ContentCategory contentCategory = new MediumContentCategoryImpl();
    contentCategory.setValueObject(c);
    contentCategory.setCategory((CategoryImpl)category);
    contentCategory.setContentVersion((MediumContentVersionImpl)contentVersion);
    db.create(contentCategory);
    return contentCategory;
  }
View Full Code Here

TOP

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

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.