Package org.infoglue.cms.entities.management

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


  private void updateContentTypeDefinitions(Collection contentTypeDefinitions, Map categoryIdMap)
  {
    Iterator contentTypeDefinitionsIterator = contentTypeDefinitions.iterator();
    while(contentTypeDefinitionsIterator.hasNext())
    {
      ContentTypeDefinition contentTypeDefinition = (ContentTypeDefinition)contentTypeDefinitionsIterator.next();
      String schema = contentTypeDefinition.getSchemaValue();
      Iterator categoryIdMapIterator = categoryIdMap.keySet().iterator();
      while(categoryIdMapIterator.hasNext())
      {
        Integer oldId = (Integer)categoryIdMapIterator.next();
        Integer newId = (Integer)categoryIdMap.get(oldId);
        schema = schema.replaceAll("<categoryId>" + oldId + "</categoryId>", "<categoryId>new_" + newId + "</categoryId>");
      }
      schema = schema.replaceAll("<categoryId>new_", "<categoryId>");
      contentTypeDefinition.setSchemaValue(schema);
    }
  }
View Full Code Here


      }

        QueryResults results = oql.execute();
      while(results.hasMore())
      {
        ContentTypeDefinition contentTypeDefinition = (ContentTypeDefinition)results.next();
        contentTypeDefinitions.add(contentTypeDefinition.getValueObject());
      }
     
      results.close();
      oql.close();
    }
View Full Code Here

   * @throws Bug
   */

  public ContentTypeDefinition getContentTypeDefinitionWithName(String name, Database db) throws SystemException, Bug
  {
    ContentTypeDefinition contentTypeDefinition = null;

    try
    {
      OQLQuery oql = db.getOQLQuery("SELECT f FROM org.infoglue.cms.entities.management.impl.simple.ContentTypeDefinitionImpl f WHERE f.name = $1");
      oql.bind(name);
View Full Code Here

        oql.bind(name);
 
        QueryResults results = oql.execute(Database.READONLY);
        if (results.hasMore())
        {
            ContentTypeDefinition contentTypeDefinition = (ContentTypeDefinition)results.next();
            contentTypeDefinitionVO = contentTypeDefinition.getValueObject();
        }

        if(contentTypeDefinitionVO != null)
            CacheController.cacheObject("contentTypeDefinitionCache", key, contentTypeDefinitionVO);
        else
View Full Code Here

      oql.bind(type);

      QueryResults results = oql.execute(Database.READONLY);
      while (results.hasMore())
      {
        ContentTypeDefinition contentTypeDefinition = (ContentTypeDefinition)results.next();
        contentTypeDefinitionVOList.add(contentTypeDefinition.getValueObject());
      }
     
      results.close();
      oql.close();
    }
View Full Code Here

      {
        return create(contentTypeDefinitionVO.getParentId(), contentTypeDefinitionVO);
      }
      else
      {
          ContentTypeDefinition contentTypeDefinition = new ContentTypeDefinitionImpl();
          contentTypeDefinition.setValueObject(contentTypeDefinitionVO);
          contentTypeDefinition = (ContentTypeDefinition) createEntity(contentTypeDefinition);
          return contentTypeDefinition.getValueObject();
      }
    }
View Full Code Here

    public ContentTypeDefinitionVO create(Integer parentContentTypeDefinitionId, ContentTypeDefinitionVO contentTypeDefinitionVO) throws ConstraintException, SystemException
    {
        Database db = CastorDatabaseService.getDatabase();
        ConstraintExceptionBuffer ceb = new ConstraintExceptionBuffer();

        ContentTypeDefinition contentTypeDefinition = null;

        beginTransaction(db);

        try
        {
          contentTypeDefinition = create(db, parentContentTypeDefinitionId, contentTypeDefinitionVO);
            ceb.throwIfNotEmpty();
           
            commitTransaction(db)
        }
        catch(ConstraintException ce)
        {
            logger.warn("An error occurred so we should not complete the transaction:" + ce, ce);
            rollbackTransaction(db);
            throw ce;
        }
        catch(Exception e)
        {
            logger.error("An error occurred so we should not complete the transaction:" + e, e);
            rollbackTransaction(db);
            throw new SystemException(e.getMessage());
        }

        return contentTypeDefinition.getValueObject();
    }
