Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Lyo » How to set "priority" for my work item with OSLC?
How to set "priority" for my work item with OSLC? [message #1060286] Thu, 23 May 2013 21:28 Go to next message
pietro marella is currently offline pietro marella
Messages: 2
Registered: May 2013
Junior Member
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" '="">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='https:/x.xx.xx.xx:9443/ccm/oslc/enumerations/_ryl8MLbfEeK8JbTtKcHtwA/priority/priority.literal.l02)

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.
Re: How to set "priority" for my work item with OSLC? [message #1060456 is a reply to message #1060286] Fri, 24 May 2013 18:40 Go to previous messageGo to next message
Michael Fiedler is currently offline Michael Fiedler
Messages: 12
Registered: September 2012
Junior Member
This is being discussed in the lyo-dev workgroup.

See: http://dev.eclipse.org/mhonarc/lists/lyo-dev/msg00369.html


Regards,
Mike
Re: How to set "priority" for my work item with OSLC? [message #1060467 is a reply to message #1060456] Fri, 24 May 2013 21:02 Go to previous message
pietro marella is currently offline pietro marella
Messages: 2
Registered: May 2013
Junior Member
Thank you Mike

"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)
"

I would learn both ways, starting from the latter.
Could you point me to some samples for both solutions?

Thanks in advance and for your patience
Piero M.
Previous Topic:How do I translate the values returned from the ServiceCatalog?
Next Topic:How to serialize the RDF type for resource annotated properties ?
Goto Forum:
  


Current Time: Sat Oct 25 05:51:06 GMT 2014

Powered by FUDForum. Page generated in 0.28052 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software