Esempio n. 1
0
  /**
   * Gets the node view.
   *
   * @param node the node
   * @return the node view
   * @throws Exception the exception
   */
  private Node getViewableContent(Node node, HashMap<String, String> filters) throws Exception {
    Node viewNode = null;
    if (trashService == null) {
      trashService = WCMCoreUtils.getService(TrashService.class);
    }
    try {
      node = getTargetNode(node);
    } catch (AccessDeniedException ade) {
      return null;
    }

    if (node != null && trashService.isInTrash(node)) {
      return null;
    }

    String languageFilter = filters.get(FILTER_LANGUAGE);
    if (languageFilter != null) {
      addUsedLanguage(languageFilter);
      Node lnode = null;
      try {
        lnode = multiLanguageService.getLanguage(node, languageFilter);
      } catch (AccessDeniedException e) {
        if (LOG.isTraceEnabled())
          LOG.trace("AccessDenied on " + languageFilter + " translation for " + node.getPath());
      }
      if (lnode != null) {

        viewNode = getPublishedContent(lnode, filters);
        if (viewNode != null) {
          return viewNode;
        }
        return null;
      }
    }

    if (node != null) {
      viewNode = getPublishedContent(node, filters);
    }

    return viewNode;
  }
Esempio n. 2
0
 public static boolean isInTrash(Node node) throws RepositoryException {
   TrashService trashService = WCMCoreUtils.getService(TrashService.class);
   return trashService.isInTrash(node);
 }