It's all about the answers!

Ask a question

How to read rtc work item's resource's attributes using lyo for java?


Tali Rabetti (111119) | asked Jul 26 '17, 8:34 a.m.

Hi,
I am using lyo in a java project, and I want to read the values of attributes which are resources (the work item includes the URI and I want to do a request on this URI and get other attributes. e.g. plannedFor attribute).
I tried to define a new class to hols the attributes I need but getEntity() return null:

        ClientResponse plannedForResponse = client.getResource(plannedFor.toString());
        plannedForAttribute plannedForAttr = plannedForResponse.getEntity(plannedForAttribute.class);

I saw similar question here:
https://jazz.net/forum/questions/216079/how-to-define-custom-resource-class-for-requirement-folder

it helped progress, but still I get the null.

I think I lack some knowledge to be able to do it properly. Is anyone aware of any tutorial or good example of how to do it?

Thanks!
Tali

Accepted answer


permanent link
Jim Amsden (24337) | answered Jul 27 '17, 11:36 a.m.

 Eclipse/Lyo, maven project oslc-java-samples (folder org.eclipse.lyo.client.java.sample) in The org.eclipse.lyo.client repo has a number of sample java client applications including RTCFormSample.java. Note that the simple resource classes in org.eclipse.lyo.client.oslc.resources may not have the extended Jazz properties. You can however use the Toolchain Modeler and Code Generator to generate a web application that supports extended properties on domain classes.

Ralph Schoon selected this answer as the correct answer

4 other answers



permanent link
Andrew Berezovskyi (762) | answered Jul 17 '19, 9:35 a.m.

Hello,


If anyone has better shapes for the RTC resources, we would be happy to review pull requests: https://github.com/eclipse/lyo.client/pulls

Cheers,
Andrew
(Eclipse Lyo project lead)


permanent link
Kenny Smith (302412) | answered Jul 26 '17, 3:26 p.m.

If you're using Lyo, you are coding Java. If you're coding Java, you should use the Team Concert client API. Lyo is a great API for accessing DOORs data, not for Team Concert. 


Ralph Schoon has an excellent site that details how to get started with the API. 

What API’s are Available for RTC and What Can You Extend?





Comments
Ralph Schoon commented Jul 27 '17, 5:21 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Lyo is for OSLC, so you sould be able to run it against RTC and I know others do.
The RTC Java API is richer and easier (for me) to find stuff.


permanent link
Donald Nong (14.4k314) | answered Jul 26 '17, 10:55 p.m.

It has been a long time since I last tested with Lyo. IIRC, you need to extend quite a few classes for this to happen. If you use the sample code, you will see that when you first parse the RDF/XML response to a  Java class, many attributes are lost since they are defined in the class. If you try to retrieve such attributes after that, you will get null value.


permanent link
Jim Amsden (24337) | answered Jul 17 '19, 9:51 a.m.

 The Java classes in eclipse/Lyo Java client that represent OSLC domain resources are intentionally simple and reflect what was defined in the OSLC 2.0 domain specifications. 


RTC (now EWM) provides a set of extensions to OSLC Change Management resources, and allows customers to further define their own data extensions. 

So there are no fixed ResourceShapes that specify a fixed structure for EWM change requests. Rather you should discover the shapes based on accessing the instanceShape property of any given work item to dynamically calculate its properties.

Your answer


Register or to post your answer.