You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by mattyb149 <gi...@git.apache.org> on 2016/12/15 18:13:44 UTC

[GitHub] nifi pull request #1333: NIFI-3206: Add ifElse function to Expression Langua...

GitHub user mattyb149 opened a pull request:

    https://github.com/apache/nifi/pull/1333

    NIFI-3206: Add ifElse function to Expression Language

    Thank you for submitting a contribution to Apache NiFi.
    
    In order to streamline the review of the contribution we ask you
    to ensure the following steps have been taken:
    
    ### For all changes:
    - [x] Is there a JIRA ticket associated with this PR? Is it referenced 
         in the commit message?
    
    - [x] Does your PR title start with NIFI-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
    
    - [x] Has your PR been rebased against the latest commit within the target branch (typically master)?
    
    - [x] Is your initial contribution a single, squashed commit?
    
    ### For code changes:
    - [x] Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder?
    - [x] Have you written or updated unit tests to verify your changes?
    - [x] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? 
    - [x] If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly?
    - [x] If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly?
    - [x] If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties?
    
    ### For documentation related changes:
    - [x] Have you ensured that format looks appropriate for the output in which it is rendered?
    
    ### Note:
    Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.
    


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

    $ git pull https://github.com/mattyb149/nifi NIFI-3206

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

    https://github.com/apache/nifi/pull/1333.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 #1333
    
----
commit baeeb8646850f65541a784f1a61ffd7502305aa1
Author: Matt Burgess <ma...@apache.org>
Date:   2016-12-15T18:12:55Z

    NIFI-3206: Add ifElse function to Expression Language

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1333: NIFI-3206: Add ifElse function to Expression Langua...

Posted by JPercivall <gi...@git.apache.org>.
Github user JPercivall commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1333#discussion_r92834377
  
    --- Diff: nifi-docs/src/main/asciidoc/expression-language-guide.adoc ---
    @@ -963,6 +963,36 @@ Expressions will provide the following results:
     	will return 0.
     
     
    +[.function]
    +=== ifElse
    +
    +*Description*: [.description]#Evaluates the first argument if the Subject evaluates to true, or the second argument
    +if the Subject evaluates to false.#
    +
    +*Subject Type*: [.subject]#Boolean#
    +
    +*Arguments*:
    +
    +	- [.argName]#_EvaluateIfTrue_# : [.argDesc]#The value to return if the Subject is true#
    +	- [.argName]#_EvaluateIfFalse_# : [.argDesc]#The value to return if the Subject is false#
    +
    +*Return Type*: [.returnType]#String#
    +
    +*Examples*: If the "filename" attribute has the value "a brand new filename.txt", the "nullFilename" attribute has
    +the value null, and the "bool" attribute has the value "true", then the following expressions will provide
    +the following results:
    +
    +
    +
    +.ifElse Examples
    +|===================================================================
    +| Expression | Value
    +| `${filename:ifElse('found', 'not_found')}` | `found`
    --- End diff --
    
    This expression will attempt to implicitly convert the String into a boolean. This may be confusing as the first example.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1333: NIFI-3206: Add ifElse function to Expression Langua...

Posted by JPercivall <gi...@git.apache.org>.
Github user JPercivall commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1333#discussion_r92838500
  
    --- Diff: nifi-docs/src/main/asciidoc/expression-language-guide.adoc ---
    @@ -963,6 +963,36 @@ Expressions will provide the following results:
     	will return 0.
     
     
    +[.function]
    --- End diff --
    
    Although it returns a String, I'm leaning more towards this being in the "Boolean Logic" sub-section. Thoughts?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1333: NIFI-3206: Add ifElse function to Expression Langua...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/nifi/pull/1333


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1333: NIFI-3206: Add ifElse function to Expression Langua...

Posted by JPercivall <gi...@git.apache.org>.
Github user JPercivall commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1333#discussion_r92842330
  
    --- Diff: nifi-docs/src/main/asciidoc/expression-language-guide.adoc ---
    @@ -963,6 +963,36 @@ Expressions will provide the following results:
     	will return 0.
     
     
    +[.function]
    +=== ifElse
    +
    +*Description*: [.description]#Evaluates the first argument if the Subject evaluates to true, or the second argument
    +if the Subject evaluates to false.#
    +
    +*Subject Type*: [.subject]#Boolean#
    +
    +*Arguments*:
    +
    +	- [.argName]#_EvaluateIfTrue_# : [.argDesc]#The value to return if the Subject is true#
    +	- [.argName]#_EvaluateIfFalse_# : [.argDesc]#The value to return if the Subject is false#
    +
    +*Return Type*: [.returnType]#String#
    +
    +*Examples*: If the "filename" attribute has the value "a brand new filename.txt", the "nullFilename" attribute has
    +the value null, and the "bool" attribute has the value "true", then the following expressions will provide
    +the following results:
    +
    +
    +
    +.ifElse Examples
    +|===================================================================
    +| Expression | Value
    +| `${filename:ifElse('found', 'not_found')}` | `found`
    --- End diff --
    
    Actually this will not return 'found' because when the String is converted to a boolean it is only true if it is equalsIgnoreCase to "true".


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi issue #1333: NIFI-3206: Add ifElse function to Expression Language

Posted by JPercivall <gi...@git.apache.org>.
Github user JPercivall commented on the issue:

    https://github.com/apache/nifi/pull/1333
  
    Reviewing


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi issue #1333: NIFI-3206: Add ifElse function to Expression Language

Posted by JPercivall <gi...@git.apache.org>.
Github user JPercivall commented on the issue:

    https://github.com/apache/nifi/pull/1333
  
    +1
    
    Visually verified code and did a contrib check build. In a standalone instance, I tested many different expressions using ifElse and all worked as expected. Thanks @mattyb149 I will merge it in.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---