Class EntityPropertyEqualToCondition

java.lang.Object
com.atlassian.jira.plugin.webfragment.conditions.AbstractWebCondition
com.atlassian.jira.plugin.webfragment.conditions.EntityPropertyEqualToCondition
All Implemented Interfaces:
com.atlassian.plugin.web.api.baseconditions.BaseCondition, com.atlassian.plugin.web.Condition

@PublicApi public class EntityPropertyEqualToCondition extends AbstractWebCondition
Condition that checks for equality between the expected value and a property value for a given entity in the current context.

The condition performs an equals comparison on a property value of a primitive type with an expected value. For complex types the condition always evaluates to false. Required parameters:

  • entity - The type of entity that should be checked for comparison: issue, project, user, etc
  • property key - The key of the property that should be checked for this entity.
  • value - The JSON string representation that the entity property value will be checked against.

You may also pass in an 'objectName' parameter which is the '.' separated path to the value you wish to compare against in a large json object. For example, if you had the following value stored in an entity property:

     {
         "some": {
             "nested": {
                 "structure": true
             }
         },
         "unimportant": "data"
     }
 

If the 'objectName' was set to be 'some.nested.structure' then the 'value' object could be set to 'true' and this condition would be true; resulting in the web fragment being shown. Critically, the 'objectName' parameter will ignore all other data in the JSON stored value. In our example the 'unimportant' JSON field was ignored.

It is important to note that json fields that contain a '.' in their key cannot be referenced using 'objectName'. The 'objectName' parameter expects that the '.' characters are path separators. For example, the following objectName 'one.two' would refer to the json structure:

     {
         "one": {
             "two": true
         }
     }
 

But it would not work for the following JSON structure:

     {
         "one.two": true
     }
 

The first example will be found with 'objectName' whereas the second example will not.

The given entity must available in the JiraHelper context params.

Since:
7.0
  • Constructor Details

    • EntityPropertyEqualToCondition

      public EntityPropertyEqualToCondition(com.atlassian.plugin.PluginAccessor pluginAccessor)
  • Method Details