public String doExecute() throws Exception {
    this.repositories =
        RepositoryController.getController()
            .getAuthorizedRepositoryVOList(this.getInfoGluePrincipal(), false);

    return "success";
  }
Exemplo n.º 2
0
 public String doInput() throws Exception {
   this.repositories =
       RepositoryController.getController()
           .getAuthorizedRepositoryVOList(this.getInfoGluePrincipal(), false);
   this.returnAddress =
       "ViewInlineOperationMessages.action"; // ViewContent!V3.action?contentId=" + contentId +
                                             // "&repositoryId=" + this.repositoryId;
   return "input";
 }
  public String doInputV3() throws Exception {
    this.repositories =
        RepositoryController.getController()
            .getAuthorizedRepositoryVOList(this.getInfoGluePrincipal(), false);

    if (this.qualifyerXML != null && !this.qualifyerXML.equals("")) {
      this.qualifyers = parseContentsFromXML(this.qualifyerXML);
    } else {
      ContentVO contentVO =
          ContentController.getContentController().getContentVOWithId(getContentId());
      this.qualifyers.add(contentVO);
    }

    return "inputV3";
  }
  public String doInput() throws Exception {
    this.repositories =
        RepositoryController.getController()
            .getAuthorizedRepositoryVOList(this.getInfoGluePrincipal(), false);

    if (this.qualifyerXML != null && !this.qualifyerXML.equals("")) {
      this.qualifyers = parseSiteNodesFromXML(this.qualifyerXML);
    } else {
      SiteNodeVO siteNodeVO =
          SiteNodeController.getController().getSiteNodeVOWithId(getSiteNodeId());
      this.qualifyers.add(siteNodeVO);
    }

    return "input";
  }
  public String doExecute() throws Exception {
    if (this.newParentSiteNodeId == null) {
      this.repositories =
          RepositoryController.getController()
              .getAuthorizedRepositoryVOList(this.getInfoGluePrincipal(), false);
      return "chooseDestination";
    }

    ceb.throwIfNotEmpty();

    ProcessBean processBean =
        ProcessBean.createProcessBean(
            this.getClass().getName(), "" + getInfoGluePrincipal().getName());
    processBean.setStatus(ProcessBean.RUNNING);

    try {
      if (this.qualifyerXML != null && this.qualifyerXML.length() != 0) {
        Document document = new DOMBuilder().getDocument(this.qualifyerXML);
        List siteNodes = parseSiteNodesFromXML(this.qualifyerXML);
        Iterator iterator = siteNodes.iterator();
        int i = 0;
        while (iterator.hasNext()) {
          SiteNodeVO siteNodeVO = (SiteNodeVO) iterator.next();
          try {
            SiteNodeControllerProxy.getSiteNodeControllerProxy()
                .acCopySiteNode(
                    this.getInfoGluePrincipal(), siteNodeVO, this.newParentSiteNodeId, processBean);
          } catch (Exception e) {
            logger.error("Error in copy site nodes:" + e.getMessage(), e);
            this.errorsOccurred = true;
          }
          i++;
        }
      }
      processBean.updateProcess("Finished - cleaning up");
      Thread.sleep(1000);
    } catch (Exception e) {
      logger.error("Error in copy site nodes:" + e.getMessage(), e);
    } finally {
      processBean.setStatus(ProcessBean.FINISHED);
      processBean.removeProcess();
    }

    this.topSiteNodeId =
        SiteNodeController.getController().getRootSiteNodeVO(this.repositoryId).getId();

    return "success";
  }
  @SuppressWarnings("unchecked")
  public String doInput() throws Exception {
    this.repositories =
        RepositoryController.getController()
            .getAuthorizedRepositoryVOList(this.getInfoGluePrincipal(), false);

    if (this.qualifyerXML != null && !this.qualifyerXML.equals("")) {
      this.qualifyers = parseSiteNodesFromXML(this.qualifyerXML);
    } else {
      SiteNodeVO siteNodeVO =
          SiteNodeController.getController().getSiteNodeVOWithId(getSiteNodeId());
      siteNodeVO
          .getExtraProperties()
          .put("displayName", getLocalizedNameForSiteNode(siteNodeVO, sortLanguageId));
      this.qualifyers.add(siteNodeVO);
    }

    return "input";
  }
  public String doExecute() throws Exception {
    if (this.newParentContentId == null) {
      this.repositories =
          RepositoryController.getController()
              .getAuthorizedRepositoryVOList(this.getInfoGluePrincipal(), false);
      return "chooseDestination";
    }

    ceb.throwIfNotEmpty();

    try {
      if (this.qualifyerXML != null && this.qualifyerXML.length() != 0) {
        Document document = new DOMBuilder().getDocument(this.qualifyerXML);
        List contents = parseContentsFromXML(this.qualifyerXML);
        Iterator i = contents.iterator();
        while (i.hasNext()) {
          ContentVO contentVO = (ContentVO) i.next();
          try {
            ContentControllerProxy.getController()
                .acMoveContent(this.getInfoGluePrincipal(), contentVO, this.newParentContentId);
          } catch (Exception e) {
            this.errorsOccurred = true;
          }
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }

    this.topContentId =
        ContentController.getContentController()
            .getRootContentVO(this.repositoryId, this.getInfoGluePrincipal().getName())
            .getContentId();

    this.returnAddress =
        "ViewContent.action?contentId="
            + this.contentVO.getId()
            + "&repositoryId="
            + this.repositoryId;

    return "success";
  }
  public String doExecute() throws Exception {
    if (this.newParentSiteNodeId == null) {
      this.repositories =
          RepositoryController.getController()
              .getAuthorizedRepositoryVOList(this.getInfoGluePrincipal(), false);
      return "chooseDestination";
    }

    ceb.throwIfNotEmpty();

    try {
      if (this.qualifyerXML != null && this.qualifyerXML.length() != 0) {
        Document document = new DOMBuilder().getDocument(this.qualifyerXML);
        List siteNodes = parseSiteNodesFromXML(this.qualifyerXML);
        Iterator i = siteNodes.iterator();
        while (i.hasNext()) {
          SiteNodeVO siteNodeVO = (SiteNodeVO) i.next();
          try {
            SiteNodeControllerProxy.getSiteNodeControllerProxy()
                .acMoveSiteNode(
                    this.getInfoGluePrincipal(),
                    siteNodeVO,
                    this.newParentSiteNodeId,
                    this.deliverLanguageId);
          } catch (Exception e) {
            this.errorsOccurred = true;
          }
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }

    this.topSiteNodeId =
        SiteNodeController.getController().getRootSiteNodeVO(this.repositoryId).getId();
    this.siteNodeVO = getSiteNodeVO(this.newParentSiteNodeId);

    return "success";
  }
  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);
  }
  public String doV3() throws Exception {
    userSessionKey = "" + System.currentTimeMillis();

    String moveContentInlineOperationDoneHeader =
        getLocalizedString(
            getLocale(),
            "tool.contenttool.moveContentsInlineOperationDoneHeader",
            contentVO.getName());
    String moveContentInlineOperationBackToCurrentPageLinkText =
        getLocalizedString(
            getLocale(),
            "tool.contenttool.moveContentsInlineOperationBackToCurrentContentLinkText");
    String moveContentInlineOperationBackToCurrentPageTitleText =
        getLocalizedString(
            getLocale(),
            "tool.contenttool.moveContentsInlineOperationBackToCurrentContentTitleText");

    if (parentContentId == null && newParentContentId != null) parentContentId = newParentContentId;

    setActionMessage(userSessionKey, moveContentInlineOperationDoneHeader);
    addActionLink(
        userSessionKey,
        new LinkBean(
            "currentPageUrl",
            moveContentInlineOperationBackToCurrentPageLinkText,
            moveContentInlineOperationBackToCurrentPageTitleText,
            moveContentInlineOperationBackToCurrentPageTitleText,
            this.originalAddress,
            false,
            ""));
    setActionExtraData(userSessionKey, "refreshToolbarAndMenu", "" + true);
    setActionExtraData(userSessionKey, "repositoryId", "" + this.repositoryId);
    setActionExtraData(userSessionKey, "contentId", "" + newParentContentId);
    setActionExtraData(userSessionKey, "unrefreshedContentId", "" + parentContentId);
    setActionExtraData(userSessionKey, "unrefreshedNodeId", "" + parentContentId);
    setActionExtraData(userSessionKey, "changeTypeId", "" + this.changeTypeId);

    if (this.newParentContentId == null) {
      this.repositories =
          RepositoryController.getController()
              .getAuthorizedRepositoryVOList(this.getInfoGluePrincipal(), false);
      return "chooseDestinationV3";
    }

    ceb.throwIfNotEmpty();

    try {
      if (this.qualifyerXML != null && this.qualifyerXML.length() != 0) {
        Document document = new DOMBuilder().getDocument(this.qualifyerXML);
        List contents = parseContentsFromXML(this.qualifyerXML);
        Iterator i = contents.iterator();
        while (i.hasNext()) {
          ContentVO contentVO = (ContentVO) i.next();
          try {
            ContentControllerProxy.getController()
                .acMoveContent(this.getInfoGluePrincipal(), contentVO, this.newParentContentId);
          } catch (Exception e) {
            this.errorsOccurred = true;
          }
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }

    this.topContentId =
        ContentController.getContentController()
            .getRootContentVO(this.repositoryId, this.getInfoGluePrincipal().getName())
            .getContentId();

    if (this.returnAddress != null && !this.returnAddress.equals("")) {
      String arguments = "userSessionKey=" + userSessionKey + "&isAutomaticRedirect=false";
      String messageUrl = returnAddress + (returnAddress.indexOf("?") > -1 ? "&" : "?") + arguments;

      this.getResponse().sendRedirect(messageUrl);
      return NONE;
    } else {
      return "successV3";
    }
  }
Exemplo n.º 11
0
  public String doExecute() throws Exception {
    userSessionKey = "" + System.currentTimeMillis();

    String copyContentInlineOperationDoneHeader =
        getLocalizedString(getLocale(), "tool.contenttool.copyContentsInlineOperationDoneHeader");
    String copyContentInlineOperationBackToCurrentPageLinkText =
        getLocalizedString(
            getLocale(),
            "tool.contenttool.copyContentsInlineOperationBackToCurrentContentLinkText");
    String copyContentInlineOperationBackToCurrentPageTitleText =
        getLocalizedString(
            getLocale(),
            "tool.contenttool.copyContentsInlineOperationBackToCurrentContentTitleText");

    setActionMessage(userSessionKey, copyContentInlineOperationDoneHeader);
    addActionLink(
        userSessionKey,
        new LinkBean(
            "currentPageUrl",
            copyContentInlineOperationBackToCurrentPageLinkText,
            copyContentInlineOperationBackToCurrentPageTitleText,
            copyContentInlineOperationBackToCurrentPageTitleText,
            this.originalAddress,
            false,
            ""));
    setActionExtraData(userSessionKey, "refreshToolbarAndMenu", "" + true);
    setActionExtraData(userSessionKey, "repositoryId", "" + this.repositoryId);
    setActionExtraData(userSessionKey, "contentId", "" + newParentContentId);
    setActionExtraData(userSessionKey, "unrefreshedContentId", "" + newParentContentId);
    setActionExtraData(userSessionKey, "unrefreshedNodeId", "" + newParentContentId);
    setActionExtraData(userSessionKey, "changeTypeId", "" + 3);
    setActionExtraData(
        userSessionKey,
        "confirmationMessage",
        getLocalizedString(
            getLocale(),
            "tool.contenttool.contentCopied.confirmation",
            getContentVO(newParentContentId).getName()));

    if (this.newParentContentId == null) {
      this.repositories =
          RepositoryController.getController()
              .getAuthorizedRepositoryVOList(this.getInfoGluePrincipal(), false);
      return "input";
    }

    ContentControllerProxy.getController()
        .acCopyContent(
            this.getInfoGluePrincipal(),
            contentId,
            newParentContentId,
            maxAssetSize,
            onlyLatestVersions);

    if (this.returnAddress != null && !this.returnAddress.equals("")) {
      String arguments = "userSessionKey=" + userSessionKey + "&isAutomaticRedirect=false";
      String messageUrl = returnAddress + (returnAddress.indexOf("?") > -1 ? "&" : "?") + arguments;

      this.getResponse().sendRedirect(messageUrl);
      return NONE;
    } else {
      return "success";
    }
  }