private void verifyNoDescendantsWithLocalModifications(final String action) { for (final ProcessGroup descendant : findAllProcessGroups()) { final VersionControlInformation descendantVci = descendant.getVersionControlInformation(); if (descendantVci != null) { final VersionedFlowState flowState = descendantVci.getStatus().getState(); final boolean modified = flowState == VersionedFlowState.LOCALLY_MODIFIED || flowState == VersionedFlowState.LOCALLY_MODIFIED_AND_STALE; if (modified) { throw new IllegalStateException("Process Group cannot " + action + " because it contains a child or descendant Process Group that is under Version Control and " + "has local modifications. Each descendant Process Group that is under Version Control must first be reverted or have its changes pushed to the Flow Registry before " + "this action can be performed on the parent Process Group."); } if (flowState == VersionedFlowState.SYNC_FAILURE) { throw new IllegalStateException("Process Group cannot " + action + " because it contains a child or descendant Process Group that is under Version Control and " + "is not synchronized with the Flow Registry. Each descendant Process Group must first be synchronized with the Flow Registry before this action can be " + "performed on the parent Process Group. NiFi will continue to attempt to communicate with the Flow Registry periodically in the background."); } } } } }
final VersionedFlowState flowState = versionControlInfo.getStatus().getState(); final boolean modified = flowState == VersionedFlowState.LOCALLY_MODIFIED || flowState == VersionedFlowState.LOCALLY_MODIFIED_AND_STALE;
switch (vci.getStatus().getState()) { case LOCALLY_MODIFIED: locallyModified++;
versionControlInformation.getVersion(), stripContentsFromRemoteDescendantGroups(versionControlInformation.getFlowSnapshot(), true), versionControlInformation.getStatus()) { svci.setFlowDescription(versionControlInformation.getFlowDescription()); final VersionedFlowState flowState = versionControlInformation.getStatus().getState(); versionControlFields.setStale(flowState == VersionedFlowState.STALE || flowState == VersionedFlowState.LOCALLY_MODIFIED_AND_STALE); versionControlFields.setLocallyModified(flowState == VersionedFlowState.LOCALLY_MODIFIED || flowState == VersionedFlowState.LOCALLY_MODIFIED_AND_STALE);
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; }