Package org.structr.core.graph

Examples of org.structr.core.graph.NodeInterface


  }

  protected <T extends Relation> List<T> createTestRelationships(final Class<T> relType, final int number) throws FrameworkException {

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

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

      List<T> rels = new LinkedList<>();
View Full Code Here


public class RenderContextTest extends StructrUiTest {

  public void testVariableReplacementInDynamicTypes() {

    SchemaNode itemNode  = null;
    NodeInterface parent = null;
    NodeInterface child1 = null;
    NodeInterface child2 = null;

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

      itemNode = app.create(SchemaNode.class, new NodeAttribute(SchemaNode.name, "Item"));
View Full Code Here

    try {

      final PropertyMap properties  = PropertyMap.inputTypeToJavaType(securityContext, nodeData);
      Class type      = SchemaHelper.getEntityClassForRawType(properties.get(AbstractNode.type));
      final NodeInterface newNode  = app.create(type, properties);

      // check for File node and store in WebSocket to receive chunks
      if (newNode instanceof FileBase) {

        Long size    = (Long) webSocketData.getNodeData().get("size");
View Full Code Here

    final Object value = serverConnection.getValue(key + "Nodes");
    if (value instanceof List) {

      final List<NodeInterface> nodes = (List<NodeInterface>)value;
      final NodeInterface node        = nodes.get(nodeIndex);
      final File file                 = (File)node;

      serverConnection.send(new FileNodeDataContainer(file));
    }
  }
View Full Code Here

    final Object value = serverConnection.getValue(key + "Nodes");
    if (value instanceof List) {

      final List<NodeInterface> nodes = (List<NodeInterface>)value;
      final NodeInterface node        = nodes.get(nodeIndex);

      if (node instanceof File) {

        PushTransmission.sendFile(serverConnection, (File)node, CloudService.CHUNK_SIZE);
View Full Code Here

  protected void setDataRoot(final RenderContext renderContext, final AbstractNode node, final String dataKey) {
    // an outgoing RENDER_NODE relationship points to the data node where rendering starts
    for (RenderNode rel : node.getOutgoingRelationships(RenderNode.class)) {

      NodeInterface dataRoot = rel.getTargetNode();

      // set start node of this rendering to the data root node
      renderContext.putDataObject(dataKey, dataRoot);

      // allow only one data tree to be rendered for now
View Full Code Here

        if (sourceEntity instanceof NodeInterface) {

          if (!typeResource.isNode) {

            final NodeInterface source = (NodeInterface) sourceEntity;
            final Node sourceNode = source.getNode();
            final Class relationshipType = typeResource.entityClass;
            final Relation relation = AbstractNode.getRelationshipForType(relationshipType);
            final Class destNodeType = relation.getOtherType(typedIdResource.getEntityClass());
            final Set partialResult = new LinkedHashSet<>(typeResource.doGet(sortKey, sortDescending, NodeFactory.DEFAULT_PAGE_SIZE, NodeFactory.DEFAULT_PAGE, null).getResults());

            // filter list according to end node type
            final Set<GraphObject> set = Iterables.toSet(Iterables.filter(new OtherNodeTypeRelationFilter(securityContext, sourceNode, destNodeType), source.getRelationships(relationshipType)));

            // intersect partial result with result list
            set.retainAll(partialResult);

            final List<GraphObject> finalResult = new LinkedList<>(set);
View Full Code Here

    if (sourceNode != null && propertyKey != null && propertyKey instanceof RelationProperty) {

      final RelationProperty relationProperty = (RelationProperty) propertyKey;
      final Class sourceNodeType = sourceNode.getClass();
      NodeInterface newNode = null;

      if (propertyKey.isReadOnly()) {

        logger.log(Level.INFO, "Read-only property on {0}: {1}", new Object[]{sourceNodeType, typeResource.getRawType()});
View Full Code Here

    if (name != null && host != null) {

      final App app     = StructrApp.getInstance();
      try (final Tx tx = app.tx()) {

        final NodeInterface entity = app.nodeQuery().andName(name).getFirst();
        if (entity != null && entity instanceof Syncable) {

          CloudService.doRemote(new PushTransmission((Syncable)entity, true, "admin", "admin", host, 54555), new LoggingListener());
        }
      }
View Full Code Here

  }

  protected <T extends Relation> List<T> createTestRelationships(final Class<T> relType, final int number) throws FrameworkException {

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

    List<T> rels = new LinkedList<>();

    for (int i = 0; i < number; i++) {
View Full Code Here

TOP

Related Classes of org.structr.core.graph.NodeInterface

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.