Package org.infoglue.cms.entities.structure

Examples of org.infoglue.cms.entities.structure.SiteNode


    oql.bind(limit);
     
      QueryResults results = oql.execute(Database.READONLY);
    while (results.hasMore())
        {
      SiteNode siteNode = (SiteNode)results.next();
      siteNodeList.add(siteNode);
        }
   
    results.close();
    oql.close();
View Full Code Here


 
      QueryResults results = oql.execute(Database.READONLY);
      //t.printElapsedTime("Executed query.....");
      if (results.hasMore())
      {
        SiteNode siteNode = (SiteNode)results.next();
        siteNodeVO = siteNode.getValueObject();     
 
        if(!skipCaching)
        {
          String siteNodeCacheKey = "" + siteNode.getValueObject().getId();
          CacheController.cacheObjectInAdvancedCache("siteNodeCache", siteNodeCacheKey, siteNode.getValueObject());
        }
      }
      else
        logger.warn("SiteNode not found: " + siteNodeId);
     
View Full Code Here

      oql.bind(entityId);

    QueryResults results = oql.execute(Database.READONLY);
    while (results.hasMore())
    {
      SiteNode siteNode = (SiteNode)results.next();
      SiteNodeVO siteNodeVO = siteNode.getValueObject();     
      siteNodeVOMap.put(siteNodeVO.getId(), siteNodeVO);
    }

    results.close();
    oql.close();
