cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
370
Views
0
Helpful
2
Replies

applyTransParams question

sm000x
Level 1
Level 1

Hi,

Maapi.commitQueueResult is deprecated and we should use applyTransParams.
I need help on how to use applyTransParams.

I have the following code:
CommitParams cp = new CommitParams();
cp.setCommitQueueSync();
cp.setNoOverwrite();

CommitQueueResult result = (CommitQueueResult)maapi.applyTransParams(th, false, cp);

For service create and delete, the code works fine.
However, when I do a change on the service with zero-delta (which means no change at all), I got the following error:
com.tailf.maapi.ApplyResult cannot be cast to com.tailf.maapi.CommitQueueResult

I have to use the deprecated Maapi.commitQueueResult, which works fine.

Does anyone have the same issue?

THX
sm000x

1 Accepted Solution

Accepted Solutions

hazad
Cisco Employee
Cisco Employee

The applyTransParams() method returns a CommitQueueResult object only if a commit through the commit queue was requested:
https://pubhub.devnetcloud.com/media/nso-api-6.2/docs/java/com/tailf/maapi/Maapi.html#applyTransParams(int,boolean,com.tailf.maapi.CommitParams)

In your case you get an ApplyResult object returned, since the zero-delta commit is not applying anything to the queue. So you would need to verify that the object returned by applyTransParams is an instance of CommitQueueResult, before casting it.

View solution in original post

2 Replies 2

hazad
Cisco Employee
Cisco Employee

The applyTransParams() method returns a CommitQueueResult object only if a commit through the commit queue was requested:
https://pubhub.devnetcloud.com/media/nso-api-6.2/docs/java/com/tailf/maapi/Maapi.html#applyTransParams(int,boolean,com.tailf.maapi.CommitParams)

In your case you get an ApplyResult object returned, since the zero-delta commit is not applying anything to the queue. So you would need to verify that the object returned by applyTransParams is an instance of CommitQueueResult, before casting it.

Hi, Hazad:

Thank you so much. This is really helpful.

THX

sm000x