Examples of RelationshipDataContainer


Examples of org.structr.cloud.message.RelationshipDataContainer

    return newOrExistingNode;
  }

  public RelationshipInterface storeRelationship(final DataContainer receivedData) throws FrameworkException {

    final RelationshipDataContainer receivedRelationshipData = (RelationshipDataContainer) receivedData;
    final String sourceStartNodeId = receivedRelationshipData.getSourceStartNodeId();
    final String sourceEndNodeId = receivedRelationshipData.getSourceEndNodeId();
    final String uuid = receivedRelationshipData.getRelationshipId();

    // if end node ID was not found in the ID map,
    // assume it already exists in the database
    // (i.e. it was created earlier)
    String targetStartNodeId = idMap.get(sourceStartNodeId);
    if (targetStartNodeId == null) {
      targetStartNodeId = sourceStartNodeId;
    }

    // if end node ID was not found in the ID map,
    // assume it already exists in the database
    // (i.e. it was created earlier)
    String targetEndNodeId = idMap.get(sourceEndNodeId);
    if (targetEndNodeId == null) {
      targetEndNodeId = sourceEndNodeId;
    }

    if (targetStartNodeId != null && targetEndNodeId != null) {

      // Get new start and end node
      final SecurityContext securityContext = SecurityContext.getSuperUserInstance();
      final NodeInterface targetStartNode   = (NodeInterface) app.get(targetStartNodeId);
      final NodeInterface targetEndNode     = (NodeInterface) app.get(targetEndNodeId);
      final String typeName                 = receivedRelationshipData.getType();
      final Class relType                   = config.getRelationshipEntityClass(typeName);

      if (targetStartNode != null && targetEndNode != null) {

        final RelationshipInterface existingCandidate = app.relationshipQuery().and(GraphObject.id, uuid).includeDeletedAndHidden().getFirst();
        final PropertyMap properties = PropertyMap.databaseTypeToJavaType(securityContext, relType, receivedRelationshipData.getProperties());

        if (existingCandidate != null) {

          // merge properties?
          ((Syncable) existingCandidate).updateFromPropertyMap(properties);
View Full Code Here

Examples of org.structr.cloud.message.RelationshipDataContainer

    // send relationships
    Set<RelationshipInterface> rels = exportSet.getRelationships();
    for (RelationshipInterface r : rels) {

      if (nodes.contains(r.getSourceNode()) && nodes.contains(r.getTargetNode())) {
        client.send(new RelationshipDataContainer(r, sequenceNumber++));
      }
    }

    // wait for end of transmission
    client.waitForTransmission();
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.