Package org.infoglue.cms.entities.management

Examples of org.infoglue.cms.entities.management.Category


    logger.info("We want to create a list of categories if not existing under the parent category " + parentCategory);
    Iterator categoryIterator = categories.iterator();
    while(categoryIterator.hasNext())
    {
      CategoryVO categoryVO = (CategoryVO)categoryIterator.next();
      Category newParentCategory = null;
     
      List existingCategories = null;
      if(parentCategory != null)
        existingCategories = CategoryController.getController().findByParent(parentCategory.getCategoryId(), db);
      else
        existingCategories = CategoryController.getController().findRootCategories(db);
       
      Iterator existingCategoriesIterator = existingCategories.iterator();
      while(existingCategoriesIterator.hasNext())
      {
        Category existingCategory = (Category)existingCategoriesIterator.next();
        logger.info("existingCategory:" + existingCategory.getName());
        if(existingCategory.getName().equals(categoryVO.getName()))
        {
          logger.info("Existed... setting " + existingCategory.getName() + " to new parent category.");
          newParentCategory = existingCategory;
          break;
        }
      }

      if(newParentCategory == null)
      {
        logger.info("No existing category - we create it.");
        Integer oldId = categoryVO.getId();
        categoryVO.setCategoryId(null);
        if(parentCategory != null
          categoryVO.setParentId(parentCategory.getCategoryId());
        else
          categoryVO.setParentId(null);
         
        Category newCategory = CategoryController.getController().save(categoryVO, db);
        categoryIdMap.put(oldId, newCategory.getCategoryId());
        newParentCategory = newCategory;
      }
      else
      {
        categoryIdMap.put(categoryVO.getId(), newParentCategory.getCategoryId());
View Full Code Here


          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);
View Full Code Here

   * @return  The Category identified by the provided id
   * @throws  SystemException If an error happens
   */
  public Category findById(Integer id, Database db) throws SystemException
  {
    Category category = null;
   
    try
    {
      category = (Category)getObjectWithId(CategoryImpl.class, id, db);
    }
View Full Code Here

   */
  public String getCategoryPath(Integer categoryId, Database db) throws SystemException
  {
      StringBuffer path = new StringBuffer();
       
      Category category = findById(categoryId, db);
      if(category != null)
      {
        path.insert(0, "/" + category.getName());
        while(category.getParentId() != null)
        {
          category = findById(category.getParentId(), db);
            if(category != null)
          {
            path.insert(0, "/" + category.getName());
          }
        }
      }
     
      return path.toString();
View Full Code Here

   * @return  A list of CategoryVOs that are at the root of the category tree
   * @throws  SystemException If an error happens
   */
  public CategoryVO findWithChildren(Integer id, Database db) throws SystemException
  {
    Category c = findById(id, db);
    c.getValueObject().setChildren(findByParent(c.getId(), db));
    return c.getValueObject();
  }
View Full Code Here

        logger.info("Creating local version of:" + remoteCategoryVO + " under " + localParentCategory);
        remoteCategoryVO.setCategoryId(null);
        if(localParentCategory != null)
          remoteCategoryVO.setParentId(localParentCategory.getId());
       
        Category newLocalCategory = CategoryController.getController().save(remoteCategoryVO, db);
        handledRemoteCategoryPaths.put(remoteCategoryVO.getCategoryPath(), "true");

          List subCategories = remoteCategoryVO.getChildren();
          Iterator subCategoriesIterator = subCategories.iterator();
          while(subCategoriesIterator.hasNext())
          {
            CategoryVO subCategory = (CategoryVO)subCategoriesIterator.next();
            logger.info("subCategory:[" + subCategory + "]");
            handleSubCategories(newLocalCategory.getValueObject(), subCategory, handledRemoteCategoryPaths, request, db);
          }
      }
    }
    }
View Full Code Here

        if(parentCategory != null
          categoryVO.setParentId(parentCategory.getCategoryId());
        else
          categoryVO.setParentId(null);
         
        Category newCategory = CategoryController.getController().save(categoryVO, db);
        categoryIdMap.put(oldId, newCategory.getCategoryId());
        newParentCategory = newCategory.getValueObject();
      }
      else
      {
        categoryIdMap.put(categoryVO.getId(), newParentCategory.getCategoryId());
      }
View Full Code Here

            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);
View Full Code Here

TOP

Related Classes of org.infoglue.cms.entities.management.Category

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.