Package org.infoglue.cms.entities.structure

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


  {
    List<SiteNodeVO> upcomingSiteNodes = SiteNodeController.getController().getUpcomingExpiringSiteNodes(numberOfDays);
    Iterator<SiteNodeVO> upcomingSiteNodesIterator = upcomingSiteNodes.iterator();
    while(upcomingSiteNodesIterator.hasNext())
    {
      SiteNodeVO siteNodeVO = upcomingSiteNodesIterator.next();
      logger.info("siteNodeVO:" + siteNodeVO.getName() + " - " + siteNodeVO.getExpireDateTime());
      String key = "siteNode_" + siteNodeVO.getId() + "_" + numberOfDays + "_days_isProcessed";
      logger.info("key:" + key);
      String isProcessed = ps.getString(key);
        if(isProcessed == null || isProcessed.equals(""))
        {
          logger.info("The node " + siteNodeVO.getName() + " has not been processed.");
         
          Map data = new HashMap();
          data.put("siteNodeVO", siteNodeVO);
         
          intercept(data, "SiteNode.ExpireDateComingUp");
View Full Code Here


          sb.insert(0, contentVO.getName() + "/");
        }
      }
      else if(entity.equalsIgnoreCase("SiteNode"))
      {
        SiteNodeVO siteNodeVO = SiteNodeController.getController().getSiteNodeVOWithId(new Integer(entityId));
        sb.insert(0, siteNodeVO.getName() + "/");
        while(siteNodeVO.getParentSiteNodeId() != null)
        {
          siteNodeVO = SiteNodeController.getController().getSiteNodeVOWithId(siteNodeVO.getParentSiteNodeId());
          sb.insert(0, siteNodeVO.getName() + "/");
        }
      }
      sb.deleteCharAt(sb.length() -1);
    }
    catch(Exception e)
