Why is ModelVersion passed in the upgrade() method of an ActiveObjectsUpgradeTask?

Gabor Nagy _Midori_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 24, 2016

When creating Active Objects upgrade tasks, there is a ModelVersion parameter accessible in the upgrade() method:

public void upgrade(ModelVersion currentVersion, ActiveObjects ao) {
...
}

Is it useful in any real-world scenario? I checked several source code samples but none of them is using that.

See examples here: https://bitbucket.org/marioct/jira-bitbucket-connector/src/2cc7568b09d312c4b985d8c9563868295d753092/jira-dvcs-connector-plugin/src/main/java/com/atlassian/jira/plugins/dvcs/activeobjects/v3/?at=default

JavaDoc: https://developer.atlassian.com/static/javadoc/activeobjects/0.17.2/reference/com/atlassian/activeobjects/external/ActiveObjectsUpgradeTask.html#upgrade(com.atlassian.activeobjects.external.ModelVersion, com.atlassian.activeobjects.external.ActiveObjects) 

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Andreas Ebert
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 28, 2016

I have not used it myself (apart from logging), but I guess it could be used to know which version the existing data has, and to use that information to decide how it should be upgraded.

Midori
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 28, 2016

Yep, trivially yes, but that sounds redundant.

Here is why we feel that way: if you initially have model "1", then "2", then "3". You have to have two separate upgrade tasks in this case, one "1"->"2" and one "2"->"3". Now, let's say now you're upgrading to "3". If you are on "1", it is the ActiveObject framework that guarantees that both task will be invoked and they will be called in the guaranteed order. So, the parameter is useless for this use case, too.

So, it wouldn't explain the need for that param.

TAGS
AUG Leaders

Atlassian Community Events