exceptionfactory commented on code in PR #9753:
URL: https://github.com/apache/nifi/pull/9753#discussion_r1976465006


##########
nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/drive/ListGoogleDrive.java:
##########
@@ -197,7 +266,37 @@ public void onScheduled(final ProcessContext context) 
throws IOException {
 
         HttpTransport httpTransport = new 
ProxyAwareTransportFactory(proxyConfiguration).create();
 
-        driveService = createDriveService(context, httpTransport, 
DriveScopes.DRIVE_METADATA_READONLY);
+        driveService = createDriveService(context, httpTransport, 
DriveScopes.DRIVE, DriveScopes.DRIVE_METADATA_READONLY);
+    }
+
+    @OnScheduled
+    @Override
+    // initListedEntityTracker() needs to be overridden because the super 
implementation calls getRecordSchema()
+    // so recordSchema must be initialized before that
+    public void initListedEntityTracker(ProcessContext context) {
+        this.enrichAttributes = new ArrayList<>();
+
+        final List<RecordField> recordFields = new ArrayList<>();
+
+        Stream.of(
+                GoogleDriveFlowFileAttribute.ID,
+                GoogleDriveFlowFileAttribute.FILENAME,
+                GoogleDriveFlowFileAttribute.SIZE,
+                GoogleDriveFlowFileAttribute.SIZE_AVAILABLE,
+                GoogleDriveFlowFileAttribute.TIMESTAMP,
+                GoogleDriveFlowFileAttribute.CREATED_TIME,
+                GoogleDriveFlowFileAttribute.MODIFIED_TIME,
+                GoogleDriveFlowFileAttribute.MIME_TYPE
+        ).forEach(a -> recordFields.add(a.getRecordField()));

Review Comment:
   Creating a new `Stream` seems unnecessary, is it possible to simply 
iterative over these values, or if required, creating a static `List.of()`?



##########
nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/drive/ListGoogleDrive.java:
##########
@@ -150,6 +177,29 @@ public class ListGoogleDrive extends 
AbstractListProcessor<GoogleDriveFileInfo>
             .dependsOn(LISTING_STRATEGY, BY_ENTITIES)
             .build();
 
+    public static final PropertyDescriptor ENRICH_FILE_METADATA = new 
PropertyDescriptor.Builder()

Review Comment:
   Does this need to be a configurable property? It seems more straightforward 
to always include these available metadata properties, as opposed to optionally 
including them based on the property.



##########
nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/drive/ListGoogleDrive.java:
##########
@@ -197,7 +266,37 @@ public void onScheduled(final ProcessContext context) 
throws IOException {
 
         HttpTransport httpTransport = new 
ProxyAwareTransportFactory(proxyConfiguration).create();
 
-        driveService = createDriveService(context, httpTransport, 
DriveScopes.DRIVE_METADATA_READONLY);
+        driveService = createDriveService(context, httpTransport, 
DriveScopes.DRIVE, DriveScopes.DRIVE_METADATA_READONLY);
+    }
+
+    @OnScheduled
+    @Override
+    // initListedEntityTracker() needs to be overridden because the super 
implementation calls getRecordSchema()
+    // so recordSchema must be initialized before that

Review Comment:
   Method-level comments should follow Javadoc conventions, and be set before 
method annotations.



-- 
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]

Reply via email to