コード例 #1
0
  public Language getLanguageWithRepositoryLanguageId(Integer repositoryLanguageId, Database db)
      throws ConstraintException, SystemException, Bug {
    RepositoryLanguage repositoryLanguage =
        (RepositoryLanguage)
            getObjectWithId(RepositoryLanguageImpl.class, repositoryLanguageId, db);
    Language language = repositoryLanguage.getLanguage();

    return language;
  }
コード例 #2
0
  public List getLanguageList(Integer repositoryId, Database db)
      throws ConstraintException, SystemException {
    List languageList = new ArrayList();

    Repository repository =
        RepositoryController.getController().getRepositoryWithId(repositoryId, db);
    Collection repositoryLanguageList = repository.getRepositoryLanguages();
    Iterator repositoryLanguageIterator = repositoryLanguageList.iterator();
    while (repositoryLanguageIterator.hasNext()) {
      RepositoryLanguage repositoryLanguage =
          (RepositoryLanguage) repositoryLanguageIterator.next();
      languageList.add(repositoryLanguage.getLanguage());
    }

    return languageList;
  }
コード例 #3
0
  private void recurseSiteNodeTree(
      Integer siteNodeId,
      Integer languageId,
      TemplateController templateController,
      Principal principal /*, DatabaseWrapper dbWrapper*/,
      int maxLevel,
      int currentLevel)
      throws Exception {
    SiteNode siteNode =
        SiteNodeController.getController()
            .getSiteNodeWithId(siteNodeId, templateController.getDatabase(), true);
    SiteNodeVO siteNodeVO = templateController.getSiteNode(siteNodeId);

    templateController.getContentAttribute(
        siteNodeVO.getMetaInfoContentId(), languageId, "Title", true);
    templateController.getContentAttribute(
        siteNodeVO.getMetaInfoContentId(), languageId, "NavigationTitle", true);
    templateController.getContentAttribute(
        siteNodeVO.getMetaInfoContentId(), languageId, "NiceURIName", true);
    templateController.getContentAttribute(
        siteNodeVO.getMetaInfoContentId(), languageId, "Description", true);
    templateController.getContentAttribute(
        siteNodeVO.getMetaInfoContentId(), languageId, "ComponentStructure", true);

    List childPages = templateController.getChildPages(siteNodeId);

    templateController.getRepositoryRootSiteNode(siteNodeVO.getRepositoryId());
    templateController.getParentSiteNode(siteNodeVO.getId());

    Collection childSiteNodes = siteNode.getChildSiteNodes();

    /*
       List childSiteNodeIds = new ArrayList();
       Iterator childSiteNodesIterator = childSiteNodes.iterator();
    while(childSiteNodesIterator.hasNext())
       {
        SiteNode childSiteNode = (SiteNode)childSiteNodesIterator.next();
        childSiteNodeIds.add(childSiteNode.getSiteNodeId());
       }

       templateController.commitDatabase();

    Iterator childSiteNodeIdsIterator = childSiteNodeIds.iterator();
    while(childSiteNodeIdsIterator.hasNext())
       {
        Integer childSiteNodeId = (Integer)childSiteNodeIdsIterator.next();
        recurseSiteNodeTree(childSiteNodeId, languageId, templateController, principal);
       }

       */

    Iterator childSiteNodesIterator = childSiteNodes.iterator();
    while (childSiteNodesIterator.hasNext()) {
      SiteNode childSiteNode = (SiteNode) childSiteNodesIterator.next();
      if (maxLevel > currentLevel)
        recurseSiteNodeTree(
            childSiteNode.getId(),
            languageId,
            templateController,
            principal,
            maxLevel,
            currentLevel + 1);
    }

    Repository repository =
        RepositoryController.getController()
            .getRepositoryWithId(siteNodeVO.getRepositoryId(), templateController.getDatabase());
    Collection languages = repository.getRepositoryLanguages();
    Iterator languagesIterator = languages.iterator();
    while (languagesIterator.hasNext()) {
      RepositoryLanguage repositoryLanguage = (RepositoryLanguage) languagesIterator.next();
      LanguageDeliveryController.getLanguageDeliveryController()
          .getLanguageIfSiteNodeSupportsIt(
              templateController.getDatabase(),
              repositoryLanguage.getLanguage().getId(),
              siteNodeId);
    }

    Integer contentId = new Integer(-1);

    FakeHttpSession fakeHttpServletSession = new FakeHttpSession();
    FakeHttpServletResponse fakeHttpServletResponse = new FakeHttpServletResponse();
    FakeHttpServletRequest fakeHttpServletRequest = new FakeHttpServletRequest();
    fakeHttpServletRequest.setParameter("siteNodeId", "" + siteNodeId);
    fakeHttpServletRequest.setParameter("languageId", "" + languageId);
    fakeHttpServletRequest.setParameter("contentId", "" + contentId);
    fakeHttpServletRequest.setRequestURI("ViewPage.action");

    fakeHttpServletRequest.setAttribute("siteNodeId", "" + siteNodeId);
    fakeHttpServletRequest.setAttribute("languageId", "" + languageId);
    fakeHttpServletRequest.setAttribute("contentId", "" + contentId);

    fakeHttpServletRequest.setServletContext(DeliverContextListener.getServletContext());

    BrowserBean browserBean = new BrowserBean();
    // this.browserBean.setRequest(getRequest());

    NodeDeliveryController nodeDeliveryController =
        NodeDeliveryController.getNodeDeliveryController(siteNodeId, languageId, contentId);
    IntegrationDeliveryController integrationDeliveryController =
        IntegrationDeliveryController.getIntegrationDeliveryController(
            siteNodeId, languageId, contentId);
    TemplateController subTemplateController =
        getTemplateController(
            templateController.getDatabaseWrapper(),
            siteNodeId,
            languageId,
            contentId,
            new FakeHttpServletRequest(),
            (InfoGluePrincipal) principal,
            false,
            browserBean,
            nodeDeliveryController,
            integrationDeliveryController);

    DeliveryContext deliveryContext =
        DeliveryContext.getDeliveryContext(/*(InfoGluePrincipal)this.principal*/ );
    // deliveryContext.setRepositoryName(repositoryName);
    deliveryContext.setSiteNodeId(siteNodeId);
    deliveryContext.setContentId(contentId);
    deliveryContext.setLanguageId(languageId);
    deliveryContext.setPageKey("" + System.currentTimeMillis());
    // deliveryContext.setSession(new Session(fakeHttpServletSession));
    // deliveryContext.setInfoGlueAbstractAction(null);
    deliveryContext.setHttpServletRequest(fakeHttpServletRequest);
    deliveryContext.setHttpServletResponse(fakeHttpServletResponse);

    subTemplateController.setDeliveryContext(deliveryContext);

    // We don't want a page cache entry to be created
    deliveryContext.setDisablePageCache(true);

    SiteNodeVO rootSiteNodeVO =
        templateController.getRepositoryRootSiteNode(siteNodeVO.getRepositoryId());

    String pagePath = subTemplateController.getCurrentPagePath();

    CacheController.cacheObject("newPagePathCache", deliveryContext.getPageKey(), pagePath);
  }