Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Not able to set asset state to "approved" in iRAM

Hi
I am doing to set an asset status from draft to approved state.
When i am going to set the Approved state it showing an error message
Code snippet:
                    RAMAsset ramAsset =(RAMAsset)assets[k].getAsset();
                    String currState = ramAsset.getStateName().trim();
                    if(currState != null && currState.equalsIgnoreCase("Draft"))
                    {
                        String assetId = ramAsset.getGUID();
                        RAMAction  ramActions1 = ramAsset.getAction();
                        if(true)
                        {
                            for (int j =0;j<1;j++)
                            {   
                            ramAsset.setStateName("Approved");                                                           
                                 System.out.println("Asset Id: "+ assetId+" Asset Name: "+ramAsset.getName());




Error message showing when it going to setStateName

Number of Draft Assets: 1525
com.ibm.ram.common.data.exception.RAMRuntimeException: The asset state can only be set by the server.
    at com.ibm.ram.client.RAMAsset.setState(RAMAsset.java:4542)
    at Catgory.CategorizeApprove.main(CategorizeApprove.java:124)



So can any please help me out to so that i can approve the assets .

0 votes



One answer

Permanent link
You can't directly set state. You must use the appropriate action to move to another state. Each state has a set of available actions, and each action then takes the asset to a different state.

See in the documentation for RAMAsset
There is getAvailableActions() to see what actions are available, and setAction() to set the action to perform when you send the asset for updating to the host.

0 votes

Your answer

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: Jan 31 '14, 6:28 a.m.

Question was seen: 4,621 times

Last updated: Jan 31 '14, 9:38 a.m.

Confirmation Cancel Confirm