View Full Code Here

        return getSiteNodeWithId(siteNodeId, db, false);
    }
   
    public static SiteNode getSiteNodeWithId(Integer siteNodeId, Database db, boolean readOnly) throws SystemException, Bug
    {
        SiteNode siteNode = null;
        try
        {
      RequestAnalyser.getRequestAnalyser().incApproximateNumberOfDatabaseQueries();

      if(readOnly)
View Full Code Here

   * This method deletes a siteNode and also erases all the children and all versions.
   */
     
  public void delete(SiteNodeVO siteNodeVO, Database db, boolean forceDelete, InfoGluePrincipal infogluePrincipal) throws ConstraintException, SystemException, Exception
  {
    SiteNode siteNode = getSiteNodeWithId(siteNodeVO.getSiteNodeId(), db);
    SiteNode parent = siteNode.getParentSiteNode();
    if(parent != null)
    {
      Iterator childSiteNodeIterator = parent.getChildSiteNodes().iterator();
      while(childSiteNodeIterator.hasNext())
      {
          SiteNode candidate = (SiteNode)childSiteNodeIterator.next();
          if(candidate.getId().equals(siteNodeVO.getSiteNodeId()))
              deleteRecursive(siteNode, childSiteNodeIterator, db, forceDelete, infogluePrincipal);
      }
    }
    else
    {
View Full Code Here

        Collection children = siteNode.getChildSiteNodes();
    Iterator i = children.iterator();
    while(i.hasNext())
    {
      SiteNode childSiteNode = (SiteNode)i.next();
      deleteRecursive(childSiteNode, i, db, forceDelete, infoGluePrincipal);
       }
    siteNode.setChildSiteNodes(new ArrayList());
   
    if(forceDelete || getIsDeletable(siteNode, infoGluePrincipal, db))
View Full Code Here

  public SiteNodeVO create(Integer parentSiteNodeId, Integer siteNodeTypeDefinitionId, InfoGluePrincipal infoGluePrincipal, Integer repositoryId, SiteNodeVO siteNodeVO) throws ConstraintException, SystemException
  {
    Database db = CastorDatabaseService.getDatabase();
    ConstraintExceptionBuffer ceb = new ConstraintExceptionBuffer();

    SiteNode siteNode = null;

    beginTransaction(db);

    try
    {
      //Here you might want to add some validate functonality?
      siteNode = create(db, parentSiteNodeId, siteNodeTypeDefinitionId, infoGluePrincipal, repositoryId, siteNodeVO);
            
      //If any of the validations or setMethods reported an error, we throw them up now before create.
      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.getMessage());
      logger.warn("An error occurred so we should not complete the transaction: " + e.getMessage(), e);
      //rollbackTransaction(db);
      throw new SystemException(e.getMessage());
    }

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

    return siteNode.getValueObject();
  }    
   
    public SiteNode create(Database db, Integer parentSiteNodeId, Integer siteNodeTypeDefinitionId, InfoGluePrincipal infoGluePrincipal, Integer repositoryId, SiteNodeVO siteNodeVO) throws SystemException, Exception
    {
      SiteNode siteNode = null;

        logger.info("******************************************");
        logger.info("parentSiteNode:" + parentSiteNodeId);
        logger.info("siteNodeTypeDefinition:" + siteNodeTypeDefinitionId);
        logger.info("repository:" + repositoryId);
        logger.info("******************************************");
       
        //Fetch related entities here if they should be referenced       
       
        SiteNode parentSiteNode = null;
        SiteNodeTypeDefinition siteNodeTypeDefinition = null;

        if(parentSiteNodeId != null)
        {
           parentSiteNode = getSiteNodeWithId(parentSiteNodeId, db);
      if(repositoryId == null)
        repositoryId = parentSiteNode.getRepository().getRepositoryId()
        }   
               
        if(siteNodeTypeDefinitionId != null)
          siteNodeTypeDefinition = SiteNodeTypeDefinitionController.getController().getSiteNodeTypeDefinitionWithId(siteNodeTypeDefinitionId, db);

        Repository repository = RepositoryController.getController().getRepositoryWithId(repositoryId, db);

       
        siteNode = new SiteNodeImpl();
        siteNode.setValueObject(siteNodeVO);
        siteNode.setParentSiteNode((SiteNodeImpl)parentSiteNode);
        siteNode.setRepository((RepositoryImpl)repository);
        siteNode.setSiteNodeTypeDefinition((SiteNodeTypeDefinitionImpl)siteNodeTypeDefinition);
        siteNode.setCreator(infoGluePrincipal.getName());

        db.create(siteNode);
       
        if(parentSiteNode != null)
          parentSiteNode.getChildSiteNodes().add(siteNode);
       
        //No siteNode is an island (humhum) so we also have to create an siteNodeVersion for it.
        SiteNodeVersionController.createInitialSiteNodeVersion(db, siteNode, infoGluePrincipal);
       
        return siteNode;
View Full Code Here

   * @throws SystemException
   */
 
  public SiteNode createNewSiteNode(Database db, Integer parentSiteNodeId, Integer siteNodeTypeDefinitionId, InfoGluePrincipal infoGluePrincipal, Integer repositoryId, SiteNodeVO siteNodeVO) throws SystemException
  {
    SiteNode siteNode = null;

    try
    {
      logger.info("******************************************");
      logger.info("parentSiteNode:" + parentSiteNodeId);
      logger.info("siteNodeTypeDefinition:" + siteNodeTypeDefinitionId);
      logger.info("repository:" + repositoryId);
      logger.info("******************************************");
           
          //Fetch related entities here if they should be referenced       
     
      SiteNode parentSiteNode = null;
      SiteNodeTypeDefinition siteNodeTypeDefinition = null;

      if(parentSiteNodeId != null)
      {
        parentSiteNode = getSiteNodeWithId(parentSiteNodeId, db);
        if(repositoryId == null)
          repositoryId = parentSiteNode.getRepository().getRepositoryId()
      }   
     
      if(siteNodeTypeDefinitionId != null)
        siteNodeTypeDefinition = SiteNodeTypeDefinitionController.getController().getSiteNodeTypeDefinitionWithId(siteNodeTypeDefinitionId, db);
     
View Full Code Here

   
    QueryResults results = oql.execute(Database.READONLY);

    while (results.hasMore())
    {
      SiteNode siteNode = (SiteNode)results.next();
      //System.out.println("SiteNode:" + siteNode.getValueObject().getModifiedDateTime());
      childrenVOList.add(siteNode.getValueObject());
    }

    results.close();
    oql.close();
       
View Full Code Here

TOP

Related Classes of org.infoglue.cms.entities.structure.SiteNode

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.