View Full Code Here

        return contentTypeDefinition.getValueObject();
    }

    public ContentTypeDefinition create(Database db, Integer parentContentTypeDefinitionId, ContentTypeDefinitionVO contentTypeDefinitionVO) throws ConstraintException, SystemException, Exception
    {
      ContentTypeDefinition contentTypeDefinition = null;
   
        try
        {           
          ContentTypeDefinition parent = null;

          if(parentContentTypeDefinitionId != null)
            {
            parent = getContentTypeDefinitionWithId(parentContentTypeDefinitionId, db);
            }
           
          contentTypeDefinition = new ContentTypeDefinitionImpl();
          contentTypeDefinition.setValueObject(contentTypeDefinitionVO);
          contentTypeDefinition.setParent((ContentTypeDefinitionImpl)parent);
               
      db.create(contentTypeDefinition);
       
      //Now we add the content to the knowledge of the related entities.
      if(parent != null)
      {
        parent.getChildren().add(contentTypeDefinition);
      }
        }
        catch(Exception e)
        {
            throw new SystemException(e.getMessage());   
View Full Code Here

    public ContentTypeDefinitionVO update(Integer parentContentTypeDefinitionId, ContentTypeDefinitionVO contentTypeDefinitionVO) throws ConstraintException, SystemException
    {
        Database db = CastorDatabaseService.getDatabase();

        ContentTypeDefinition contentTypeDefinition = null;

        beginTransaction(db);

        try
        {
          contentTypeDefinition = (ContentTypeDefinition)getObjectWithId(ContentTypeDefinitionImpl.class, contentTypeDefinitionVO.getId(), db);
          contentTypeDefinition.setVO(contentTypeDefinitionVO);
           
          //Remove from old children collection
          if(contentTypeDefinition.getParent() != null)
          {
            contentTypeDefinition.getParent().getChildren().remove(contentTypeDefinition);
          }
         
            if(parentContentTypeDefinitionId != null && parentContentTypeDefinitionId != -1)
            {
                ContentTypeDefinition parentContentTypeDefinition = ContentTypeDefinitionController.getController().getContentTypeDefinitionWithId(parentContentTypeDefinitionId, db);
                contentTypeDefinition.setParent((ContentTypeDefinitionImpl)parentContentTypeDefinition);
                parentContentTypeDefinition.getChildren().add(contentTypeDefinition);
            }
            else
            {
               contentTypeDefinition.setParent(null);
            }
View Full Code Here

  private void updateContentTypeDefinitions(Collection contentTypeDefinitions, Map categoryIdMap)
  {
    Iterator contentTypeDefinitionsIterator = contentTypeDefinitions.iterator();
    while(contentTypeDefinitionsIterator.hasNext())
    {
      ContentTypeDefinition contentTypeDefinition = (ContentTypeDefinition)contentTypeDefinitionsIterator.next();
      String schema = contentTypeDefinition.getSchemaValue();
      Iterator categoryIdMapIterator = categoryIdMap.keySet().iterator();
      while(categoryIdMapIterator.hasNext())
      {
        Integer oldId = (Integer)categoryIdMapIterator.next();
        Integer newId = (Integer)categoryIdMap.get(oldId);
        schema = schema.replaceAll("<categoryId>" + oldId + "</categoryId>", "<categoryId>new_" + newId + "</categoryId>");
      }
      schema = schema.replaceAll("<categoryId>new_", "<categoryId>");
      contentTypeDefinition.setSchemaValue(schema);
    }
  }
View Full Code Here

TOP

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

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.