Examples of NodeInterface


Examples of org.structr.core.graph.NodeInterface

    } else {

      container.flushAndCloseTemporaryFile();

      final NodeInterface newNode = storeNode(container);
      final String filesPath = StructrApp.getConfigurationValue(Services.FILES_PATH);
      final String relativePath = newNode.getProperty(File.relativeFilePath);
      String newPath = null;

      if (filesPath.endsWith("/")) {

        newPath = filesPath + relativePath;
View Full Code Here

Examples of org.structr.core.graph.NodeInterface

    final SecurityContext securityContext = getWebSocket().getSecurityContext();
    String id = webSocketData.getId();

    if (id != null) {

      final NodeInterface node = getNode(id);

      if (node != null) {

        if (node instanceof DOMNode) {

          // Use new DOM interface
          DOMNode domNode = (DOMNode) node;

          domNode.getParentNode().removeChild(domNode);

          try {

            // Remove node from page
            domNode.setProperty(DOMNode.syncedNodes, Collections.EMPTY_LIST);
            domNode.setProperty(DOMNode.pageId, null);

          } catch (FrameworkException ex) {

            logger.log(Level.SEVERE, "Could not remove node from page " + domNode, ex);

          }

        } else {

          final App app = StructrApp.getInstance(securityContext);

          try {

            // Old style: Delete all incoming CONTAINS rels
            for (AbstractRelationship rel : node.getIncomingRelationships()) {

              if ("CONTAINS".equals(rel.getType())) {

                app.delete(rel);
View Full Code Here

Examples of org.structr.core.graph.NodeInterface

    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();
      if (endNode == null) {

        continue;
      }
View Full Code Here

Examples of org.structr.core.graph.NodeInterface

    if (syncable != null) {

      if (syncable.isNode()) {

        final NodeInterface node = syncable.getSyncNode();
        this.id           = node.getUuid();
        this.name         = node.getName();
        this.type         = node.getType();
        this.lastModified = node.getLastModifiedDate();
        this.node         = true;

        if (node instanceof File) {
          this.size = ((File)node).getSize();
        }
View Full Code Here

Examples of org.structr.core.graph.NodeInterface

    try {

      final PropertyMap props = new PropertyMap();
      final String type       = "UnknownTestType";
      final String name       = "GenericNode-name";
      NodeInterface node      = null;
      String uuid             = null;

      props.put(AbstractNode.type, type);
      props.put(AbstractNode.name, name);

      try (final Tx tx = app.tx()) {

        node = app.create(NodeInterface.class, props);
        tx.success();
      }

      assertTrue(node != null);

      try (final Tx tx = app.tx()) {
        uuid = node.getUuid();
      }

      try (final Tx tx = app.tx()) {

        app.delete(node);
View Full Code Here

Examples of org.structr.core.graph.NodeInterface

    try {

      // Create a relationship with DELETE_OUTGOING
      AbstractRelationship rel = cascadeRel(TestOne.class, TestTwo.class, Relation.SOURCE_TO_TARGET);
      NodeInterface sourceNode;
      NodeInterface targetNode;
      String startNodeId;
      String endNodeId;

      try (final Tx tx = app.tx()) {
View Full Code Here

Examples of org.structr.core.graph.NodeInterface

    try {

      // Create a relationship with DELETE_INCOMING
      AbstractRelationship rel = cascadeRel(TestOne.class, TestTwo.class, Relation.TARGET_TO_SOURCE | Relation.SOURCE_TO_TARGET);
      NodeInterface sourceNode;
      NodeInterface targetNode;
      String startNodeId;
      String endNodeId;

      try (final Tx tx = app.tx()) {
View Full Code Here

Examples of org.structr.core.graph.NodeInterface

  public void test07CascadeDeleteConditional() {

    try {

      AbstractRelationship rel = cascadeRel(TestOne.class, TestTwo.class, Relation.CONSTRAINT_BASED);
      NodeInterface sourceNode;
      String startNodeId;
      String endNodeId;

      try (final Tx tx = app.tx()) {
View Full Code Here

Examples of org.structr.core.graph.NodeInterface

  public void test03CreateRelationship() {

    try {

      final List<GenericNode> nodes = createTestNodes(GenericNode.class, 2);
      final NodeInterface startNode = nodes.get(0);
      final NodeInterface endNode   = nodes.get(1);
      NodeHasLocation rel           = null;

      assertTrue(startNode != null);
      assertTrue(endNode != null);

      try (final Tx tx = app.tx()) {

        rel = app.create(startNode, endNode, NodeHasLocation.class);
        tx.success();
      }

      try (final Tx tx = app.tx()) {

        assertEquals(startNode.getUuid(), rel.getSourceNodeId());
        assertEquals(endNode.getUuid(), rel.getTargetNodeId());
        assertEquals(RelType.IS_AT.name(), rel.getType());
        assertEquals(NodeHasLocation.class, rel.getClass());
      }

    } catch (FrameworkException ex) {
View Full Code Here

Examples of org.structr.core.graph.NodeInterface

          }

          logger.log(Level.INFO, "Creating node of type {0}", type);

          NodeInterface node = app.create(type, props);

          assertTrue(type.getSimpleName().equals(node.getProperty(AbstractNode.type)));

          // Remove mandatory fields for ResourceAccess from props map
          if (type.equals(ResourceAccess.class)) {

            props.remove(ResourceAccess.signature);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.