exceptionfactory commented on code in PR #7604:
URL: https://github.com/apache/nifi/pull/7604#discussion_r1303493084
##########
nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/service/StandardServiceFacade.java:
##########
@@ -253,7 +253,7 @@ public VersionedFlow createFlow(final String
bucketIdentifier, final VersionedFl
}
final VersionedFlow createdFlow = createRevisableEntity(versionedFlow,
VERSIONED_FLOW_ENTITY_TYPE, currentUserIdentity(),
- () -> registryService.createFlow(bucketIdentifier,
versionedFlow));
+ () -> registryService.createFlow(bucketIdentifier,
versionedFlow,preserveSourceProperties));
Review Comment:
```suggestion
() -> registryService.createFlow(bucketIdentifier,
versionedFlow, preserveSourceProperties));
```
##########
nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/service/StandardServiceFacade.java:
##########
@@ -242,7 +242,7 @@ public List<BucketItem> getBucketItems() {
// ---------------------- Flow methods
----------------------------------------------
@Override
- public VersionedFlow createFlow(final String bucketIdentifier, final
VersionedFlow versionedFlow) {
+ public VersionedFlow createFlow(final String bucketIdentifier, final
VersionedFlow versionedFlow,final boolean preserveSourceProperties) {
Review Comment:
```suggestion
public VersionedFlow createFlow(final String bucketIdentifier, final
VersionedFlow versionedFlow, final boolean preserveSourceProperties) {
```
##########
nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketFlowResource.java:
##########
@@ -99,11 +99,15 @@ public Response createFlow(
@ApiParam("The bucket identifier")
final String bucketId,
@ApiParam(value = "The details of the flow to create.", required =
true)
- final VersionedFlow flow) {
+ final VersionedFlow flow,
+ @ApiParam(
+ value = "Whether source properties like identifier,name
createdTimestamp and modifiedTimestamp should be kept")
Review Comment:
```suggestion
value = "Whether source properties like identifier,
name, and created should be retained")
```
##########
nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketFlowResource.java:
##########
@@ -99,11 +99,15 @@ public Response createFlow(
@ApiParam("The bucket identifier")
final String bucketId,
@ApiParam(value = "The details of the flow to create.", required =
true)
- final VersionedFlow flow) {
+ final VersionedFlow flow,
+ @ApiParam(
+ value = "Whether source properties like identifier,name
createdTimestamp and modifiedTimestamp should be kept")
+ @QueryParam("preserveSourceProperties")
+ final boolean preserveSourceProperties) {
verifyPathParamsMatchBody(bucketId, flow);
- final VersionedFlow createdFlow = serviceFacade.createFlow(bucketId,
flow);
+ final VersionedFlow createdFlow = serviceFacade.createFlow(bucketId,
flow,preserveSourceProperties);
Review Comment:
```suggestion
final VersionedFlow createdFlow = serviceFacade.createFlow(bucketId,
flow, preserveSourceProperties);
```
##########
nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/service/RegistryService.java:
##########
@@ -339,10 +339,12 @@ public VersionedFlow createFlow(final String
bucketIdentifier, final VersionedFl
if (versionedFlow.getBucketIdentifier() == null) {
versionedFlow.setBucketIdentifier(bucketIdentifier);
}
+ if (!preserveSourceProperties || (versionedFlow.getCreatedTimestamp()
<= 0) || (versionedFlow.getModifiedTimestamp() <= 0)) {
Review Comment:
Actually this approach could be changed so that if the caller sets the
timestamps, then they will be preserved, instead of passing the
`preserveSourceProperties` argument to this service level. The checks should
also be limited to the created timestamp so that the modified timestamp is
always updated.
```suggestion
if (versionedFlow.getCreatedTimestamp()) {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]