@Override public VersionedFlowSnapshot getVersionedFlowSnapshot(final VersionControlInformationDTO versionControlInfo, final boolean fetchRemoteFlows) { final FlowRegistry flowRegistry = flowRegistryClient.getFlowRegistry(versionControlInfo.getRegistryId()); if (flowRegistry == null) { throw new ResourceNotFoundException("Could not find any Flow Registry registered with identifier " + versionControlInfo.getRegistryId()); } final VersionedFlowSnapshot snapshot; try { snapshot = flowRegistry.getFlowContents(versionControlInfo.getBucketId(), versionControlInfo.getFlowId(), versionControlInfo.getVersion(), fetchRemoteFlows, NiFiUserUtils.getNiFiUser()); } catch (final NiFiRegistryException | IOException e) { logger.error(e.getMessage(), e); throw new IllegalArgumentException("The Flow Registry with ID " + versionControlInfo.getRegistryId() + " reports that no Flow exists with Bucket " + versionControlInfo.getBucketId() + ", Flow " + versionControlInfo.getFlowId() + ", Version " + versionControlInfo.getVersion()); } return snapshot; }
throw new IllegalArgumentException("Version Control Information must supply Registry ID"); if (versionControlInfo.getVersion() == null) { throw new IllegalArgumentException("Version Control Information must supply Version");
throw new IllegalArgumentException("The Registry ID must be supplied."); if (requestVersionControlInfoDto.getVersion() == null) { throw new IllegalArgumentException("The Version of the flow must be supplied."); throw new IllegalArgumentException("The Version Control Information provided does not match the flow that the Process Group is currently synchronized with."); if (!currentVersion.getVersion().equals(versionControlInformationDTO.getVersion())) { throw new IllegalArgumentException("The Version Control Information provided does not match the flow that the Process Group is currently synchronized with.");
@Override protected void writeSimpleResult(final PrintStream output) { final VersionControlInformationDTO dto = versionControlInformationEntity.getVersionControlInformation(); if (dto == null) { return; } final Table table = new Table.Builder() .column("Registry", 20, 30, true) .column("Bucket", 20, 30, true) .column("Flow", 20, 30, true) .column("Ver", 3, 3, false) .build(); table.addRow( dto.getRegistryName(), dto.getBucketName(), dto.getFlowName(), String.valueOf(dto.getVersion()) ); final TableWriter tableWriter = new DynamicTableWriter(); tableWriter.write(table, output); }
throw new IllegalArgumentException("The Registry ID must be supplied."); if (requestVersionControlInfoDto.getVersion() == null) { throw new IllegalArgumentException("The Version of the flow must be supplied.");
newVersion = getLatestVersion(client, existingVersionControlDTO); if (newVersion.intValue() == existingVersionControlDTO.getVersion().intValue()) { throw new NiFiClientException("Process group already at latest version");
public static Builder fromDto(VersionControlInformationDTO dto) { Builder builder = new Builder(); builder.registryId(dto.getRegistryId()) .registryName(dto.getRegistryName()) .bucketId(dto.getBucketId()) .bucketName(dto.getBucketName()) .flowId(dto.getFlowId()) .flowName(dto.getFlowName()) .flowDescription(dto.getFlowDescription()) .status(new VersionedFlowStatus() { @Override public VersionedFlowState getState() { return VersionedFlowState.valueOf(dto.getState()); } @Override public String getStateExplanation() { return dto.getStateExplanation(); } }) .version(dto.getVersion()); return builder; }
public VersionControlInformationDTO copy(final VersionControlInformationDTO original) { if (original == null) { return null; } final VersionControlInformationDTO copy = new VersionControlInformationDTO(); copy.setRegistryId(original.getRegistryId()); copy.setRegistryName(original.getRegistryName()); copy.setBucketId(original.getBucketId()); copy.setBucketName(original.getBucketName()); copy.setFlowId(original.getFlowId()); copy.setFlowName(original.getFlowName()); copy.setFlowDescription(original.getFlowDescription()); copy.setVersion(original.getVersion()); copy.setState(original.getState()); copy.setStateExplanation(original.getStateExplanation()); return copy; }