Package org.structr.cloud.message

Examples of org.structr.cloud.message.NodeDataContainer


  }

  public NodeInterface storeNode(final DataContainer receivedData) throws FrameworkException {

    final SecurityContext securityContext    = SecurityContext.getSuperUserInstance();
    final NodeDataContainer receivedNodeData = (NodeDataContainer) receivedData;
    final String typeName                    = receivedNodeData.getType();
    final Class nodeType                     = config.getNodeEntityClass(typeName);

    if (nodeType == null) {

      logger.log(Level.SEVERE, "Unknown entity type {0}", typeName);
      return null;
    }

    final PropertyMap properties             = PropertyMap.databaseTypeToJavaType(securityContext, nodeType, receivedNodeData.getProperties());
    final String uuid                        = receivedNodeData.getSourceNodeId();
    NodeInterface newOrExistingNode          = null;

    final NodeInterface existingCandidate = app.nodeQuery().and(GraphObject.id, uuid).includeDeletedAndHidden().getFirst();
    if (existingCandidate != null && existingCandidate instanceof NodeInterface) {

      newOrExistingNode = (NodeInterface) existingCandidate;

      // merge properties
      ((Syncable) newOrExistingNode).updateFromPropertyMap(properties);

    } else {

      // create
      newOrExistingNode = app.create(nodeType, properties);
    }

    idMap.put(receivedNodeData.getSourceNodeId(), newOrExistingNode.getUuid());

    return newOrExistingNode;
  }
View Full Code Here


      if (n instanceof File) {
        sendFile(client, (File)n, CloudService.CHUNK_SIZE);

      } else {

        client.send(new NodeDataContainer(n, sequenceNumber++));
      }
    }

    // send relationships
    Set<RelationshipInterface> rels = exportSet.getRelationships();
View Full Code Here

TOP

Related Classes of org.structr.cloud.message.NodeDataContainer

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.