You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2021/01/21 23:31:49 UTC

[GitHub] [nifi] arkadiyvleonov opened a new pull request #4776: Add "Mailbox" property to ConsumeEWS

arkadiyvleonov opened a new pull request #4776:
URL: https://github.com/apache/nifi/pull/4776


   Thank you for submitting a contribution to Apache NiFi.
   
   Please provide a short description of the PR here:
   
   #### Description of PR
   
   Sometimes I need to consume EWS mailbox by service account that has access to multiple mailboxes.
   for example user "svc_ews_consumer@example.com" has access to two mailboxes MB1@example.com and MB2@example.com
   
   Maybe my code is not so good but I build it and it works for me. 
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] patricker commented on a change in pull request #4776: Add "Mailbox" property to ConsumeEWS

Posted by GitBox <gi...@apache.org>.
patricker commented on a change in pull request #4776:
URL: https://github.com/apache/nifi/pull/4776#discussion_r562273064



##########
File path: nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/main/java/org/apache/nifi/processors/email/ConsumeEWS.java
##########
@@ -107,6 +109,14 @@
             .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
             .sensitive(true)
             .build();
+    public static final PropertyDescriptor MAILBOX = new PropertyDescriptor.Builder()
+            .name("mailbox")
+            .displayName("Mailbox")
+            .description("Mailbox")
+            .required(true)

Review comment:
       If your going to make MAILBOX required, then you'll need to include a default value so that it doesn't break existing users.  Or make it not required, and adjust the code so that it works the way it used to if no MAILBOX is provided.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] github-actions[bot] commented on pull request #4776: Add "Mailbox" property to ConsumeEWS

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #4776:
URL: https://github.com/apache/nifi/pull/4776#issuecomment-846479420


   We're marking this PR as stale due to lack of updates in the past few months. If after another couple of weeks the stale label has not been removed this PR will be closed. This stale marker and eventual auto close does not indicate a judgement of the PR just lack of reviewer bandwidth and helps us keep the PR queue more manageable.  If you would like this PR re-opened you can do so and a committer can remove the stale tag.  Or you can open a new PR.  Try to help review other PRs to increase PR review bandwidth which in turn helps yours.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] patricker commented on a change in pull request #4776: Add "Mailbox" property to ConsumeEWS

Posted by GitBox <gi...@apache.org>.
patricker commented on a change in pull request #4776:
URL: https://github.com/apache/nifi/pull/4776#discussion_r562273064



##########
File path: nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/main/java/org/apache/nifi/processors/email/ConsumeEWS.java
##########
@@ -107,6 +109,14 @@
             .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
             .sensitive(true)
             .build();
+    public static final PropertyDescriptor MAILBOX = new PropertyDescriptor.Builder()
+            .name("mailbox")
+            .displayName("Mailbox")
+            .description("Mailbox")
+            .required(true)

Review comment:
       If your going to make MAILBOX required, then you'll need to include a default value so that it doesn't break existing users.  Or make it not required, and adjust the code so that it works the way it used to if no MAILBOX is provided.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] patricker commented on a change in pull request #4776: Add "Mailbox" property to ConsumeEWS

Posted by GitBox <gi...@apache.org>.
patricker commented on a change in pull request #4776:
URL: https://github.com/apache/nifi/pull/4776#discussion_r562966351



##########
File path: nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/main/java/org/apache/nifi/processors/email/ConsumeEWS.java
##########
@@ -343,7 +354,7 @@ protected void fillMessageQueueIfNecessary(ProcessContext context) throws Proces
 
             try {
                 //Get Folder
-                Folder folder = getFolder(service);
+                Folder folder = getFolder(service, context);

Review comment:
       I'd suggest moving `String MailboxProperty = context.getProperty(MAILBOX).getValue();` up here, and passing in the MAILBOX as an optional parameter to `getFolder`. Then you can keep `getFolder` as an Exchange only method.

##########
File path: nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/main/java/org/apache/nifi/processors/email/ConsumeEWS.java
##########
@@ -376,11 +387,22 @@ protected void fillMessageQueueIfNecessary(ProcessContext context) throws Proces
         }
     }
 
