final App app = StructrApp.getInstance();
try (final Tx tx = app.tx()) {
final List<SyncableInfo> syncables = CloudService.doRemote(new SingleTransmission<>(new ListSyncables(type), username, password, host, port.intValue()), new WebsocketProgressListener(getWebSocket(), key));
final StructrWebSocket webSocket = getWebSocket();
if (syncables != null) {
final List<GraphObject> result = new LinkedList<>();
for (final SyncableInfo info : syncables) {
final GraphObjectMap map = new GraphObjectMap();
map.put(GraphObject.id, info.getId());
map.put(NodeInterface.name, info.getName());
map.put(File.size, info.getSize());
map.put(GraphObject.type, info.getType());
map.put(GraphObject.lastModifiedDate, info.getLastModified());
// check for existance
map.put(isSynchronized, isSynchronized(info));
result.add(map);
}
webSocketData.setResult(result);
webSocket.send(webSocketData, true);
}
} catch (FrameworkException fex) {
getWebSocket().send(MessageBuilder.status().code(400).message(fex.getMessage()).build(), true);