View Full Code Here

     
      try
      {
        if(subscriptionVO.getEntityName().equalsIgnoreCase(SiteNode.class.getName()))
        {
          SiteNodeVO siteNodeVO = SiteNodeController.getController().getSiteNodeVOWithId(new Integer(subscriptionVO.getEntityId()));
          sb.append(getLocalizedString(getLocale(), "tool.common.detailedSubscriptions.onPageLabel") + " <strong>" + siteNodeVO.getName() + "</strong> ");
        }
        if(subscriptionVO.getEntityName().equalsIgnoreCase(Content.class.getName()))
        {
          ContentVO contentVO = ContentController.getContentController().getContentVOWithId(new Integer(subscriptionVO.getEntityId()));
          sb.append(getLocalizedString(getLocale(), "tool.common.detailedSubscriptions.onContentLabel") + " <strong>" + contentVO.getName() + "</strong> ");
View Full Code Here

                  //logger.info("Was a sitenode version access... let's clear caches for that siteNodeVersion.");
                    String idAsString = acVO.getParameters();
                    if(idAsString != null && !idAsString.equals(""))
                    {
                      SiteNodeVersionVO siteNodeVersionVO = SiteNodeVersionController.getController().getSiteNodeVersionVOWithId(new Integer(idAsString));
                      SiteNodeVO siteNodeVO = SiteNodeController.getController().getSiteNodeVOWithId(new Integer(siteNodeVersionVO.getSiteNodeId()));
                        publicationVO.setRepositoryId(new Integer(siteNodeVO.getRepositoryId()));

                      PublicationDetailVO publicationDetailVO = new PublicationDetailVO();
                      publicationDetailVO.setCreationDateTime(DateHelper.getSecondPreciseDate());
                      publicationDetailVO.setDescription("Access rights change publication");
                      publicationDetailVO.setEntityClass("org.infoglue.cms.entities.structure.SiteNode");
                      publicationDetailVO.setEntityId(siteNodeVO.getId());
                      publicationDetailVO.setName("" + siteNodeVO.getName());
                      publicationDetailVO.setTypeId(PublicationDetailVO.PUBLISH);
                      publicationDetailVO.setCreator(this.getInfoGluePrincipal().getName());

                      publicationDetailVOList.add(publicationDetailVO);

                      PublicationDetailVO publicationDetailVO2 = new PublicationDetailVO();
                      publicationDetailVO2.setCreationDateTime(DateHelper.getSecondPreciseDate());
                      publicationDetailVO2.setDescription("Access rights change publication");
                      publicationDetailVO2.setEntityClass("org.infoglue.cms.entities.structure.SiteNodeVersion");
                      publicationDetailVO2.setEntityId(siteNodeVersionVO.getId());
                      publicationDetailVO2.setName("" + siteNodeVO.getName() + "/" + siteNodeVersionVO.getId());
                      publicationDetailVO2.setTypeId(PublicationDetailVO.PUBLISH);
                      publicationDetailVO2.setCreator(this.getInfoGluePrincipal().getName());

                      publicationDetailVOList.add(publicationDetailVO2);}
                }
View Full Code Here

              {
          List referencingSiteNodeVOList = getController().getReferencingPages(contentVO.getId(), 50, true);
                Iterator referencingSiteNodeVOListIterator = referencingSiteNodeVOList.iterator();
                while(referencingSiteNodeVOListIterator.hasNext())
                {
                  SiteNodeVO detailSiteNodeVO = (SiteNodeVO)referencingSiteNodeVOListIterator.next();
                  if(detailSiteNodeVO.getId().equals(detailSiteNodeId))
                  {
                    isValid = true;
                    break;
                  }
                }
              }
        else
          isValid = true;
       
        if(isValid)
        {
                WebPage webPage = getController().getPage(detailSiteNodeId, getController().getLanguageId(), new Integer(-1), escapeHTML, hideUnauthorizedPages);
                setResultAttribute(webPage);
        }
        else
        {
          List referencingSiteNodeVOList = getController().getReferencingPages(contentVO.getId(), 50, true);
          if(referencingSiteNodeVOList.size() == 1)
          {
            SiteNodeVO detailSiteNodeVO = (SiteNodeVO)referencingSiteNodeVOList.get(0);
            WebPage webPage = getController().getPage(detailSiteNodeVO.getId(), getController().getLanguageId(), new Integer(-1), escapeHTML, hideUnauthorizedPages);
            setResultAttribute(webPage);       
          }
          else if(!disableFallBack && referencingSiteNodeVOList.size() > 1)
          {
            SiteNodeVO detailSiteNodeVO = (SiteNodeVO)referencingSiteNodeVOList.get(0);
            WebPage webPage = getController().getPage(detailSiteNodeVO.getId(), getController().getLanguageId(), new Integer(-1), escapeHTML, hideUnauthorizedPages);
            setResultAttribute(webPage);       
          }
          else
          {
            setResultAttribute(null);
          }
        }
      }
      else
      {
        WebPage webPage = null;
        if(contentVO.getContentTypeDefinitionId() != null)
        {
          try
          {
            ContentTypeDefinitionVO contentTypeDefinitionVO = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOWithId(contentVO.getContentTypeDefinitionId(), getController().getDatabase());
            logger.info("contentTypeDefinitionVO:" + contentTypeDefinitionVO.getName());
            if(contentTypeDefinitionVO.getDetailPageResolverClass() != null && !contentTypeDefinitionVO.getDetailPageResolverClass().equals(""))
            {
              ContentDetailPageResolver cdpr = (ContentDetailPageResolver)loadExtensionClass(contentTypeDefinitionVO.getDetailPageResolverClass()).newInstance();;
              logger.info("cdpr:" + cdpr.getName());
              SiteNodeVO detailSiteNodeVO = cdpr.getDetailSiteNodeVO(getController().getPrincipal(), contentVO.getId(), contentTypeDefinitionVO.getDetailPageResolverData(), getController().getDatabase());
              logger.info("detailSiteNodeVO:" + detailSiteNodeVO.getId());
              webPage = getController().getPage(detailSiteNodeVO.getId(), getController().getLanguageId(), new Integer(-1), escapeHTML, hideUnauthorizedPages);
              logger.info("webPage:" + webPage.getSiteNodeId());
            }
          }
          catch (Exception e)
          {
            logger.warn("Content with id:" + contentVO.getId() + " had a faulty content type:" + e.getMessage());
            e.printStackTrace();
          }
        }
       
        if(webPage == null)
        {
          List referencingSiteNodeVOList = getController().getReferencingPages(contentVO.getId(), 50, true);
          if(referencingSiteNodeVOList.size() == 1)
          {
            SiteNodeVO detailSiteNodeVO = (SiteNodeVO)referencingSiteNodeVOList.get(0);
            webPage = getController().getPage(detailSiteNodeVO.getId(), getController().getLanguageId(), new Integer(-1), escapeHTML, hideUnauthorizedPages);
          }
          else if(!disableFallBack && referencingSiteNodeVOList.size() > 1)
          {
            SiteNodeVO detailSiteNodeVO = (SiteNodeVO)referencingSiteNodeVOList.get(0);
            webPage = getController().getPage(detailSiteNodeVO.getId(), getController().getLanguageId(), new Integer(-1), escapeHTML, hideUnauthorizedPages);
          }
        }
 
        setResultAttribute(webPage);
      }
