How to retire a lifecycle asset using java api?
I have a lifecycle asset which is in the approved state.
In order to retire it using the java api i used the actions available on the asset. After setting the action as retire it goes to the pre retired state,so i tried setting the same action again but that did not make any difference. Code snippet used : for (RAMAction action : actions) { if (action.getName() != null && RAMConfig.RETIRE_ACTION.equalsIgnoreCase(action .getName())) { asset.setAction(action); session.put(asset, new RAMStatusMonitor()); asset.setAction(action); session.put(asset, new RAMStatusMonitor()); } } Could you please tell me if this is not correct? |
2 answers
RAMAction.RETIRE and RAMAction.Archive are only valid for legacy assets. These do not work on lifecycle assets.
For lifecycle assets you have to use available actions. But after every put of an asset you need to get the available actions again since the set of available actions is different for every state of the asset. When you move into a new state, such as pre-retire there is a new set of available actions that you must use. The old set is now invalid. |
Typically this is the way you do it:
RAMSession session = null; Note also that there is a defect around driving a retire from API: Java API to retire an asset (drive the Retire action) will not work properly (79583) Check your ramDebug.log for exception ... if you get one when you drive this API and require this fix. Contact IBM's service and support. Comments
Manjiri Kamat
commented Jan 30 '13, 10:44 p.m.
Hi Gill,
Rich Kulp
commented Jan 31 '13, 9:43 a.m.
| edited Jan 31 '13, 5:02 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
There is a bug in the Retire didn't work for lifecycle assets. It threw an exception on the host.
Manjiri Kamat
commented Feb 01 '13, 1:44 a.m.
Can you tell me what exception i should look for?
Drive the retire action, and to to the Administrator -> tools, and click on the ramDebug.log ... scroll down to the bottom. See if you have a new "present" for ya.
Manjiri Kamat
commented Feb 03 '13, 11:19 p.m.
There was no such thing in the logs after driving the retire action.
If you have no exceptions in the log after driving the action, and asset indeed moves to the retire state; you are fine.
Manjiri Kamat
commented Feb 06 '13, 12:12 a.m.
Thanks Gili.
showing 5 of 7
show 2 more comments
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.
Comments
I just tried using RAMAction.RETIRE followed by RAMAction.Archive for the asset it did set the asset to retired.
I believe we should use this for a lifecycle asset and use the available action of the asset only when the asset is in pre retired to set it to retired.
Do let me know if my understanding is correct?