private FlowSnapshotClient getFlowSnapshotClient(final NiFiUser user) { final String identity = getIdentity(user); final NiFiRegistryClient registryClient = getRegistryClient(); final FlowSnapshotClient snapshotClient = identity == null ? registryClient.getFlowSnapshotClient() : registryClient.getFlowSnapshotClient(identity); return snapshotClient; }
private BucketClient getBucketClient(final NiFiUser user) { final String identity = getIdentity(user); final NiFiRegistryClient registryClient = getRegistryClient(); final BucketClient bucketClient = identity == null ? registryClient.getBucketClient() : registryClient.getBucketClient(identity); return bucketClient; }
private FlowClient getFlowClient(final NiFiUser user) { final String identity = getIdentity(user); final NiFiRegistryClient registryClient = getRegistryClient(); final FlowClient flowClient = identity == null ? registryClient.getFlowClient() : registryClient.getFlowClient(identity); return flowClient; }
@Override public VersionedFlowSnapshot registerVersionedFlowSnapshot(final VersionedFlow flow, final VersionedProcessGroup snapshot, final String comments, final int expectedVersion, final NiFiUser user) throws IOException, NiFiRegistryException { final FlowSnapshotClient snapshotClient = getFlowSnapshotClient(user); final VersionedFlowSnapshot versionedFlowSnapshot = new VersionedFlowSnapshot(); versionedFlowSnapshot.setFlowContents(snapshot); final VersionedFlowSnapshotMetadata metadata = new VersionedFlowSnapshotMetadata(); metadata.setBucketIdentifier(flow.getBucketIdentifier()); metadata.setFlowIdentifier(flow.getIdentifier()); metadata.setAuthor(getIdentity(user)); metadata.setTimestamp(System.currentTimeMillis()); metadata.setVersion(expectedVersion); metadata.setComments(comments); versionedFlowSnapshot.setSnapshotMetadata(metadata); return snapshotClient.create(versionedFlowSnapshot); }