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

Getvalue of custom UI attribute

Hi,

i don't know how to get value from custom attributes using the getCustomAttributes() method: i've many custom attribute on my UI and when i'll submit the form ( a typical task item type with other custom fields ) i need to get the value. I tried with


List<IAttributeHandle> attributes = newState.getCustomAttributes();

for (IAttributeHandle iah : attributes){
Object obj = ((IAttribute)iah.getOrigin()).getValue(null, newState, monitor);

}


but when i run the code i get a NullPointerException

How can i solve ?

Thx.

0 votes



4 answers

Permanent link
well, getValue() requires a non-null first parameter

Object com.ibm.team.workitem.common.model.IAttribute.getValue(IAuditableCommon auditableCommon, IWorkItem workItem, IProgressMonitor monitor) throws TeamRepositoryException
Returns the current -- calculated -- value of this attribute.

Parameters:
auditableCommon the common auditable library
workItem
monitor a progress monitor or null
------------------------------------------------------------
The auditable library provides access to IAuditables as an interface available on both the client and the server. On the client it can be obtained as a client library, on the server as a service.

================

Sam

0 votes


Permanent link
ok, so if i've to get attributes value ( server-side ) i need another method. There's something that can help me on the wiki ? I tried to find some docs but seems nothing found to solve.

Thanks

0 votes


Permanent link
I think you are building an advisor or particpant.

If you are, then the AuditableCommon object is provided as part of the parameters to your advisor code.. (took me a while to find it too)



IAuditableCommon iac = ((ISaveParameter) data).getSaveOperationParameter().getAuditableCommon();


Sam

0 votes


Permanent link
I think you are building an advisor or particpant.

If you are, then the AuditableCommon object is provided as part of the parameters to your advisor code.. (took me a while to find it too)



IAuditableCommon iac = ((ISaveParameter) data).getSaveOperationParameter().getAuditableCommon();


Sam



Please let me know what should this 'data' to be initialises?
thanks
Sundar

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,926

Question asked: Jan 10 '12, 10:40 a.m.

Question was seen: 5,500 times

Last updated: Jan 10 '12, 10:40 a.m.

Confirmation Cancel Confirm