Package org.structr.core.entity

Examples of org.structr.core.entity.AbstractNode


  public <T> T getProperty(PropertyKey<T> key) {

    // try local properties first
    if (contentNodes.containsKey(key.dbName())) {

      AbstractNode node = contentNodes.get(key.dbName());

      if ((node != null) && (node != this)) {

        return (T)node.getProperty(Content.content);

      }

    } else if (subTypes.contains(SchemaHelper.normalizeEntityName(key.dbName()))) {
View Full Code Here


  @Override
  public <T> void setProperty(PropertyKey<T> key, T value) throws FrameworkException {

    if (contentNodes.containsKey(key.dbName())) {

      AbstractNode node = contentNodes.get(key.dbName());

      if (node != null) {

        node.setProperty(Content.content, value.toString());

      }

    } else {
View Full Code Here

      return;

    }

    // check if parent node with given ID exists
    AbstractNode parentNode = getNode(parentId);

    if (parentNode == null) {

      getWebSocket().send(MessageBuilder.status().code(404).message("Parent node not found").build(), true);
View Full Code Here

  }

  @Override
  public Object revert(Object source) {

    final AbstractNode startNode         = (AbstractNode) currentObject;
    final TraversalDescription localDesc = Traversal.description().depthFirst().uniqueness(Uniqueness.NODE_PATH).relationships(RelType.CONTAINS, Direction.INCOMING);
    final String uuidPropertyName        = GraphObject.id.dbName();

    Set<String> treeAddresses = new HashSet<>();

    // do traversal
    for (Path path : localDesc.traverse(startNode.getNode())) {

      String pageId       = (String) path.endNode().getProperty(uuidPropertyName);
      String treeAddress  = "";
      boolean isConnected = false;
View Full Code Here

  @Override
  public void processMessage(WebSocketMessage webSocketData) {

    final RelationshipFactory factory = new RelationshipFactory(this.getWebSocket().getSecurityContext());
    final AbstractNode node           = getNode(webSocketData.getId());

    if (node == null) {

      return;
    }

    final Iterable<RelationshipInterface> rels = new IterableAdapter<>(node.getNode().getRelationships(RelType.CONTAINS, Direction.OUTGOING), factory);
    final List<GraphObject> result             = new LinkedList();

    for (RelationshipInterface rel : rels) {

      NodeInterface endNode = rel.getTargetNode();
View Full Code Here

  }

  @Override
  public void processMessage(final WebSocketMessage webSocketData) {

    AbstractNode node = getNode(webSocketData.getId());

    if (node != null) {
      webSocketData.setResult(Arrays.asList(node));

      // send only over local connection (no broadcast)
View Full Code Here

  //~--- methods --------------------------------------------------------

  @Override
  public void processMessage(WebSocketMessage webSocketData) {

    final AbstractNode node        = getNode(webSocketData.getId());
    Map<String, Object> properties = webSocketData.getNodeData();
    String patch                   = (String) properties.get("patch");

    if (node != null) {

      diff_match_patch dmp      = new diff_match_patch();
      String oldText            = node.getProperty(Content.content);
      LinkedList<Patch> patches = (LinkedList<Patch>) dmp.patch_fromText(patch);
      final Object[] results    = dmp.patch_apply(patches, oldText);

      try {
        node.setProperty(Content.content, results[0].toString());
       
      } catch (Throwable t) {

        logger.log(Level.WARNING, "Could not apply patch {0}", patch);
        getWebSocket().send(MessageBuilder.status().code(400).message("Could not apply patch. " + t.getMessage()).build(), true);
View Full Code Here

        renderContext.setResourceProvider(config.getResourceProvider());

        final EditMode edit = renderContext.getEditMode(user);

        DOMNode rootElement = null;
        AbstractNode dataNode = null;

        String[] uriParts = PathHelper.getParts(path);
        if ((uriParts == null) || (uriParts.length == 0)) {

          // find a visible page
View Full Code Here

  public void processMessage(final WebSocketMessage webSocketData) {

    final SecurityContext securityContext = getWebSocket().getSecurityContext();

    final Boolean recursive = (Boolean) webSocketData.getNodeData().get("recursive");
    final AbstractNode obj  = getNode(webSocketData.getId());

    if (obj != null) {

      final App app = StructrApp.getInstance(securityContext);
View Full Code Here

        renderContext.setResourceProvider(config.getResourceProvider());

        final EditMode edit = renderContext.getEditMode(user);

        DOMNode rootElement = null;
        AbstractNode dataNode = null;

        String[] uriParts = PathHelper.getParts(path);
        if ((uriParts == null) || (uriParts.length == 0)) {

          // find a visible page
View Full Code Here

TOP

Related Classes of org.structr.core.entity.AbstractNode

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.