-    protected Folder getFolder(ExchangeService service) {
+    protected Folder getFolder(ExchangeService service, ProcessContext context) {
         Folder folder;
+        String MailboxProperty = context.getProperty(MAILBOX).getValue();
         if(folderName.equals("INBOX")){
             try {
-                folder = Folder.bind(service, WellKnownFolderName.Inbox);
+                if (!StringUtils.isEmpty(MailboxProperty))
+                    {
+                        Mailbox mailbox = new Mailbox(MailboxProperty);
+                        FolderId InboxFolderId = new FolderId(WellKnownFolderName.Inbox, mailbox);

Review comment:
       But now MAILBOX only works if the folder is the INBOX right? This would stop you from accessing any folder in a different mailbox except the INBOX.

##########
File path: nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/main/java/org/apache/nifi/processors/email/ConsumeEWS.java
##########
@@ -107,6 +109,14 @@
             .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
             .sensitive(true)
             .build();
+    public static final PropertyDescriptor MAILBOX = new PropertyDescriptor.Builder()
+            .name("mailbox")
+            .displayName("Mailbox")
+            .description("Mailbox")
+            .required(false)

Review comment:
       I would add a default value just to make sure querying this property at least returns an empty string:
   `.defaultValue("")` is used in other properties for this reason already.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] arkadiyvleonov commented on a change in pull request #4776: Add "Mailbox" property to ConsumeEWS

Posted by GitBox <gi...@apache.org>.
arkadiyvleonov commented on a change in pull request #4776:
URL: https://github.com/apache/nifi/pull/4776#discussion_r562370297



##########
File path: nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/main/java/org/apache/nifi/processors/email/ConsumeEWS.java
##########
@@ -107,6 +109,14 @@
             .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
             .sensitive(true)
             .build();
+    public static final PropertyDescriptor MAILBOX = new PropertyDescriptor.Builder()
+            .name("mailbox")
+            .displayName("Mailbox")
+            .description("Mailbox")
+            .required(true)

Review comment:
       made some changes to in below commits

##########
File path: nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/main/java/org/apache/nifi/processors/email/ConsumeEWS.java
##########
@@ -107,6 +109,14 @@
             .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
             .sensitive(true)
             .build();
+    public static final PropertyDescriptor MAILBOX = new PropertyDescriptor.Builder()
+            .name("mailbox")
+            .displayName("Mailbox")
+            .description("Mailbox")
+            .required(true)

Review comment:
       made some changes in below commits




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] github-actions[bot] closed pull request #4776: Add "Mailbox" property to ConsumeEWS

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed pull request #4776:
URL: https://github.com/apache/nifi/pull/4776


   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] arkadiyvleonov commented on a change in pull request #4776: Add "Mailbox" property to ConsumeEWS

Posted by GitBox <gi...@apache.org>.
arkadiyvleonov commented on a change in pull request #4776:
URL: https://github.com/apache/nifi/pull/4776#discussion_r562370297



##########
File path: nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/main/java/org/apache/nifi/processors/email/ConsumeEWS.java
##########
@@ -107,6 +109,14 @@
             .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
             .sensitive(true)
             .build();
+    public static final PropertyDescriptor MAILBOX = new PropertyDescriptor.Builder()
+            .name("mailbox")
+            .displayName("Mailbox")
+            .description("Mailbox")
+            .required(true)

Review comment:
       made some changes in below commits




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] arkadiyvleonov commented on a change in pull request #4776: Add "Mailbox" property to ConsumeEWS

Posted by GitBox <gi...@apache.org>.
arkadiyvleonov commented on a change in pull request #4776:
URL: https://github.com/apache/nifi/pull/4776#discussion_r562370297



##########
File path: nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/main/java/org/apache/nifi/processors/email/ConsumeEWS.java
##########
@@ -107,6 +109,14 @@
             .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
             .sensitive(true)
             .build();
+    public static final PropertyDescriptor MAILBOX = new PropertyDescriptor.Builder()
+            .name("mailbox")
+            .displayName("Mailbox")
+            .description("Mailbox")
+            .required(true)

Review comment:
       made some changes to in below commits




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org