Package org.infoglue.cms.entities.management

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


        if(parentCategoryVO != null
          categoryVO.setParentId(parentCategoryVO.getCategoryId());
        else
          categoryVO.setParentId(null);
         
        Category newCategory = CategoryController.getController().save(categoryVO, db);
        categoryIdMap.put(oldId, newCategory.getCategoryId());
        newParentCategoryVO = newCategory.getValueObject();
      }
      else
      {
        categoryIdMap.put(categoryVO.getId(), newParentCategoryVO.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

  public ContentCategory createWithDatabase(ContentCategoryVO c, Database db) throws SystemException, PersistenceException
  {
    // Need this crappy hack to forge the relationship (castor completely sucks like this)
    // 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;
      }
    }
   
    if(!exists)
    {
      logger.info("Creating the category " + category.getName() + " as it was not set on this version");
 
      contentCategory = new MediumContentCategoryImpl();
      contentCategory.setValueObject(c);
      contentCategory.setCategory((CategoryImpl)category);
      contentCategory.setContentVersion((MediumContentVersionImpl)contentVersion);
      db.create(contentCategory);
      contentVersion.getContentCategories().add(contentCategory);
    }
    else
    {
      logger.info("Skipping the category " + category.getName() + " as it was allready set on this version");
    }
   
    return contentCategory;
  }
View Full Code Here

    {
      Iterator categoryVOListIterator = categoryVOList.iterator();
      while(categoryVOListIterator.hasNext())
      {
          CategoryVO categoryVO = (CategoryVO)categoryVOListIterator.next();
        Category category = (Category)getObjectWithId(CategoryImpl.class, categoryVO.getId(), db);
        ContentVersion contentVersion = (ContentVersion)getObjectWithId(ContentVersionImpl.class, contentVersionVO.getId(), db);
       
        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");
        }
      }
       
      commitTransaction(db);
    }
View Full Code Here

    List contentCategoryList = new ArrayList();

    Iterator categoryListIterator = categoryList.iterator();
    while(categoryListIterator.hasNext())
    {
        Category category = (Category)categoryListIterator.next();
       
      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
      {
        logger.info("Skipping the category " + category.getName() + " as it was allready set on this version");
      }
    }
   
    return contentCategoryList;
  }
View Full Code Here

    List contentCategoryList = new ArrayList();

    Iterator categoryListIterator = categoryList.iterator();
    while(categoryListIterator.hasNext())
    {
        Category category = (Category)categoryListIterator.next();
       
      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
      {
        logger.info("Skipping the category " + category.getName() + " as it was allready set on this version");
      }
    }
   
    return contentCategoryList;
  }
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

        OQLQuery oql1 = db.getOQLQuery("SELECT c FROM org.infoglue.cms.entities.management.impl.simple.CategoryImpl c ORDER BY c.categoryId");

        QueryResults results1 = oql1.execute(Database.READONLY);
        while (results1.hasMore())
        {
          Category category = (Category)results1.next();
          categoriesMap.put(category.getId(), category.getValueObject());
        }

        results1.close();
        oql1.close();
        logger.warn("Categories took: " + t.getElapsedTime());
View Full Code Here

  public PropertiesCategory createWithDatabase(PropertiesCategoryVO c, Database db) throws SystemException, PersistenceException
  {
    // Need this crappy hack to forge the relationship (castor completely sucks like this)
    // 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);

    PropertiesCategory propertiesCategory = new PropertiesCategoryImpl();
    propertiesCategory.setValueObject(c);
    propertiesCategory.setCategory((CategoryImpl)category);
    db.create(propertiesCategory);
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.