metadata.setFlowIdentifier(flowId); metadata.setVersion(version); metadata.setComments(deserializedSnapshot.getSnapshotMetadata().getComments());
@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); }
@Override public VersionedFlowSnapshotResult doExecute(final NiFiRegistryClient client, final Properties properties) throws ParseException, IOException, NiFiRegistryException { final String flowId = getRequiredArg(properties, CommandOption.FLOW_ID); final Integer version = getIntArg(properties, CommandOption.FLOW_VERSION); // if no version was provided then export the latest, otherwise use specific version final VersionedFlowSnapshot versionedFlowSnapshot; if (version == null) { versionedFlowSnapshot = client.getFlowSnapshotClient().getLatest(flowId); } else { versionedFlowSnapshot = client.getFlowSnapshotClient().get(flowId, version); } versionedFlowSnapshot.setFlow(null); versionedFlowSnapshot.setBucket(null); versionedFlowSnapshot.getSnapshotMetadata().setBucketIdentifier(null); versionedFlowSnapshot.getSnapshotMetadata().setFlowIdentifier(null); versionedFlowSnapshot.getSnapshotMetadata().setLink(null); // currently export doesn't use the ResultWriter concept, it always writes JSON // destination will be a file if outputFile is specified, otherwise it will be the output stream of the CLI final String outputFile; if (properties.containsKey(CommandOption.OUTPUT_FILE.getLongName())) { outputFile = properties.getProperty(CommandOption.OUTPUT_FILE.getLongName()); } else { outputFile = null; } return new VersionedFlowSnapshotResult(versionedFlowSnapshot, outputFile); }
destMetadata.setFlowIdentifier(destFlowId); destMetadata.setVersion(srcVersion); destMetadata.setComments(srcFlowSnapshot.getSnapshotMetadata().getComments());
destMetadata.setFlowIdentifier(destFlowId); destMetadata.setVersion(destFlowVersion); destMetadata.setComments(srcSnapshot.getSnapshotMetadata().getComments());
public static VersionedFlowSnapshotMetadata map(final BucketEntity bucketEntity, final FlowSnapshotEntity flowSnapshotEntity) { final VersionedFlowSnapshotMetadata metadata = new VersionedFlowSnapshotMetadata(); metadata.setFlowIdentifier(flowSnapshotEntity.getFlowId()); metadata.setVersion(flowSnapshotEntity.getVersion()); metadata.setComments(flowSnapshotEntity.getComments()); metadata.setTimestamp(flowSnapshotEntity.getCreated().getTime()); metadata.setAuthor(flowSnapshotEntity.getCreatedBy()); if (bucketEntity != null) { metadata.setBucketIdentifier(bucketEntity.getId()); } return metadata; }