Package org.infoglue.cms.entities.structure

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


  public String getSiteNodeIdPath(Integer siteNodeId) throws Exception
  {
    StringBuffer sb = new StringBuffer();
   
    SiteNodeVO siteNodeVO = getSiteNodeVOWithId(siteNodeId);
    sb.insert(0, siteNodeVO.getId());
    while(siteNodeVO != null && siteNodeVO.getParentSiteNodeId() != null)
    {
      sb.insert(0, siteNodeVO.getParentSiteNodeId() + ",");
      if(siteNodeVO.getParentSiteNodeId() != null)
        siteNodeVO = getSiteNodeVOWithId(siteNodeVO.getParentSiteNodeId());
      else
        siteNodeVO = null;
    }
     
    return sb.toString();
View Full Code Here


        return path;
    }
   
  public String getSiteNodePath(Integer siteNodeId, boolean includeRootSiteNode, boolean includeRepositoryName, Database db) throws Exception
  {
    SiteNodeVO siteNodeVO = getSiteNodeVOWithId(siteNodeId, db);
    if (siteNodeVO != null)
    {
      return getSiteNodePath(siteNodeVO, includeRootSiteNode, includeRepositoryName, db);
    }
    else
View Full Code Here

   public void delete(MediumSiteNodeVersionImpl siteNodeVersion, Database db, boolean forceDelete) throws ConstraintException, SystemException, Exception
  {
    if (!forceDelete && siteNodeVersion.getStateId().intValue() == ContentVersionVO.PUBLISHED_STATE.intValue() && siteNodeVersion.getIsActive().booleanValue() == true)
    {
      SiteNodeVO snVO = getSiteNodeVOWithId(siteNodeVersion.getSiteNodeId(), db);
      throw new ConstraintException("SiteNodeVersion.stateId", "3300", snVO.getName());
    }
   
    Collection serviceBindnings = siteNodeVersion.getServiceBindings();
    Iterator serviceBindningsIterator = serviceBindnings.iterator();
    while(serviceBindningsIterator.hasNext())
View Full Code Here

              logger.warn("You cannot have the siteNode as it's own parent......");
              throw new ConstraintException("SiteNode.parentSiteNodeId", "3401");
            }
            */

            SiteNodeVO siteNode = getSiteNodeVOWithId(siteNodeVO.getSiteNodeId(), db);
            SiteNodeVO oldParentSiteNode = getSiteNodeVOWithId(siteNodeVO.getParentSiteNodeId(), db); //siteNode.getParentSiteNode();
            SiteNodeVO newParentSiteNode = getSiteNodeVOWithId(newParentSiteNodeId, db);

            SiteNodeVO tempSiteNode = getSiteNodeVOWithId(newParentSiteNode.getParentSiteNodeId(), db); //siteNode.getParentSiteNode();
            //SiteNode tempSiteNode = newParentSiteNode.getParentSiteNode();
      while(tempSiteNode != null)
      {
        if(tempSiteNode.getId().intValue() == siteNode.getId().intValue())
        {
          logger.warn("You cannot move the node to a child under it......");
                throw new ConstraintException("SiteNode.parentSiteNodeId", "3402");
        }
        tempSiteNode = getSiteNodeVOWithId(tempSiteNode.getParentSiteNodeId(), db); //siteNode.getParentSiteNode();
        //tempSiteNode = tempSiteNode.getParentSiteNode();
     
     
      processBean.updateProcess("Checked for constraints");
     
View Full Code Here

    {
      logger.warn("Returning as this sitenode has allready been copied... no recusion please");
      return;
    }
   
    SiteNodeVO oldSiteNodeVO = SiteNodeController.getController().getSiteNodeVOWithId(siteNode.getId(), db);
        ContentVO oldMetaInfoContentVO = ContentController.getContentController().getContentVOWithId(oldSiteNodeVO.getMetaInfoContentId(), db);

        LanguageVO masterLanguage = LanguageController.getController().getMasterLanguage(siteNode.getRepositoryId(), db);
        ContentVersionVO oldCVVO = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(oldMetaInfoContentVO.getId(), masterLanguage.getId(), db);
        RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getLatestActiveContentVersionVO", t.getElapsedTime());

    SiteNodeVO newSiteNodeVO = new SiteNodeVO();
    newSiteNodeVO.setName(oldSiteNodeVO.getName() + newNameSuffix);
    newSiteNodeVO.setIsBranch(oldSiteNodeVO.getIsBranch());
        newSiteNodeVO.setCreatorName(oldSiteNodeVO.getCreatorName());
        newSiteNodeVO.setExpireDateTime(oldSiteNodeVO.getExpireDateTime());
        newSiteNodeVO.setIsProtected(oldSiteNodeVO.getIsProtected());
        newSiteNodeVO.setPublishDateTime(oldSiteNodeVO.getPublishDateTime());
        newSiteNodeVO.setStateId(oldSiteNodeVO.getStateId());
   
        SiteNodeVO newSiteNode = SiteNodeControllerProxy.getSiteNodeControllerProxy().acCreate(principal, newParentSiteNode.getId(), siteNode.getSiteNodeTypeDefinitionId(), newParentSiteNode.getRepositoryId(), newSiteNodeVO, db).getValueObject();
       
        RequestAnalyser.getRequestAnalyser().registerComponentStatistics("acCreate", t.getElapsedTime());
       
        SiteNodeVersionVO siteNodeVersionVO = SiteNodeVersionController.getController().getLatestActiveSiteNodeVersionVO(db, oldSiteNodeVO.getId());
        RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getLatestActiveSiteNodeVersionVO", t.getElapsedTime());
    if(siteNodeVersionVO != null)
    {
      Integer oldSiteNodeVersionId = siteNodeVersionVO.getId();
     
      SiteNodeVersionVO newSiteNodeVersionVO = new SiteNodeVersionVO();
      newSiteNodeVersionVO.setContentType(siteNodeVersionVO.getContentType());
      newSiteNodeVersionVO.setPageCacheKey(siteNodeVersionVO.getPageCacheKey());
      newSiteNodeVersionVO.setPageCacheTimeout(siteNodeVersionVO.getPageCacheTimeout());
      newSiteNodeVersionVO.setDisableEditOnSight(siteNodeVersionVO.getDisableEditOnSight());
      newSiteNodeVersionVO.setDisableLanguages(siteNodeVersionVO.getDisableLanguages());
      newSiteNodeVersionVO.setDisablePageCache(siteNodeVersionVO.getDisablePageCache());
      newSiteNodeVersionVO.setDisableForceIdentityCheck(siteNodeVersionVO.getDisableForceIdentityCheck());
      newSiteNodeVersionVO.setForceProtocolChange(siteNodeVersionVO.getForceProtocolChange());
      newSiteNodeVersionVO.setIsProtected(siteNodeVersionVO.getIsProtected());
      newSiteNodeVersionVO.setVersionModifier(principal.getName());
      newSiteNodeVersionVO.setStateId(0);
      newSiteNodeVersionVO.setIsActive(true);
      newSiteNodeVersionVO.setModifiedDateTime(siteNodeVersionVO.getModifiedDateTime());
     
      SiteNodeVersionVO siteNodeVersion = SiteNodeVersionController.getController().createSmall(newSiteNode.getId(), principal, newSiteNodeVersionVO, db).getValueObject();
          RequestAnalyser.getRequestAnalyser().registerComponentStatistics("createSmall", t.getElapsedTime());
     
          Map args = new HashMap();
        args.put("globalKey", "infoglue");
        PropertySet ps = PropertySetManager.getInstance("jdbc", args);

        String disabledLanguagesString = ps.getString("siteNode_" + oldSiteNodeVO.getId() + "_disabledLanguages");
        String enabledLanguagesString = ps.getString("siteNode_" + oldSiteNodeVO.getId() + "_enabledLanguages");
        logger.info("disabledLanguagesString:" + disabledLanguagesString);
        logger.info("enabledLanguagesString:" + enabledLanguagesString);
       
        if(disabledLanguagesString != null && !disabledLanguagesString.equals(""))
          ps.setString("siteNode_" + newSiteNode.getId() + "_disabledLanguages", disabledLanguagesString);
        if(enabledLanguagesString != null && !enabledLanguagesString.equals(""))
          ps.setString("siteNode_" + newSiteNode.getId() + "_enabledLanguages", enabledLanguagesString);

        RequestAnalyser.getRequestAnalyser().registerComponentStatistics("ps", t.getElapsedTime());

        //Copy all access rights...
        SiteNodeStateController.getController().copyAccessRights("SiteNodeVersion", oldSiteNodeVersionId, siteNodeVersion.getId(), db);
        RequestAnalyser.getRequestAnalyser().registerComponentStatistics("copyAccessRights", t.getElapsedTime());
        /*
        copyAccessRights(db, oldSiteNodeVersionId.toString(), siteNodeVersion.getId().toString(), "SiteNodeVersion.Read");
        copyAccessRights(db, oldSiteNodeVersionId.toString(), siteNodeVersion.getId().toString(), "SiteNodeVersion.Write");
        copyAccessRights(db, oldSiteNodeVersionId.toString(), siteNodeVersion.getId().toString(), "SiteNodeVersion.CreateSiteNode");
        copyAccessRights(db, oldSiteNodeVersionId.toString(), siteNodeVersion.getId().toString(), "SiteNodeVersion.DeleteSiteNode");
        copyAccessRights(db, oldSiteNodeVersionId.toString(), siteNodeVersion.getId().toString(), "SiteNodeVersion.MoveSiteNode");
        copyAccessRights(db, oldSiteNodeVersionId.toString(), siteNodeVersion.getId().toString(), "SiteNodeVersion.SubmitToPublish");
        copyAccessRights(db, oldSiteNodeVersionId.toString(), siteNodeVersion.getId().toString(), "SiteNodeVersion.ChangeAccessRights");
        copyAccessRights(db, oldSiteNodeVersionId.toString(), siteNodeVersion.getId().toString(), "SiteNodeVersion.Publish");
        */
        //t.printElapsedTime("copy access");
    }

    //ContentVersion newCV = null;
    List<ContentVersion> newContentVersions = new ArrayList<ContentVersion>();

    Content newMetaInfoContent = SiteNodeController.getController().createSiteNodeMetaInfoContent(db, newSiteNode, null, newParentSiteNode.getRepositoryId(), principal, null, newContentVersions, false, oldMetaInfoContentVO, newNameSuffix);
    RequestAnalyser.getRequestAnalyser().registerComponentStatistics("createSiteNodeMetaInfoContent", t.getElapsedTime());

        //ContentVersionVO newCV = ContentVersionController.getContentVersionController().getLatestActiveContentVersion(newMetaInfoContent.getId(), masterLanguage.getId(), db);
        //t.printElapsedTime("newCV:" + newCV);
       
      logger.info("Adding content version " + newContentVersions.size());
        newCreatedContentVersions.addAll(newContentVersions);

        logger.info("Mapping siteNode " + oldSiteNodeVO.getId() + " to " + newSiteNode.getId());
        siteNodesIdsMapping.put(oldSiteNodeVO.getId(), newSiteNode.getId());

    String versionValue = oldCVVO.getVersionValue();
    if(newContentVersions.size() > 0)
    {
      ContentVersion newCV = newContentVersions.get(0);
View Full Code Here

    Iterator relatedSiteNodeIdsIterator = relatedSiteNodeIds.iterator();
    while(relatedSiteNodeIdsIterator.hasNext())
    {
      Integer siteNodeId = (Integer)relatedSiteNodeIdsIterator.next();
     
      SiteNodeVO siteNodeVO = SiteNodeController.getController().getSiteNodeVOWithId(siteNodeId, db);
      if(siteNodeVO != null)
      {
        logger.info("siteNodeVO: " + siteNodeVO + " for " + siteNodeId);
        logger.info("The siteNodeVO: " + siteNodeVO.getName() + " from repo " + siteNodeVO.getRepositoryId());
        if(siteNodeVO.getRepositoryId().intValue() == oldRepositoryId.intValue())
        {
          logger.info("The related siteNode was in the old repo as well - let's copy that as well - hope we don't get recursive on our ass");
          if(siteNodeIdsToCopy.contains(siteNodeId))
          {
            logger.info("Allready transferred siteNode so skipping:" + siteNodeVO.getName());
            continue;
          }
         
                SiteNodeVO siteNode = getSiteNodeVOWithId(siteNodeVO.getSiteNodeId(), db);
                SiteNodeVO oldParentSiteNode = getSiteNodeVOWithId(siteNode.getParentSiteNodeId(), db);
                //SiteNode oldParentSiteNode = siteNode.getParentSiteNode();
               
          copySiteNodeRecursive(siteNode, newParentSiteNode, principal, siteNodeIdsMapping, contentIdsMapping, contentIdsToCopy, versions, newNameSuffix, db, processBean);
        }
        else
View Full Code Here

     
      QueryResults results = oql.execute(Database.READONLY);
      while(results.hasMore())
            {
        SiteNodeVersion siteNodeVersion = (SiteNodeVersion)results.next();
        SiteNodeVO siteNodeVO = getSiteNodeVOWithId(siteNodeVersion.getValueObject().getSiteNodeId(), db);
        siteNodeVOList.add(siteNodeVO);
            }
           
      results.close();
      oql.close();
View Full Code Here

        beginTransaction(db);

        try
        {
          SiteNodeVO siteNodeVO = getSiteNodeVOWithId(siteNodeId, db);
      //Fixes a nice ordered list
      List<SiteNodeVO> childrenVOList = SiteNodeController.getController().getChildSiteNodeVOList(siteNodeVO.getParentSiteNodeId(), false, db, sortLanguageId);
      Iterator<SiteNodeVO> childrenVOListIterator = childrenVOList.iterator();
      int index = 0;
      while(childrenVOListIterator.hasNext())
      {
        SiteNodeVO childSiteNodeVO = childrenVOListIterator.next();
        SiteNodeVersion latestChildSiteNodeVersion = SiteNodeVersionController.getController().getLatestActiveSiteNodeVersion(db, childSiteNodeVO.getId());
        logger.info("latestChildSiteNodeVersion.getSortOrder():" + latestChildSiteNodeVersion.getSortOrder() + "=" + index);
        if(latestChildSiteNodeVersion.getSortOrder() != index)
        {
          latestChildSiteNodeVersion = SiteNodeStateController.getController().updateStateId(latestChildSiteNodeVersion, SiteNodeVersionVO.WORKING_STATE, "Changed sortOrder", infoGluePrincipal, db);
 
          //Integer currentSortOrder = latestChildSiteNodeVersion.getSortOrder();
          //logger.info("currentSortOrder:" + currentSortOrder + " on " + childSiteNodeVO.getName());
          //if(currentSortOrder != 100)
          //{
          logger.info("Setting sort order to:" + index + " on " + latestChildSiteNodeVersion.getId());
          latestChildSiteNodeVersion.setSortOrder(index);
         
          if(CmsPropertyHandler.getAllowLocalizedSortAndVisibilityProperties())
          {
            ContentVersionVO cvVO = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(childSiteNodeVO.getMetaInfoContentId(), sortLanguageId, db)
            if(cvVO != null)
              ContentVersionController.getContentVersionController().updateAttributeValue(cvVO.getContentVersionId(), "SortOrder", "" + index, infoGluePrincipal, db, true);
          }
          //}
        }
        index++;
      }
           
            commitTransaction(db);
        }
        catch(Exception e)
        {
            logger.error("An error occurred so we should not complete the transaction:" + e, e);
            rollbackTransaction(db);
            throw new SystemException(e.getMessage());
        }
       
      db = CastorDatabaseService.getDatabase();

        ConstraintExceptionBuffer ceb = new ConstraintExceptionBuffer();

        beginTransaction(db);

        try
        {
            if(beforeSiteNodeId == null && direction == null)
            {
              logger.warn("You must specify the either new location with beforeSiteNodeId or sortDirection");
              throw new ConstraintException("SiteNode.parentSiteNodeId", "3403"); //TODO
            }
           
            //logger.info("siteNodeId:" + siteNodeId);
            //logger.info("beforeSiteNodeId:" + beforeSiteNodeId);
            //logger.info("direction:" + direction);
           
            if(beforeSiteNodeId != null)
            {
              Integer oldSortOrder = 0;
              Integer newSortOrder = 0;

                SiteNodeVO siteNodeVO = getSiteNodeVOWithId(siteNodeId, db);
              SiteNodeVO beforeSiteNodeVO = getSiteNodeVOWithId(beforeSiteNodeId, db);
              if(beforeSiteNodeVO.getParentSiteNodeId().intValue() != siteNodeVO.getParentSiteNodeId().intValue())
              {
                logger.info("Was new parent - let's fix that as well");
              }
              else
              {
                logger.info("Parent was the same...");

                List<SiteNodeVO> newChildSiteNodeList = new ArrayList<SiteNodeVO>();
                 
                int insertPosition = 0;
                List<SiteNodeVO> childrenVOList = SiteNodeController.getController().getChildSiteNodeVOList(siteNodeVO.getParentSiteNodeId(), false, db, sortLanguageId);
            Iterator<SiteNodeVO> childrenVOListIterator = childrenVOList.iterator();
            while(childrenVOListIterator.hasNext())
            {
              SiteNodeVO childSiteNodeVO = childrenVOListIterator.next();
              if(childSiteNodeVO.getSiteNodeId().equals(beforeSiteNodeId))
              {
                insertPosition = newChildSiteNodeList.size();
              }

              if(!childSiteNodeVO.getSiteNodeId().equals(siteNodeId))
              {
                newChildSiteNodeList.add(childSiteNodeVO);
              }
            }

            newChildSiteNodeList.add(insertPosition, siteNodeVO);
           
            Iterator<SiteNodeVO> newChildSiteNodeListIterator = newChildSiteNodeList.iterator();
            int i=0;
            int highestSortOrder = 0;
            while(newChildSiteNodeListIterator.hasNext())
            {
              logger.info("i:" + i);
              logger.info("highestSortOrder:" + highestSortOrder);
              SiteNodeVO orderedSiteNodeVO = newChildSiteNodeListIterator.next();
             
              List events = new ArrayList();
              SiteNodeVersionVO siteNodeVersionVO = SiteNodeVersionController.getController().getLatestSiteNodeVersionVO(db, orderedSiteNodeVO.getId());
              Integer localizedSortOrder = 100;
              if(CmsPropertyHandler.getAllowLocalizedSortAndVisibilityProperties())
            {
                ContentVersionVO cvVO = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(orderedSiteNodeVO.getMetaInfoContentId(), sortLanguageId, db)
                if(cvVO != null)
                {
                  String localizedSortOrderString = ContentVersionController.getContentVersionController().getAttributeValue(cvVO.getId(), "SortOrder", false);
                  if(localizedSortOrderString != null && !localizedSortOrderString.equals(""))
                    localizedSortOrder = new Integer(localizedSortOrderString);
                }
              }
             
              //if(siteNodeVersionVO.getSortOrder() < highestSortOrder || localizedSortOrder < highestSortOrder)
              if(siteNodeVersionVO.getSortOrder() < highestSortOrder || localizedSortOrder < highestSortOrder || i != localizedSortOrder)
                {
                if(!siteNodeVersionVO.getStateId().equals(SiteNodeVersionVO.WORKING_STATE))
                { 
                  siteNodeVersionVO = SiteNodeStateController.getController().changeState(siteNodeVersionVO.getId(), SiteNodeVersionVO.WORKING_STATE, "Changed sortOrder", false, infoGluePrincipal, siteNodeVersionVO.getSiteNodeId(), events);
                }
                siteNodeVersionVO.setSortOrder(i);
               
                if(CmsPropertyHandler.getAllowLocalizedSortAndVisibilityProperties())
                {
                  ContentVersionVO cvVO = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(orderedSiteNodeVO.getMetaInfoContentId(), sortLanguageId, db)
                  if(cvVO != null)
                    ContentVersionController.getContentVersionController().updateAttributeValue(cvVO.getContentVersionId(), "SortOrder", "" + i, infoGluePrincipal, db, true);
                }

                SiteNodeVersionController.getController().update(siteNodeVersionVO);
              }
              else
                logger.info("No action - sort order was ok");
              /*
              if(CmsPropertyHandler.getAllowLocalizedSortAndVisibilityProperties())
            {
                if(localizedSortOrder < 100 && localizedSortOrder > highestSortOrder)
                  highestSortOrder = localizedSortOrder;
             
                if(highestSortOrder > i)
                  i = highestSortOrder;
              }
              else
              {
                highestSortOrder = siteNodeVersionVO.getSortOrder();
                  if(highestSortOrder > i)
                  i = highestSortOrder;
              }
              */
              i++;
            }
              }
            }
            else if(direction.equalsIgnoreCase("up") || direction.equalsIgnoreCase("down"))
            {
              Integer oldSortOrder = 0;
              Integer newSortOrder = 0;
              SiteNodeVO siteNodeVO = getSiteNodeVOWithId(siteNodeId, db);

                SiteNodeVersion latestSiteNodeVersion = SiteNodeVersionController.getController().getLatestActiveSiteNodeVersion(db, siteNodeId);
              if(latestSiteNodeVersion != null)
        {
          oldSortOrder = latestSiteNodeVersion.getSortOrder();
          if(direction.equalsIgnoreCase("up"))
            newSortOrder = oldSortOrder - 1;
          else if(direction.equalsIgnoreCase("down"))
            newSortOrder = oldSortOrder + 1;
        }
       
              logger.info("OldSortOrder:" + oldSortOrder);
        List<SiteNodeVO> childrenVOList = SiteNodeController.getController().getChildSiteNodeVOList(siteNodeVO.getParentSiteNodeId(), false, db, sortLanguageId);
        Iterator<SiteNodeVO> childrenVOListIterator = childrenVOList.iterator();
        while(childrenVOListIterator.hasNext())
        {
          SiteNodeVO childSiteNodeVO = childrenVOListIterator.next();
          logger.info("childSiteNodeVO:" + childSiteNodeVO.getId() + ":" + childSiteNodeVO.getSortOrder());
          SiteNodeVersion latestChildSiteNodeVersion = SiteNodeVersionController.getController().getLatestActiveSiteNodeVersion(db, childSiteNodeVO.getId());
          //logger.info("latestChildSiteNodeVersion:" + latestChildSiteNodeVersion.getId());
          Integer currentSortOrder = latestChildSiteNodeVersion.getSortOrder();
          logger.info("currentSortOrder:" + currentSortOrder);
          if(currentSortOrder.equals(oldSortOrder))
          {
            latestChildSiteNodeVersion = SiteNodeStateController.getController().updateStateId(latestChildSiteNodeVersion, SiteNodeVersionVO.WORKING_STATE, "Changed sortOrder", infoGluePrincipal, db);
            latestChildSiteNodeVersion.setSortOrder(newSortOrder);
            //logger.info("Changed sort order on:" + latestChildSiteNodeVersion.getId() + " into " + newSortOrder);

            if(CmsPropertyHandler.getAllowLocalizedSortAndVisibilityProperties())
            {
              ContentVersionVO cvVO = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(childSiteNodeVO.getMetaInfoContentId(), sortLanguageId, db)
              if(cvVO != null)
                ContentVersionController.getContentVersionController().updateAttributeValue(cvVO.getContentVersionId(), "SortOrder", "" + newSortOrder, infoGluePrincipal, db, true);
            }
          }
          else if(currentSortOrder.equals(newSortOrder))
          {
            latestChildSiteNodeVersion = SiteNodeStateController.getController().updateStateId(latestChildSiteNodeVersion, SiteNodeVersionVO.WORKING_STATE, "Changed sortOrder", infoGluePrincipal, db);
            latestChildSiteNodeVersion.setSortOrder(oldSortOrder);
            //logger.info("Changed sort order on:" + latestChildSiteNodeVersion.getId() + " into " + oldSortOrder);

            if(CmsPropertyHandler.getAllowLocalizedSortAndVisibilityProperties())
            {
              ContentVersionVO cvVO = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(childSiteNodeVO.getMetaInfoContentId(), sortLanguageId, db)
              if(cvVO != null)
                ContentVersionController.getContentVersionController().updateAttributeValue(cvVO.getContentVersionId(), "SortOrder", "" + oldSortOrder, infoGluePrincipal, db, true);
            }
          }
        }
View Full Code Here

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

        SiteNodeVO siteNodeVO = null;

        beginTransaction(db);

        try
        {
          logger.info("Fetching the root siteNode for the repository " + repositoryId);
      siteNodeVO = SiteNodeController.getController().getRootSiteNodeVO(repositoryId, db);
           
      //OQLQuery oql = db.getOQLQuery( "SELECT c FROM org.infoglue.cms.entities.structure.impl.simple.SiteNodeImpl c WHERE is_undefined(c.parentSiteNode) AND c.repository.repositoryId = $1");
      //oql.bind(repositoryId);
     
      //QueryResults results = oql.execute(Database.READONLY);
     
      if (siteNodeVO != null /*results.hasMore()*/)
            {
          //siteNodeVO = ((SiteNode)results.next()).getValueObject();
            }
            else
            {
        //None found - we create it and give it the name of the repository.
        logger.info("Found no rootSiteNode so we create a new....");
        SiteNodeVO rootSiteNodeVO = new SiteNodeVO();
        Repository repository = RepositoryController.getController().getRepositoryWithId(repositoryId, db);
        rootSiteNodeVO.setName(repository.getName());
        rootSiteNodeVO.setIsBranch(new Boolean(true));
        rootSiteNodeVO.setMetaInfoContentId(new Integer(-1));
        List siteNodeTypeDefintionList = SiteNodeTypeDefinitionController.getController().getSiteNodeTypeDefinitionList(db);
        Integer siteNodeTypeDefintionId = null;
        if(siteNodeTypeDefintionList != null && siteNodeTypeDefintionList.size() == 1)
          siteNodeTypeDefintionId = ((SiteNodeTypeDefinition)siteNodeTypeDefintionList.get(0)).getId();
       
        SiteNode siteNode = SiteNodeController.getController().create(db, null, siteNodeTypeDefintionId, infoGluePrincipal, repositoryId, rootSiteNodeVO);
        //siteNodeVO = SiteNodeController.getController().create(null, null, infoGluePrincipal, repositoryId, siteNodeVO);
        //siteNodeVO = SiteNodeControllerProxy.getSiteNodeControllerProxy().acCreate(infoGluePrincipal, null, null, repositoryId, rootSiteNodeVO);
        siteNodeVO = siteNode.getValueObject();
        SiteNodeVO newSiteNodeVO = siteNodeVO;
       
              //Also creates an initial meta info for the sitenode.
        SiteNodeController.getController().createSiteNodeMetaInfoContent(db, siteNode.getValueObject(), repositoryId, infoGluePrincipal, null, new ArrayList<ContentVersion>());
      }
     
View Full Code Here

    this.templateController = templateController;
  }

  public int compare(Object o1, Object o2)
  {
    SiteNodeVO siteNodeVO1 = (SiteNodeVO)o1;
    SiteNodeVO siteNodeVO2 = (SiteNodeVO)o2;

    Comparable valueOne = (String)siteNodeVO1.getExtraProperties().get(sortProperty);
    Comparable valueTwo = (String)siteNodeVO2.getExtraProperties().get(sortProperty);
   
        long previousTime = System.currentTimeMillis();

    if(valueOne == null)
    {
          valueOne = getProperty(o1, sortProperty);
      valueTwo = getProperty(o2, sortProperty);
    }

    if(valueOne == null && this.templateController != null)
    {
        Integer meta1Id = this.templateController.getMetaInformationContentId(siteNodeVO1.getId());
        Integer meta2Id = this.templateController.getMetaInformationContentId(siteNodeVO2.getId());
   
        valueOne = this.templateController.getContentAttribute(meta1Id, this.templateController.getLanguageId(), sortProperty);
      valueTwo = this.templateController.getContentAttribute(meta2Id, this.templateController.getLanguageId(), sortProperty);
    }
View Full Code Here

TOP

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

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.