Example #1
0
  /**
   * Checks if is node content published to page node.
   *
   * @param contentNode the content node
   * @param navNodeURI the nav node uri
   * @return true, if is node content published to page node
   * @throws Exception the exception
   */
  public static boolean isNodeContentPublishedToPageNode(Node contentNode, String navNodeURI)
      throws Exception {

    UserPortal userPortal = Util.getPortalRequestContext().getUserPortalConfig().getUserPortal();

    // make filter
    UserNodeFilterConfig.Builder filterConfigBuilder = UserNodeFilterConfig.builder();
    filterConfigBuilder
        .withReadWriteCheck()
        .withVisibility(Visibility.DISPLAYED, Visibility.TEMPORAL);
    filterConfigBuilder.withTemporalCheck();
    UserNodeFilterConfig filterConfig = filterConfigBuilder.build();

    // get user node
    String nodeURI =
        navNodeURI.replace("/" + Util.getPortalRequestContext().getPortalOwner() + "/", "");
    UserNode userNode;
    UserNavigation userNavigation =
        NavigationUtils.getUserNavigationOfPortal(
            userPortal, Util.getUIPortal().getSiteKey().getName());
    if (userNavigation != null) {
      userNode = userPortal.resolvePath(userNavigation, filterConfig, nodeURI);
    } else {
      userNode = userPortal.resolvePath(filterConfig, nodeURI);
    }

    if (userNode == null || userNode.getPageRef() == null) return false;

    return PublicationUtil.getValuesAsString(contentNode, "publication:webPageIDs")
        .contains(userNode.getPageRef());
  }
Example #2
0
 /**
  * Gets the list application id by page.
  *
  * @param page the page
  * @param portletName the portlet name
  * @return the list application id by page
  */
 public static List<String> getListApplicationIdByPage(Page page, String portletName) {
   return PublicationUtil.findAppInstancesByName(page, portletName);
 }