use of org.structr.cloud.ExportSet in project structr by structr.
the class PullNodeRequestContainer method onRequest.
@Override
public void onRequest(CloudConnection serverConnection) throws IOException, FrameworkException {
try {
final App app = serverConnection.getApplicationContext();
// try node first, then relationship
GraphObject syncable = app.nodeQuery().and(GraphObject.id, rootNodeId).includeDeletedAndHidden().getFirst();
if (syncable == null) {
syncable = app.relationshipQuery().and(GraphObject.id, rootNodeId).includeDeletedAndHidden().getFirst();
}
if (syncable != null) {
final ExportSet exportSet = ExportSet.getInstance(syncable, recursive);
// collect export set
numNodes = exportSet.getNodes().size();
numRels = exportSet.getRelationships().size();
key = NodeServiceCommand.getNextUuid();
serverConnection.storeValue(key + "Nodes", new ArrayList<>(exportSet.getNodes()));
serverConnection.storeValue(key + "Rels", new ArrayList<>(exportSet.getRelationships()));
// send this back
serverConnection.send(this);
}
} catch (FrameworkException fex) {
logger.warn("", fex);
}
}
Aggregations