cancel
Showing results for 
Search instead for 
Did you mean: 

Task Priority values

brianshowers
Champ in-the-making
Champ in-the-making
Is there a reason why the Java comments state that Task Priority is limited to the range of [0,100]?  As far as I can tell, it's only used for querying, and it looks like any integer value is supported from a persistence standpoint and query perspective.  I also looked for usages of Task.PRIORITY_MINIUM (sic) and Task.PRIORITY_MAXIMUM.  I was unable to find references to either of those values.

In fact, I wrote a quick test that saves values outside of that range, and the test appears to pass.
6 REPLIES 6

jbarrez
Star Contributor
Star Contributor
No, it is indeed not checked or anything. You can pass whatever you want.

brianshowers
Champ in-the-making
Champ in-the-making
Would you consider removing the doc references to the [0,100] range in the 5.12 release?  I'm a bit nervous about building functionality that explicitly violates the API contract.  If I start doing that, and some later Activiti release starts to enforce the [0,100] limit, I'll be the one who is out of compliance.  If the next version of Activiti will make support for arbitrary integer values explicit, I'll feel a lot better that I'm not coloring outside of the lines.  Smiley Happy

If you're ok with that, I'll open a Jira issue.

frederikherema1
Star Contributor
Star Contributor
The values are actually used:


public int getPriority() {
    String value = getValue().toString();
    if (i18nManager.getMessage(Messages.TASK_PRIORITY_LOW).equals(value)) {
      return Task.PRIORITY_MINIUM;
    } else if (i18nManager.getMessage(Messages.TASK_PRIORITY_MEDIUM).equals(value)) {
      return Task.PRIORITY_NORMAL;
    } else {
      return Task.PRIORITY_MAXIMUM;
    }
  }

There isn't any explicit reference in the docs stating that these are minimum and maximum values, but I can understand that it's confusing. I'll see whats the best way to resolve this confusement.

frederikherema1
Star Contributor
Star Contributor

brianshowers
Champ in-the-making
Champ in-the-making
Thanks for making the change!  I feel much better about using priority to store values from MIN_INT to MAX_INT now.  I had only looked in the engine module when I searched for references.  Sorry about that.

Note that you might also want to remove the reference to the [0,100] range from the javadoc on Task.getPriority() and Task.setPriority().

frederikherema1
Star Contributor
Star Contributor
Duely noted, will be fixed in 5.13 (too late for 5.12 now) -> http://jira.codehaus.org/browse/ACT-1594