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

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

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

0 votes


Accepted answer

Permanent link

 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

0 votes


4 other answers

Permanent link

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)

1 vote


Permanent link

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?




0 votes

Comments

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

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.

0 votes


Permanent link

 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.

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,965
× 25

Question asked: Jul 26 '17, 8:34 a.m.

Question was seen: 2,690 times

Last updated: Jul 17 '19, 10:14 a.m.

Confirmation Cancel Confirm