View Full Code Here

      logger.info("protectedProtocolPort:" + protectedProtocolPort);
    }

    try
    {
      SiteNodeVO siteNodeVO = SiteNodeController.getController().getSiteNodeVOWithId(siteNodeId, db);
      if(siteNodeVO == null)
      {
        logger.warn("composePageUrl was called with siteNodeId which does not exist:" + siteNodeId + " from the page with key: " + deliveryContext.getPageKey());
        return "";
      }

      String deriveProtocolWhenUsingProtocolRedirects = RepositoryDeliveryController.getRepositoryDeliveryController().getExtraPropertyValue(siteNodeVO.getRepositoryId(), "deriveProtocolWhenUsingProtocolRedirects");
      if(deriveProtocolWhenUsingProtocolRedirects == null || deriveProtocolWhenUsingProtocolRedirects.equals("") || !deriveProtocolWhenUsingProtocolRedirects.equals("true") || !deriveProtocolWhenUsingProtocolRedirects.equals("false"))
        deriveProtocolWhenUsingProtocolRedirects = CmsPropertyHandler.getDeriveProtocolWhenUsingProtocolRedirects();

      boolean schemaShouldChange = schema != null && !schema.equalsIgnoreCase("https");
      if(deriveProtocolWhenUsingProtocolRedirects.equalsIgnoreCase("true") && operatingMode.equals("3") && schemaShouldChange)
      {
        NodeDeliveryController nodeDeliveryController = NodeDeliveryController.getNodeDeliveryController(siteNodeId, languageId, contentId);
        Integer protectedSiteNodeVersionId = nodeDeliveryController.getProtectedSiteNodeVersionId(db, siteNodeId, "SiteNodeVersion.Read");
        String originalFullURL = deliveryContext.getOriginalFullURL();

        boolean isAnonymousAccepted = true;
        if(protectedSiteNodeVersionId != null)
        {
          Principal anonymousPrincipal = getAnonymousPrincipal();
          isAnonymousAccepted = AccessRightController.getController().getIsPrincipalAuthorized(db, (InfoGluePrincipal)anonymousPrincipal, "SiteNodeVersion.Read", protectedSiteNodeVersionId.toString());
          //logger.info("anonymousPrincipal has access:" + isAnonymousAccepted);
        }

        if(protectedSiteNodeVersionId != null && !isAnonymousAccepted)
        {
          //logger.info("anonymousPrincipal has no access - switching to secure line");
          if(originalFullURL.indexOf(unprotectedProtocolName + "://") > -1)
          {
            useDNSNameInUrls = "true";
            //deliveryContext.setUseFullUrl(true);
            makeAccessBasedProtocolAdjustments = true
            makeAccessBasedProtocolAdjustmentsIntoProtected = true;
          }
        }
        else
        {
          if(originalFullURL.indexOf(protectedProtocolName + "://") > -1)
          {
            useDNSNameInUrls = "true";
            //deliveryContext.setUseFullUrl(true);
            makeAccessBasedProtocolAdjustments = true
            makeAccessBasedProtocolAdjustmentsIntoProtected = false;
          }
        }
      }
    }
    catch (Exception e)
    {
      logger.warn("Error checking up if we should switch protocol:" + e.getMessage(), e);
    }

    boolean isDecoratedUrl = request == null ? false : request.getRequestURI().indexOf("!renderDecoratedPage") > -1;
    logger.debug("URL is decorated: " + isDecoratedUrl);
    if (enableNiceURI.equalsIgnoreCase("true") && !isDecoratedUrl && !deliveryContext.getDisableNiceUri())
    {
      SiteNodeVO siteNode = SiteNodeController.getController().getSmallSiteNodeVOWithId(siteNodeId, db);
      if(siteNode == null)
      {
        logger.warn("composePageUrl was called with siteNodeId which does not exist:" + siteNodeId + " from the page with key: " + deliveryContext.getPageKey());
        return "";
      }
      String enableNiceURIForLanguage = CmsPropertyHandler.getEnableNiceURIForLanguage();
      /*
        //logger.info("enableNiceURIForLanguage:" + enableNiceURIForLanguage);
        if(enableNiceURIForLanguage == null || !enableNiceURIForLanguage.equals("true"))
        {
            String enableNiceURIForLanguageForRepo = RepositoryDeliveryController.getRepositoryDeliveryController().getExtraPropertyValue(siteNode.getRepositoryId(), "enableNiceURIForLanguage");
        if(enableNiceURIForLanguageForRepo != null && enableNiceURIForLanguageForRepo.equals("true"))
          enableNiceURIForLanguage = enableNiceURIForLanguageForRepo;
        }

        if(enableNiceURIForLanguage.equalsIgnoreCase("true"))
            context = context + "/" + LanguageDeliveryController.getLanguageDeliveryController().getLanguageVO(db, languageId).getLanguageCode();
      */
      SiteNodeVO currentSiteNode = SiteNodeController.getController().getSmallSiteNodeVOWithId(deliveryContext.getSiteNodeId(), db);

      if(!siteNode.getRepositoryId().equals(currentSiteNode.getRepositoryId()))
      {
        RepositoryVO repositoryVO = RepositoryController.getController().getRepositoryVOWithId(siteNode.getRepositoryId(), db);
        String dnsName = repositoryVO.getDnsName();
        logger.info("dnsName:" + dnsName + " for siteNode " + siteNode.getName());

        //            String operatingMode = CmsPropertyHandler.getOperatingMode();
        String keyword = "";
        if (operatingMode.equalsIgnoreCase("0"))
        {
          keyword = "working=";
        }
        else if (operatingMode.equalsIgnoreCase("2"))
        {
          keyword = "preview=";
        }
        if (operatingMode.equalsIgnoreCase("3"))
        {
          keyword = "live=";
        }

        String repositoryPath = null;
        if (!operatingMode.equals("3"))
        {
          int workingPathStartIndex = dnsName.indexOf("workingPath=");
          if(workingPathStartIndex != -1)
          {
            int workingPathEndIndex = dnsName.indexOf(",", workingPathStartIndex);
            if(workingPathEndIndex > -1)
              repositoryPath = dnsName.substring(workingPathStartIndex + 12, workingPathEndIndex);
            else
              repositoryPath = dnsName.substring(workingPathStartIndex + 12);
          }
        }

        if(repositoryPath == null)
        {
          int pathStartIndex = dnsName.indexOf("path=");
          if(pathStartIndex != -1)
          {
            int pathEndIndex = dnsName.indexOf(",", pathStartIndex);
            if(pathEndIndex > -1)
              repositoryPath = dnsName.substring(pathStartIndex + 5, pathEndIndex);
            else
              repositoryPath = dnsName.substring(pathStartIndex + 5);
          }
        }

        if(logger.isInfoEnabled())
        {
          logger.info("repositoryPath in constructing new url:" + repositoryPath);
          logger.info("dnsName:" + dnsName);
          logger.info("repositoryPath:" + repositoryPath);
        }

        if(dnsName != null)
        {
          int startIndex = dnsName.indexOf(keyword);
          if(startIndex != -1)
          {
            int endIndex = dnsName.indexOf(",", startIndex);
            if(endIndex > -1)
              dnsName = dnsName.substring(startIndex, endIndex);
            else
              dnsName = dnsName.substring(startIndex);

            dnsName = dnsName.split("=")[1];
          }
          else
          {
            int endIndex = dnsName.indexOf(",");
            if(endIndex > -1)
              dnsName = dnsName.substring(0, endIndex);
            else
              dnsName = dnsName.substring(0);
          }
        }

        if(logger.isInfoEnabled())
        {
          logger.info("A4:" + dnsName);
        }
        if(schema != null && schema.equalsIgnoreCase("https"))
        {
          dnsName = dnsName.replaceFirst(unprotectedProtocolName + "://", protectedProtocolName + "://").replaceFirst(unprotectedProtocolPort, protectedProtocolPort);
        }
        if(logger.isInfoEnabled())
        {
          logger.info("A42:" + dnsName);
        }

        if(repositoryPath != null)
        {
          if(applicationContext.startsWith("/"))
            applicationContext = dnsName + applicationContext + "/" + repositoryPath;
          else
            applicationContext = dnsName + "/" + (applicationContext.equals("") ? "" : applicationContext + "/") + repositoryPath;
        }
        else
        {
          if(applicationContext.startsWith("/"))
            applicationContext = dnsName + applicationContext;
          else
            applicationContext = dnsName + "/" + applicationContext;
        }

        if(logger.isInfoEnabled())
        {
          logger.info("A5:" + applicationContext);
        }

      }
      else
      {
        RepositoryVO repositoryVO = RepositoryController.getController().getRepositoryVOWithId(siteNode.getRepositoryId(), db);
        String dnsName = repositoryVO.getDnsName();

        String repositoryPath = null;
        if (!operatingMode.equals("3"))
            {
              int workingPathStartIndex = dnsName.indexOf("workingPath=");
              if(workingPathStartIndex != -1)
              {
                int workingPathEndIndex = dnsName.indexOf(",", workingPathStartIndex);
                if(workingPathEndIndex > -1)
                    repositoryPath = dnsName.substring(workingPathStartIndex + 12, workingPathEndIndex);
                else
                  repositoryPath = dnsName.substring(workingPathStartIndex + 12);
              }
            }

            if(repositoryPath == null)
            {
                int pathStartIndex = dnsName.indexOf("path=");
                if(pathStartIndex != -1)
                {
                int pathEndIndex = dnsName.indexOf(",", pathStartIndex);
                if(pathEndIndex > -1)
                    repositoryPath = dnsName.substring(pathStartIndex + 5, pathEndIndex);
                else
                  repositoryPath = dnsName.substring(pathStartIndex + 5);
                }
            }

        logger.info("repositoryPath in constructing new url:" + repositoryPath);

        if(repositoryPath != null)
        {
          applicationContext = applicationContext + "/" + repositoryPath;
        }
      }

      StringBuilder sb = new StringBuilder(256);

      if ((deliveryContext.getUseFullUrl() || makeAccessBasedProtocolAdjustments) && applicationContext.indexOf("://") == -1)
      {
        String originalUrl;
        if (request == null)
        {
          logger.info("Could not derive full base URL since we got no request. Getting value from DNS names instead.");
          RepositoryVO repositoryVO = RepositoryController.getController().getRepositoryVOWithId(siteNode.getRepositoryId(), db);
          originalUrl = getHost(repositoryVO.getDnsName(), operatingMode);
        }
        else
        {
          originalUrl = request.getRequestURL().toString();
        }
        if (originalUrl != null)
        {
          String base = originalUrl;
          int indexOfProtocol = base.indexOf("://");
          if (indexOfProtocol > -1)
          {
            indexOfProtocol += 3;
          }
          else
          {
            indexOfProtocol = 0;
          }
          int indexFirstSlash = originalUrl.indexOf("/", indexOfProtocol);
          if (indexFirstSlash > -1)
          {
            base = originalUrl.substring(0, indexFirstSlash);
          }
          sb.append(base);
        }
      }

      sb.append(applicationContext);

      try
      {
        String navigationPath = NodeDeliveryController.getNodeDeliveryController(siteNodeId, languageId, contentId).getPageNavigationPath(db, infoGluePrincipal, siteNodeId, languageId, contentId, deliveryContext);
        if(navigationPath != null && navigationPath.startsWith("/") && sb.toString().endsWith("/"))
          sb.append(navigationPath.substring(1));
        else
          sb.append(navigationPath);

        if(sb.toString().endsWith(applicationContext) && !sb.toString().endsWith("/"))
        {
          sb.append("/");
        }

        boolean addedContent = false;
              /*
              if(contentId != null && contentId.intValue() != -1)
              {
                  sb.append("?contentId=").append(String.valueOf(contentId));
                  addedContent = true;
              }
              */
             
              if(contentId != null && contentId.intValue() != -1)
              {
                if(!CmsPropertyHandler.getNiceURIDisableNiceURIForContent().equals("true"))
                {
                  String navigationTitle = ContentDeliveryController.getContentDeliveryController().getContentAttribute(db, contentId, languageId, "NavigationTitle", siteNodeId, true, deliveryContext, infoGluePrincipal, false, false);
                  if(navigationTitle == null || navigationTitle.equals(""))
                    navigationTitle = ContentDeliveryController.getContentDeliveryController().getContentAttribute(db, contentId, languageId, "Title", siteNodeId, true, deliveryContext, infoGluePrincipal, false, false);
                  if(navigationTitle != null && !navigationTitle.equals(""))
                  {
                    navigationTitle = new VisualFormatter().replaceNiceURINonAsciiWithSpecifiedChars(navigationTitle, CmsPropertyHandler.getNiceURIDefaultReplacementCharacterForContent());
                    sb.append("/" + navigationTitle + ".cid").append(String.valueOf(contentId));
                      addedContent = true;
            }
                  else
                  {
                      if(contentId != null && contentId.intValue() != -1)
                      {
                          sb.append("?contentId=").append(String.valueOf(contentId));
                          addedContent = true;
              }
            }
                }
                else
                {
                    if(contentId != null && contentId.intValue() != -1)
                    {
                        sb.append("?contentId=").append(String.valueOf(contentId));
                        addedContent = true;
            }
          }
              }

              if(!enableNiceURIForLanguage.equalsIgnoreCase("true"))
              {
                if (languageId != null && languageId.intValue() != -1 && deliveryContext.getLanguageId().intValue() != languageId.intValue())
                {
                    if(addedContent)
                        sb.append(getRequestArgumentDelimiter());
                    else
                        sb.append("?");
                       
                    sb.append("languageId=").append(String.valueOf(languageId));
                }
              }
             
              url = (!sb.toString().equals("") ? sb.toString() : "/");
          }
          catch (Exception e)
      {
              logger.warn("Error generating url:" + e.getMessage());
          }
        }
        else
        {          
            if(!useDNSNameInUrls.equalsIgnoreCase("false"))
            {
          if(siteNodeId == null)
            siteNodeId = new Integer(-1);
 
          if(languageId == null)
            languageId = new Integer(-1);
 
          if(contentId == null)
            contentId = new Integer(-1);
 
              String arguments = "siteNodeId=" + siteNodeId + getRequestArgumentDelimiter() + "languageId=" + languageId + getRequestArgumentDelimiter() + "contentId=" + contentId;

              //SiteNode siteNode = SiteNodeController.getSiteNodeWithId(siteNodeId, db, true);
              SiteNodeVO siteNode = SiteNodeController.getController().getSiteNodeVOWithId(siteNodeId, db);
          String dnsName = CmsPropertyHandler.getWebServerAddress();
          if(siteNode != null)
          {
            RepositoryVO repositoryVO = RepositoryController.getController().getRepositoryVOWithId(siteNode.getRepositoryId(), db);
            if(siteNode != null && repositoryVO.getDnsName() != null && !repositoryVO.getDnsName().equals(""))
              dnsName = repositoryVO.getDnsName();
          }

//            String operatingMode = CmsPropertyHandler.getOperatingMode();
View Full Code Here

          enableNiceURI = "false";
       
      String enableNiceURIForLanguage = CmsPropertyHandler.getEnableNiceURIForLanguage();
      if(enableNiceURIForLanguage == null || !enableNiceURIForLanguage.equals("true"))
      {
            SiteNodeVO siteNode = SiteNodeController.getController().getSmallSiteNodeVOWithId(siteNodeId, db);
          if(siteNode == null)
          {
            logger.warn("composePageUrl was called with siteNodeId which does not exist:" + siteNodeId + " from the page with key: " + deliveryContext.getPageKey());
          return "";
          }
         
          String enableNiceURIForLanguageForRepo = RepositoryDeliveryController.getRepositoryDeliveryController().getExtraPropertyValue(siteNode.getRepositoryId(), "enableNiceURIForLanguage");
      if(enableNiceURIForLanguageForRepo != null && enableNiceURIForLanguageForRepo.equals("true"))
        enableNiceURIForLanguage = enableNiceURIForLanguageForRepo;
      }

        if(enableNiceURI.equalsIgnoreCase("true") && !deliveryContext.getDisableNiceUri() && !enableNiceURIForLanguage.equalsIgnoreCase("true"))
View Full Code Here

    public String getPageNavigationPath(Database db, InfoGluePrincipal infogluePrincipal, Integer siteNodeId, Integer languageId, Integer contentId, DeliveryContext deliveryContext) throws SystemException, Exception
    {
      StringBuilder path = null; //new StringBuffer("/");

        SiteNodeVO parentSiteNode = this.getParentSiteNode(db, siteNodeId);
        if (parentSiteNode != null)
        {
            path = new StringBuilder(getPageNavigationPath(db, infogluePrincipal, parentSiteNode.getId(), languageId, null, deliveryContext)).append("/");
        }
        else
        {
            return "";
        }
       
        String niceURIEncoding = CmsPropertyHandler.getNiceURIEncoding();
        if(niceURIEncoding == null || niceURIEncoding.length() == 0)
            niceURIEncoding = "UTF-8";
       
        String attributeName = ViewPageFilter.attributeName;
        if(attributeName == null)
          attributeName = CmsPropertyHandler.getNiceURIAttributeName();
       
        String pathPart;
       
        if(attributeName.equals("SiteNode.name"))
        {
            SiteNodeVO siteNode = this.getSiteNodeVO(db, siteNodeId);
            //SiteNode siteNode = this.getSiteNode(db, siteNodeId);
            pathPart = siteNode.getName();
        }
        else
        {
          pathPart = this.getPageNavigationTitle(db, infogluePrincipal, siteNodeId, languageId, null, META_INFO_BINDING_NAME, attributeName, true, deliveryContext, false);
          if((pathPart == null || pathPart.equals("")) && !attributeName.equals(NAV_TITLE_ATTRIBUTE_NAME))
View Full Code Here

    public static Integer getSiteNodeIdFromBaseSiteNodeIdAndPath(Database db, InfoGluePrincipal infogluePrincipal, String[] path, String attributeName, DeliveryContext deliveryContext, HttpSession session, Integer languageId, String siteNodeIdString, String remainingURI) throws SystemException, Exception
    {
      Integer siteNodeId = null;
      Integer parentSiteNodeId = new Integer(siteNodeIdString);
     
    SiteNodeVO sitenodeVO = getNodeDeliveryController(deliveryContext).getSiteNodeVO(db, new Integer(siteNodeIdString));
    for (int i = 0; i < path.length; i++)
        {
          siteNodeId = NodeDeliveryController.getNodeDeliveryController(null, deliveryContext.getLanguageId(), null, deliveryContext).getSiteNodeId(db, infogluePrincipal, sitenodeVO.getRepositoryId(), path[i], attributeName, parentSiteNodeId, languageId, deliveryContext);
      if(siteNodeId != null)
        parentSiteNodeId = siteNodeId;
        }

        return siteNodeId;
View Full Code Here

   * If the repositoryName is null we fetch the name of the master repository.
   */
 
  public SiteNodeVO getRootSiteNode(Database db, Integer repositoryId) throws SystemException, Exception
  {
      SiteNodeVO siteNodeVO = null;

        String key = "" + repositoryId;
    logger.info("key in getRootSiteNode:" + key);
    Object siteNodeVOCandidate = CacheController.getCachedObject("rootSiteNodeCache", key);
    if(siteNodeVOCandidate != null || siteNodeVOCandidate instanceof NullObject)
    {
      if(siteNodeVOCandidate instanceof SiteNodeVO)
      {
        logger.info("There was an cached master root siteNode:" + ((SiteNodeVO)siteNodeVOCandidate).getName());
        return (SiteNodeVO)siteNodeVOCandidate;
      }
      else
        return null;
    }
    else
    {
      if(repositoryId == null)
      {
        repositoryId = RepositoryDeliveryController.getRepositoryDeliveryController().getMasterRepository(db).getRepositoryId();
        logger.info("Fetched name of master repository as none were given:" + repositoryId);
      }
     
          logger.info("Fetching the root siteNode for the repository " + repositoryId);
      //OQLQuery oql = db.getOQLQuery( "SELECT c FROM org.infoglue.cms.entities.structure.impl.simple.SiteNodeImpl c WHERE is_undefined(c.parentSiteNode) AND c.repository = $1");
      OQLQuery oql = db.getOQLQuery( "SELECT c FROM org.infoglue.cms.entities.structure.impl.simple.SmallSiteNodeImpl c WHERE is_undefined(c.parentSiteNode) AND c.repositoryId = $1");
      oql.bind(repositoryId);
     
        QueryResults results = oql.execute(Database.READONLY);
     
        if (results.hasMore())
          {
            siteNodeVO = ((SiteNode)results.next()).getValueObject();
        if(logger.isInfoEnabled())
          logger.info("The root node was found:" + siteNodeVO.getName());
          }

        results.close();
      oql.close();

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.