Add flag to GetNode command to include private data
[jFCPlib.git] / src / main / java / net / pterodactylus / fcp / quelaton / GetNodeCommandImpl.java
index 3c260ab..23c5ad0 100644 (file)
@@ -22,6 +22,7 @@ public class GetNodeCommandImpl implements GetNodeCommand {
        private final ListeningExecutorService threadPool;
        private final ConnectionSupplier connectionSupplier;
        private final AtomicBoolean giveOpennetRef = new AtomicBoolean(false);
+       private final AtomicBoolean includePrivate = new AtomicBoolean(false);
 
        public GetNodeCommandImpl(ExecutorService threadPool, ConnectionSupplier connectionSupplier) {
                this.threadPool = MoreExecutors.listeningDecorator(threadPool);
@@ -35,8 +36,15 @@ public class GetNodeCommandImpl implements GetNodeCommand {
        }
 
        @Override
+       public GetNodeCommand includePrivate() {
+               includePrivate.set(true);
+               return this;
+       }
+
+       @Override
        public ListenableFuture<NodeData> execute() {
-               GetNode getNode = new GetNode(new RandomIdentifierGenerator().generate(), giveOpennetRef.get(), false, false);
+               GetNode getNode = new GetNode(new RandomIdentifierGenerator().generate(), giveOpennetRef.get(),
+                       includePrivate.get(), false);
                return threadPool.submit(() -> new GetNodeReplySequence().send(getNode).get());
        }