It's all about the answers!

Ask a question

How to get Work Item found in attribute value?

pugazhenthi samidurai (26423942) | asked Aug 10 '12, 7:11 a.m.
retagged Aug 13 '12, 7:37 p.m. by Nhi P Ta (18841018)

i want to read the value of found in attribute.

I have followed this link but still it return null value?

Any Solution?


Pugazh S

Accepted answer

permanent link
Ralph Schoon (63.2k33646) | answered Aug 13 '12, 5:58 a.m.
Without any code from you it is impossible to find out what you are doing wrong. I can get the Found in attribute in my code. It should look like:

        int id = new Integer(idString).intValue();

        IWorkItem workItem = workItemClient.findWorkItemById(id,
                IWorkItem.SMALL_PROFILE, null);
        IAttribute foundIn = workItemClient.findAttribute(projectArea,
                IWorkItem.FOUND_IN_PROPERTY, null);
        if (workItem.hasAttribute(foundIn)){
            IDeliverableHandle foundInValueHandle = (IDeliverableHandle) workItem.getValue(foundIn);
            IDeliverable foundInValue = (IDeliverable)teamRepository.itemManager().fetchCompleteItem(foundInValueHandle, IItemManager.REFRESH, null);
            System.out.println("Found In "+ foundInValue.getName() );
        System.out.println("Accessed work item: " + workItem.getId() + ".");

pugazhenthi samidurai selected this answer as the correct answer

4 other answers

permanent link
Tom Malnar (23137) | answered Oct 16 '12, 11:51 a.m.
edited Oct 16 '12, 11:53 a.m.

Fill in your own server, port and workitem number.

Michael Taylor commented Jun 27 '13, 1:27 p.m.

When I try https://server_port/ccm/oslc/workitems/workitem_number.xml? I get page cannot be displayed.

When I try s://server_port/ccm/oslc/workitems/ or s://server_port/ccm/oslc/ I get The requested resource () is not available.

Do I need to do something to turn on OSLC services or should it be on by default?  I experimenting with the standard Windows 7 RTC download.

permanent link
Tom Malnar (23137) | answered Jun 27 '13, 2:35 p.m.
 Did you change server, port and workitem number to real names on your network?   For instance if your jazz server was named myserver and its IP   Its port 9443.   A valid workitem was 502, then the following lines would work for you:



Tom Malnar commented Jun 27 '13, 2:37 p.m.

 Also if you just put, 

You will get all the properties.

Michael Taylor commented Jun 27 '13, 2:53 p.m.

That works!  Thanks.  I'm new to OSLC so I didn't realize you could post the work item number.xml to get it to work.

The first statement didn't list the actual foundIn value.  But the 502.xml displaying all properties did.  I need to figure out how to list the value of a property.

I've spent a fair amount of time using the Reportable REST API to extract work item information I need for another application.  (For example, list certain fields - including some parent and child values - for all work items in a particular project, state, and planned for.) 

How would using OSLC for that compare to using the Reportable REST API?  Is there a clear advantage to one over the other?

Here is what I am doing with REST:

   (I'll list it in the next comment:)

Michael Taylor commented Jun 27 '13, 2:55 p.m. | edited Jun 27 '13, 2:56 p.m.

Michael Taylor commented Jun 27 '13, 2:57 p.m.

<server>:<port>/ ccm/rpt/repository/workitem?fields=workitem/workItem[projectArea/name='MiCSES 2' and (state/id=53 or state/id=2 or state/id=51 or state/id=5)]/(children[type/id='source_code_ci_-_micses']/(id|stringExtensions[key='MICSES_Source_File_CI_Name']/value|bigDecimalExtensions[key='MICSES_Source_file_CI_Version_dec']/value|parent/(id|state/name|target/name)))

permanent link
Tom Malnar (23137) | answered Jun 27 '13, 3:01 p.m.
 Sorry I haven't done alot of REST API.   For some local scripting I needed, I used python, did the authentication, then fetched the XML.  Using python libs for XML I was able to retrieve any field I needed.  

permanent link
Bruno Fazoli (856) | answered Jun 19 '15, 9:15 p.m.
Hi Ralph Schoon

I get the error while running your code:

 com.sun.proxy.$Proxy26 cannot be cast to

Could you help?

Ralph Schoon commented Jun 21 '15, 11:12 a.m.
  1. Don't post new questions on questions that are already answered and accepted
  2. Create a new question
  3. Create a question, that has actually data that others could work on

Ralph Schoon commented Jun 22 '15, 4:39 a.m.

 You obviously try to cast something to something, that can't be casted that way. 

Debug your code and use the instanceof operation to ensure you can indeed cast the object to what you want to cast it to.

Bruno Fazoli commented Jun 22 '15, 7:49 a.m.

Hi Ralph

I could identify the error. Actually I was not able to use IDeliverable, instead I used  Deliverable Class (without "I") and I could retrieve foundIn attribute. Check my code:

IAttribute attribute = workItemClient.findAttribute(projectAreaHandle,identifier, iProgressMonitor);
Object value = workItem.getValue(attribute);

if (value instanceof IDeliverableHandle){
    IDeliverableHandle foundInValueHandle = (IDeliverableHandle) workItem.getValue(attribute);
    Deliverable foundInValue = (Deliverable)teamRepository.itemManager().fetchCompleteItem(foundInValueHandle, IItemManager.REFRESH, null);

Thank you!

Ralph Schoon commented Jun 22 '15, 8:01 a.m.

Looks good.

Your answer

Register or 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.