Using OSLC query parameters to request requirements in DOORS [message #1696428] |
Tue, 26 May 2015 12:41  |
Eclipse User |
|
|
|
Hello everybody,
I'm using Lyo 2.1, specifically the DoorsOauthSample.java. I'm trying to customize the default query adding the "oslc.select" parameter.
I use OslcQueryParameters class to set oslc.prefix and oslc.select as:
OslcQueryParameters queryParams = new OslcQueryParameters();
queryParams.setPrefix(oslcPrefix);
queryParams.setSelect("dcterms:title");
Once I submit the query, the result contains all properties (as i did not set oslc.select) and not only dcterms:title.
Is it normal this query result in Lyo?
|
|
|
Re: Using OSLC query parameters to request requirements in DOORS [message #1698122 is a reply to message #1696428] |
Thu, 11 June 2015 12:56   |
Eclipse User |
|
|
|
A colleague has confirmed that a oslc.select does definitely work with DOORS - eg:
https://win-8cogopo9d2y:8443/dwa/rm/oslc/query/urn:rational::1-55718b4938b21a1e-M-00000020?oslc.prefix=dcterms,oslc.select=dcterms:title
So, he asks if you can print the request URL and request headers coming out of Lyo, so we know the code is sending the request to the correct URL with correct parameters set.
He is going to test with Lyo when possible.
|
|
|
Re: Using OSLC query parameters to request requirements in DOORS [message #1699421 is a reply to message #1698122] |
Wed, 24 June 2015 08:53  |
Eclipse User |
|
|
|
Hello Duncan,
Thanks for you answer. The query sent by Lyo is the same. I found where the problem was. I am using DoorsOauthSample.java as guide for my code, so this example after returning the query result asks for the URL list of the result and then get the information asking again to the URL.
The good news is Lyo query result object (OslcQueryResult) has the method getMembers() which is an iterable object where you give the class type of the result members. Then, you get the information from response directly on the expected object.
For example, you build a query that returns the requirements of a DOORS module, but you only want to know its title. Suppose you get the query answer in reqRes which is a OslcQueryResult object. If the result is a list of requirements, then:
Iterator<Requirement> reqIt = reqRes.getMembers(Requirement.class)
.iterator();
while (reqIt.hasNext()) {
Requirement res = reqIt.next();
System.out.println(res.getTitle());
}
That's all!!!
|
|
|
Powered by
FUDForum. Page generated in 0.03638 seconds