public static void updateFlowState(final VersionControlInformationDTO clientDto, final VersionControlInformationDTO dto) { final VersionedFlowState clientState = VersionedFlowState.valueOf(clientDto.getState()); if (clientState == VersionedFlowState.SYNC_FAILURE) { return; final VersionedFlowState dtoState = VersionedFlowState.valueOf(dto.getState()); if (dtoState == VersionedFlowState.SYNC_FAILURE) { clientDto.setState(dto.getState()); clientDto.setState(flowState.name()); clientDto.setStateExplanation(flowState.getDescription());
@Override public VersionedFlowStatus getStatus() { // If current state is a sync failure, then final String syncFailureExplanation = versionControlFields.getSyncFailureExplanation(); if (syncFailureExplanation != null) { return new StandardVersionedFlowStatus(VersionedFlowState.SYNC_FAILURE, syncFailureExplanation); } final boolean modified = isModified(); if (!modified) { final VersionControlInformation vci = StandardProcessGroup.this.versionControlInfo.get(); if (vci.getFlowSnapshot() == null) { return new StandardVersionedFlowStatus(VersionedFlowState.SYNC_FAILURE, "Process Group has not yet been synchronized with Flow Registry"); } } final boolean stale = versionControlFields.isStale(); final VersionedFlowState flowState; if (modified && stale) { flowState = VersionedFlowState.LOCALLY_MODIFIED_AND_STALE; } else if (modified) { flowState = VersionedFlowState.LOCALLY_MODIFIED; } else if (stale) { flowState = VersionedFlowState.STALE; } else { flowState = VersionedFlowState.UP_TO_DATE; } return new StandardVersionedFlowStatus(flowState, flowState.getDescription()); } };
@Override public VersionedFlowState getState() { return VersionedFlowState.valueOf(dto.getState()); }
if (VersionedFlowState.SYNC_FAILURE.equals(toMerge.getVersionedFlowState())) { target.setVersionedFlowState(VersionedFlowState.SYNC_FAILURE);
versionControlInfoDto.setState(flowState.name());
.version(version) .flowSnapshot(proposed) .status(new StandardVersionedFlowStatus(flowState, flowState.getDescription())) .build();
versionControlInfo.setState(flowState.name());
vci.setRegistryName(getFlowRegistryName(registryId)); vci.setVersion(registeredSnapshot.getSnapshotMetadata().getVersion()); vci.setState(VersionedFlowState.UP_TO_DATE.name());
public VersionControlInformationDTO createVersionControlInformationDto(final ProcessGroup group) { if (group == null) { return null; } final VersionControlInformation versionControlInfo = group.getVersionControlInformation(); if (versionControlInfo == null) { return null; } final VersionControlInformationDTO dto = new VersionControlInformationDTO(); dto.setGroupId(group.getIdentifier()); dto.setRegistryId(versionControlInfo.getRegistryIdentifier()); dto.setRegistryName(versionControlInfo.getRegistryName()); dto.setBucketId(versionControlInfo.getBucketIdentifier()); dto.setBucketName(versionControlInfo.getBucketName()); dto.setFlowId(versionControlInfo.getFlowIdentifier()); dto.setFlowName(versionControlInfo.getFlowName()); dto.setFlowDescription(versionControlInfo.getFlowDescription()); dto.setVersion(versionControlInfo.getVersion()); final VersionedFlowStatus status = versionControlInfo.getStatus(); final VersionedFlowState state = status.getState(); dto.setState(state == null ? null : state.name()); dto.setStateExplanation(status.getStateExplanation()); return dto; }
final String registryName = flowRegistry == null ? versionControlInfoDto.getRegistryId() : flowRegistry.getName(); versionControlInfoDto.setState(VersionedFlowState.SYNC_FAILURE.name()); versionControlInfoDto.setStateExplanation("Process Group has not yet been synchronized with the Flow Registry"); final StandardVersionControlInformation versionControlInformation = StandardVersionControlInformation.Builder.fromDto(versionControlInfoDto)
snapshot.setVersionedFlowState(processGroupStatus.getVersionedFlowState().name());