Package jease.cmf.domain

Examples of jease.cmf.domain.Node


    if (root == null) {
      return null;
    }
    Map<String, Node> cache = Database.query(nodesByPath);
    if (!cache.containsKey(path)) {
      Node node = root.getChild(path);
      if (node != null) {
        cache.put(path, node);
      }
    }
    return cache.get(path);
View Full Code Here


    if (blob == null) {
      return null;
    }
    try {
      Reader reader = Files.newReader(blob.getFile());
      Node node = fromXML(reader);
      reader.close();
      return node;
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
View Full Code Here

  protected void doValidate() throws Exception {
    if (id.getParent() != null) {
      if (getNode() != Nodes.getRoot()) {
        validate(id.isEmpty(), I18N.get("Id_is_required"));
        try {
          Node parent = getNode().getParent();
          if (parent == null) {
            parent = JeaseSession.getContainer();
          }
          parent.validateChild(getNode(), id.getText());
        } catch (NodeException e) {
          addError(e.getMessage());
        }
      }
    }
View Full Code Here

      }
    }
  }

  protected void doDelete() throws Exception {
    Node parent = getNode().getParent();
    delete();
    if (parent != null && !parent.isDescendant(JeaseSession.getContainer())) {
      JeaseSession.setContainer(parent);
    }
  }
View Full Code Here

   * all children of all parents for given content. In general a guard is a
   * child in one of the parent folders of the given object which should have
   * some influence on behaviour of the given object.
   */
  public <E extends Content> E getGuard(Class<E> type) {
    Node currentParent = this;
    while (currentParent != null) {
      for (E node : currentParent.getChildren(type)) {
        return node;
      }
      currentParent = currentParent.getParent();
    }
    return null;
  }
View Full Code Here

    setItemRenderer(new NodeConstructorRenderer());
    setValues(JeaseSession.getConfig().newNodes());
  }

  public Node getSelectedNode() {
    Node node = (Node) getSelectedValue();
    if (node != null) {
      return node.copy(false);
    } else {
      return null;
    }
  }
View Full Code Here

public class NodeBrowserWindow extends Window {

  private Node selectedNode;

  public NodeBrowserWindow(Node container) {
    Node currentContainer = JeaseSession.getContainer();
    if (container != null) {
      JeaseSession.setContainer(container);
    }
    appendChild(new NodeBrowser());
    JeaseSession.setContainer(currentContainer);
View Full Code Here

      return;
    }

    // Try to resolve node from URI (without context path).
    String nodePath = uri.substring(request.getContextPath().length());
    Node node = Nodes.getByPath(nodePath);

    // Process redirect rules
    if (node == null && !servlets.matcher(nodePath).matches()) {
      String sourceURI = buildURI(nodePath, request.getQueryString());
      String targetURI = rewriteURI(sourceURI);
      if (!targetURI.equals(sourceURI)) {
        if (targetURI.contains("://")) {
          response.sendRedirect(response.encodeRedirectURL(targetURI));
        } else {
          response.sendRedirect(response.encodeRedirectURL(request
              .getContextPath() + targetURI));
        }
        return;
      }
    }

    // Save "virtual" root node. Per default it is the absolute root of the
    // instance.
    // If a node with the server name exists, this node is used as virtual
    // root.
    if (request.getAttribute("Root") == null) {
      String server = Servlets.getServerName(request).replaceFirst(
          "www.", "");
      Node root = Nodes.getRoot() != null ? Nodes.getRoot().getChild(
          server) : null;
      if (root == null) {
        root = Nodes.getRoot();
      }
      request.setAttribute("Root", root);
      if (node != null && root.getParent() == node) {
        response.sendRedirect(response.encodeRedirectURL(request
            .getContextPath() + root.getPath()));
        return;
      }
    }

    // If no node is found, process filter chain.
View Full Code Here

TOP

Related Classes of jease.cmf.domain.Node

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.