[GitHub] nifi-registry pull request #98: NIFIREG-135 Fix versionCount for createFlowV...

2018-03-09 Thread kevdoran
Github user kevdoran closed the pull request at:

https://github.com/apache/nifi-registry/pull/98


---


[GitHub] nifi-registry pull request #98: NIFIREG-135 Fix versionCount for createFlowV...

2018-02-01 Thread Chaffelson
Github user Chaffelson commented on a diff in the pull request:

https://github.com/apache/nifi-registry/pull/98#discussion_r165489168
  
--- 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 --

Sounds good.
Now if only I had a maven builder to Docker for NiFi-Registry...


---


[GitHub] nifi-registry pull request #98: NIFIREG-135 Fix versionCount for createFlowV...

2018-02-01 Thread kevdoran
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.


---


[GitHub] nifi-registry pull request #98: NIFIREG-135 Fix versionCount for createFlowV...

2018-02-01 Thread kevdoran
GitHub user kevdoran opened a pull request:

https://github.com/apache/nifi-registry/pull/98

NIFIREG-135 Fix versionCount for createFlowVersion result



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/kevdoran/nifi-registry NIFIREG-135

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/nifi-registry/pull/98.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #98


commit 9a399d4c36f641337e2002700e970b9fc136cb45
Author: Kevin Doran 
Date:   2018-02-01T21:00:20Z

NIFIREG-135 Fix versionCount for createFlowVersion result




---