[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [lyo-dev] Fwd: How to set "priority" for my work item with OSLC?

Hi, There's currently no Java resource in OSLC4J to represent that RTC-specific Literal resource.   You could either

- create one that matches the predicates in Literal and have OSLC4J de-serialize to Java for you
- Use the OSLC client to do a get and don't de-serialize to java - just process the raw xml yourself (or with an RDF lib like Jena)

Regards,
Mike


On Fri, May 24, 2013 at 1:36 PM, Pietro Marella <pietro.marella@xxxxxxxxx> wrote:


---------- Forwarded message ----------
From: Pietro Marella <pietro.marella@xxxxxxxxx>
Date: 2013/5/24
Subject: How to set "priority" for my work item with OSLC?
To: lyo-dev@xxxxxxxxxxx


Hello
hope this is the right place where to post my question.
I wrote in the forum, but I didn't get an answer yet.
So if you can, I'll appreciate if you can spend some time to help me address this problem.
Thanks in advance.

"Hi all.
I'm new with OSLC. I started from using the package org.eclipse.lyo.client.oslc.samples (RTCFormSample.java in particular) provided with the Lyo prject and I have developed a class by myself that relies on the OSLC4J client libraries to create and query work items (changerequests) on my Rational Team Concert) server.

I need now to make a pass further.

One of the attributes I need to set when I create a WI is the Priority, that can assume a predefined set of values (in a drop down menu).
When I display the RDF of a Work Item:
GET https:/X.XX.XXX.XX:9443/ccm/oslc/contexts/_ryl8MLbfEeK8JbTtKcHtwA/workitem/330

Response:

<rdf:rdf>
.....
<oslc_cmx:priority rdf:resource="&lt;A href="">" '="">https:/x.xx.xx.xx:9443/ccm/oslc/enumerations/_ryl8MLbfEeK8JbTtKcHtwA/priority/priority.literal.l02"/>
</rdf:rdf>

as you can see, Priority is a "oslc_cmx" type of attribute and its value is an enumeration (href="">
So I did a GET from my REST Client on browser
(GET https:/X.XX.XXX.XX:9443/ccm/oslc/enumerations/_ryl8MLbfEeK8JbTtKcHtwA/priority)

and I get a response with all the "enumeration" available: this is an extract of the response, as for example:

<rdf:Description rdf:about="https:/X.XX.XXX.XX:9443/ccm/oslc/enumerations/_ryl8MLbfEeK8JbTtKcHtwA/priority/priority.literal.l11">
<rdf:type rdf:resource="http:/jazz.net/xmlns/prod/jazz/rtc/cm/1.0/Literal"/>
<rtc_cm:iconUrl rdf:resource="https:/X.XX.XXX.XX:9443/ccm/service/com.ibm.team.workitem.common.internal.model.IImageContentService/processattachment/_ryl8MLbfEeK8JbTtKcHtwA/enumeration/high.gif"/>
<dcterms:title rdf:datatype="http:/www.w3.org/2001/XMLSchema#string">High</dcterms:title>
<dcterms:identifier rdf:datatype="http:/www.w3.org/2001/XMLSchema#string">priority.literal.l11</dcterms:identifier>
</rdf:Description>

>From this response, I know that to set my WI Priority to "High" I need to write a code like this:

//create a ChangeRequest object
ChangeRequest wi = new ChangeRequest();

//create QNAME
QName OSLC_PRIORITY = new QName("http:/jazz.net/xmlns/prod/jazz/rtc/ext/1.0/", "http:/jazz.net/xmlns/prod/jazz/rtc/cm/1.0/Literal", "oslc_cmx");

private Map<QName, Object> properties = new HashMap<QName, Object>();

properties.put(OSLC_PRIORITY, "https:/X.XX.XXX.XX:9443/ccm/oslc/enumerations /_ryl8MLbfEeK8JbTtKcHtwA/priority/priority.literal.l11");

//set extended properties for the changerequest
wi.setExtendedProperties(properties)

//then create the WI
....................

This code works in some way, but of course, it is not fine.. I cannot use "hardcoded" values as I used in my sample.

What I need is to retrieve at runtime what are the valid pairs (value,URI) the attribute "priority" can assume. How should I do using the OSLC4J libraries? Is there any method I can use to simulate the execution of the GET I run on my browser, and to parse the response I should get back?

Hope I've not been too much confuse....

thanks in advance"
piero m.


_______________________________________________
lyo-dev mailing list
lyo-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/lyo-dev