Github user kevdoran commented on a diff in the pull request:

    https://github.com/apache/nifi-registry/pull/98#discussion_r165487223
  
    --- Diff: 
nifi-registry-framework/src/main/java/org/apache/nifi/registry/service/RegistryService.java
 ---
    @@ -589,8 +589,15 @@ public VersionedFlowSnapshot createFlowSnapshot(final 
VersionedFlowSnapshot flow
                 // update the modified date on the flow
                 metadataService.updateFlow(existingFlow);
     
    +            // get the updated flow, we need to use "with counts" here so 
we can return this is a part of the response
    +            final FlowEntity updatedFlow = 
metadataService.getFlowByIdWithSnapshotCounts(snapshotMetadata.getFlowIdentifier());
    +            if (updatedFlow == null) {
    +                throw new ResourceNotFoundException("Versioned flow does 
not exist for identifier " + snapshotMetadata.getFlowIdentifier());
    +            }
    +            final VersionedFlow updatedVersionedFlow = 
DataModelMapper.map(existingBucket, updatedFlow);
    +
    --- End diff --
    
    For the above block, I considered just modifying the in-scope versionedFlow 
object before returning, but thought it would be better (though more expensive) 
to just re-retrieve the flow, in case we add other fields to flow in the future 
that would be modified upon saving a new flow version.


---

Reply via email to