Package org.infoglue.cms.entities.content

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


    public void changeRepository(Integer contentId, Integer repositoryId) throws ConstraintException, SystemException
    {
        Database db = CastorDatabaseService.getDatabase();

        Content content = null;

        beginTransaction(db);

        try
        {
            content = (Content)getObjectWithId(ContentImpl.class, contentId, db);
            if(repositoryId != null)
              content.setRepository((RepositoryImpl)RepositoryController.getController().getRepositoryWithId(repositoryId, db));
           
            commitTransaction(db);
        }
        catch(Exception e)
        {
View Full Code Here


        beginTransaction(db);

        try
        {
      Content parent = (Content) getObjectWithId(ContentImpl.class, parentVO.getContentId(), db);
      Content child = (Content) getObjectWithId(ContentImpl.class, childVO.getContentId(), db);
      parent.getChildren().add(child);

            ceb.throwIfNotEmpty();           
            commitTransaction(db);
        }
View Full Code Here

        beginTransaction(db);

        try
        {
      Content parent = (Content) getObjectWithId(ContentImpl.class, parentVO.getContentId(), db);
      Content child = (Content) getObjectWithId(ContentImpl.class, childVO.getContentId(), db);
      parent.getChildren().remove(child);

            ceb.throwIfNotEmpty();           
            commitTransaction(db);
        }
View Full Code Here

        {
          logger.warn("You cannot have the content as it's own parent......");
          throw new ConstraintException("Content.parentContentId", "3301");
        }
   
    Content content          = getMediumContentWithId(contentVO.getContentId(), db);
        //oldParentContent = content.getParentContent();
        //newParentContent = getContentWithId(newParentContentId, db);
                   
        if(content.getValueObject().getParentContentId() == null || content.getValueObject().getParentContentId().intValue() == newParentContentId.intValue())
        {
          logger.warn("You cannot specify the same folder as it originally was located in......");
          throw new ConstraintException("Content.parentContentId", "3304");
        }

    //ContentVO tempContent = newParentContent.getParentContent();
    ContentVO newParentContentVO = getContentVOWithId(newParentContentId, db);
   
    Integer parentContentId = newParentContentVO.getParentContentId();
    while(parentContentId != null)
    {
      ContentVO tempContent = getContentVOWithId(parentContentId, db);
      if(tempContent.getId().intValue() == content.getId().intValue())
      {
        logger.warn("You cannot move the content to a child under it......");
            throw new ConstraintException("Content.parentContentId", "3302");
      }
      parentContentId = tempContent.getParentContentId();
    }                   
       
        //oldParentContent.getChildren().remove(content);
        //content.setParentContent((ContentImpl)newParentContent);
        content.getValueObject().setParentContentId(newParentContentId);
        changeRepositoryRecursive(content, newParentContentVO.getRepositoryId());
        //content.setRepository(newParentContent.getRepository());
        //newParentContent.getChildren().add(content);
       
        //If any of the validations or setMethods reported an error, we throw them up now before create.
View Full Code Here

      {
        content.getValueObject().setRepositoryId(newRepositoryId);
        Iterator childContentsIterator = content.getChildren().iterator();
        while(childContentsIterator.hasNext())
        {
            Content childContent = (Content)childContentsIterator.next();
            changeRepositoryRecursive(childContent, newRepositoryId);
        }
      }
  }
View Full Code Here

    oql.bind(limit);

    QueryResults results = oql.execute(Database.READONLY);
    while (results.hasMore())
    {
      Content content = (Content)results.next();
      childrenVOList.add(content.getValueObject());
     
      String key = "" + content.getValueObject().getId();
      CacheController.cacheObjectInAdvancedCache("contentCache", key, content.getValueObject(), new String[]{CacheController.getPooledString(1, content.getValueObject().getId())}, true);
    }
   
    results.close();
    oql.close();
      
View Full Code Here

      oql.bind(repositoryId);
     
          QueryResults results = oql.execute(Database.READONLY);     
      if (results.hasMore())
            {
        Content content = (Content)results.next();
        contentVO = content.getValueObject();
          }
            else
            {
        //None found - we create it and give it the name of the repository.
        logger.info("Found no rootContent so we create a new....");
        ContentVO rootContentVO = new ContentVO();
        RepositoryVO repositoryVO = RepositoryController.getController().getRepositoryVOWithId(repositoryId);
        rootContentVO.setCreatorName(userName);
        rootContentVO.setName(repositoryVO.getName());
        rootContentVO.setIsBranch(new Boolean(true));
              Content content = create(db, null, null, repositoryId, rootContentVO);
              contentVO = content.getValueObject();
            }
           
      results.close();
      oql.close();
View Full Code Here

   * If there is no such content we create one as all repositories need one to work.
   */
         
  public Content getRootContent(Database db, Integer repositoryId, String userName, boolean createIfNonExisting) throws ConstraintException, SystemException, Exception
  {
    Content content = null;

    logger.info("Fetching the root content for the repository " + repositoryId);
    OQLQuery oql = db.getOQLQuery( "SELECT c FROM org.infoglue.cms.entities.content.impl.simple.ContentImpl c WHERE is_undefined(c.parentContent) AND c.repository.repositoryId = $1");
    oql.bind(repositoryId);
     
View Full Code Here

   * If there is no such content we create one as all repositories need one to work.
   */
         
  public Content getRootContent(Integer repositoryId, Database db) throws ConstraintException, SystemException, Exception
  {
    Content content = null;

    OQLQuery oql = db.getOQLQuery( "SELECT c FROM org.infoglue.cms.entities.content.impl.simple.ContentImpl c WHERE is_undefined(c.parentContent) AND c.repository.repositoryId = $1");
    oql.bind(repositoryId);
     
    QueryResults results = oql.execute();   
View Full Code Here

    }

    QueryResults results = oql.execute(Database.READONLY);
    while (results.hasMore())
    {
      Content content = (Content)results.next();
      childrenVOList.add(content.getValueObject());
    }
   
    if(childrenVOList != null)
      CacheController.cacheObjectInAdvancedCache("childContentCache", key, childrenVOList, new String[]{CacheController.getPooledString(1, parentContentId)}, true);
View Full Code Here

TOP

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

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.