It's all about the answers!

Ask a question

How to obtain a list of attributes for a given RTC work item type via OSLC?


Geoff Alexander (19623948) | asked Sep 18 '15, 11:09 a.m.
edited Sep 18 '15, 11:24 a.m.
I need to get the list of attributes, both built-in attributes and custom attributes, for a given RTC work item type via OSLC?  The jazz.net forum topic OSLC: Is it possible to access all attributes and their types for particular work item type? says that performing a GET on the rdf:resource for oslc:resourceShape from the work item type's oslc:creationfactory returns the work item type's attributes as oslc:property.  I've found this to the be the case.

My problem, however, is that the the  GET returns many oslc:property referring other properties, such as for example link types, of the work item type.  For example, perform a GET on the RTC supplied defect work item type's rdf:resource https://<host>:<port>/ccm/oslc/context/_pyf14FrmEeWs66yN_e1diA/shapes/workitems/defect returns 115 oslc:property elements:

<rdf:RDF>
  <oslc:ResourceShape rdf:about="https://sport6.rtp.raleigh.ibm.com:9463/ccm/oslc/context/_pyf14FrmEeWs66yN_e1diA/shapes/workitems/defect">
    <oslc:property>
      <oslc:Property rdf:about="https://sport6.rtp.raleigh.ibm.com:9463/ccm/oslc/context/_pyf14FrmEeWs66yN_e1diA/shapes/workitems/defect/property/com.ibm.team.workitem.linktype.duplicateworkitem.duplicates">
        <oslc:readOnly rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">true</oslc:readOnly>
        <oslc:valueType rdf:resource="http://open-services.net/ns/core#Resource"/>
        <oslc:range rdf:resource="http://open-services.net/ns/cm#ChangeRequest"/>
        <oslc:representation rdf:resource="http://open-services.net/ns/core#Either"/>
        <oslc:propertyDefinition rdf:resource="http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/com.ibm.team.workitem.linktype.duplicateworkitem.duplicates"/>
        <oslc:valueShape rdf:resource="https://sport6.rtp.raleigh.ibm.com:9463/ccm/oslc/context/_pyf14FrmEeWs66yN_e1diA/shapes/workitems/defect"/>
        <oslc:name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
          com.ibm.team.workitem.linktype.duplicateworkitem.duplicates
        </oslc:name>
        <oslc:occurs rdf:resource="http://open-services.net/ns/core#Zero-or-many"/>
        <dcterms:title rdf:parseType="Literal">Duplicated By</dcterms:title>
      </oslc:Property>
    </oslc:property>
    <oslc:property>
      <oslc:Property rdf:about="https://sport6.rtp.raleigh.ibm.com:9463/ccm/oslc/context/_pyf14FrmEeWs66yN_e1diA/shapes/workitems/defect/property/com.ibm.team.enterprise.packaging.linktype.resultWorkItem.result">
        <oslc:occurs rdf:resource="http://open-services.net/ns/core#Zero-or-many"/>
        <dcterms:title rdf:parseType="Literal">Packaging Summary Work Item</dcterms:title>
        <oslc:propertyDefinition rdf:resource="http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/com.ibm.team.enterprise.packaging.linktype.resultWorkItem.result"/>
        <oslc:name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
          com.ibm.team.enterprise.packaging.linktype.resultWorkItem.result
        </oslc:name>
        <oslc:readOnly rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">false</oslc:readOnly>
        <oslc:range rdf:resource="http://open-services.net/ns/cm#ChangeRequest"/>
        <oslc:valueType rdf:resource="http://open-services.net/ns/core#Resource"/>
        <oslc:representation rdf:resource="http://open-services.net/ns/core#Either"/>
        <oslc:valueShape rdf:resource="https://sport6.rtp.raleigh.ibm.com:9463/ccm/oslc/context/_pyf14FrmEeWs66yN_e1diA/shapes/workitems/defect"/>
      </oslc:Property>
    </oslc:property>
    ...
  </oslc:ResourceShape>
</rdf:RDF>
So my question is how do I determine which work item type properties are for the work item type's attributes?  Is there a better way of using RTC OSLC to obtain a given work item type's attributes?

I even tried performing a GET on the property's rdf:about, for example https://<host><port>/ccm/oslc/context/_pyf14FrmEeWs66yN_e1diA/shapes/workitems/defect/property/com.ibm.team.workitem.linktype.duplicateworkitem.duplicates, to see if this would return additional information.  This GET failed with with an HTTP status of 404 Not Found.  Shouldn't the property's rdf:about point to a valid entity?

3 answers



permanent link
Donald Nong (14.5k414) | answered Sep 25 '15, 6:43 a.m.
The 115 properties that you got are all for work item type "Defect", as indicated in the URL. If you get the same for Task, there are only 105 Properties. About the 404 Not Found error, I don't think there are any further shapes to be obtained, since the property definition is already in the XML document that you have got.

Comments
Geoff Alexander commented Sep 28 '15, 10:19 a.m.

Donald,  I realize that the 115 properties are for the work item type "Defect".  My question is how do I determine which of the 115 properties are for Defect attributes?

Also, I don't understand your response regarding 404 Not Found error from a property's about URI.  I would think that the property's about URI should be a valid URI referring to a real entity. This is independent of whether I currently have the property definition.  The issue is that I'd like to be able to pass a link referencing a specific property to other code. 


Donald Nong commented Sep 28 '15, 10:46 p.m.

Do you mean attributes unique to Defect when you say "Defect attributes"? I don't know how you would define such a term. You can find the name space of the property in the <oslc:propertyDefinition> tag - probably that's what you are looking for?
About the 404 error, I understand your concern. What I am trying to say is that you may just have to accept what it is (I see the same behavior in 4.0.7, 5.0.2 and 6.0.1) and make your code adapt to it. You may raise a defect if you believe the property <rdf:about> link should return some content - I guess they made some comprise to accommodate the properties coming from different name spaces, but who knows?


Geoff Alexander commented Sep 29 '15, 4:39 p.m. | edited Sep 29 '15, 4:40 p.m.

The problem I have is that I need to programmatically determine which properties reference attributes.  I'm not sure what you mean by name space of the property in the <oslc:propertyDefinition> tag.  I don't see anything in the <oslc:propertyDefinition> tag that clearly identifies a property as referencing an attribute.  For example, how do I programmatically determine if the property containing

<oslc:propertyDefinition rdf:resource="http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/teamArea"/>
references an attribute or not?   In fact, some properties don't even contain an <oslc:propertyDefinition> tag.  So how do programmatically determine which properties refer to attributes?

As for the 404 error when performing an HTTP GET on the property's about URI, I'll investigate further and open a defect if I believe that it's an actual RTC / JTS bug.


Donald Nong commented Sep 29 '15, 10:01 p.m.

OK. I think I now understand what you are talking about. :-)
If you are talking about the attributes listed in the "Types and Attributes" section in the process configuration, then the CreationDialog is probably the closest thing you can get, but it's in HTML format and utilizes AJAX as well. Other than that, I don't have a better idea.
Probably you can explain a bit more about what you are trying to do at a higher level?


Geoff Alexander commented Oct 01 '15, 10:07 a.m. | edited Oct 01 '15, 10:07 a.m.

Yes, I'm trying to obtain via RTC OSLC the list of attributes for a work item type as shown in the RTC Eclipse client's project area editor on the Project Configuration tab under Project Configuration -> Configuration Data -> Work Items -> Types and Attributes in the Attributes section.  Are you saying that it's not possible to obtain this attribute list via RTC OSLC?


Donald Nong commented Oct 02 '15, 12:33 a.m.

I don't think it's possible. The separation of "attributes" from other "properties" is not part of the OSLC specification. You can use some internal API (/ccm/service/com.ibm.team.workitem.service.process.internal.rest.IWorkItemConfigRestService/workItemTypes) if you really have to.


Geoff Alexander commented Oct 05 '15, 12:56 p.m. | edited Oct 05 '15, 1:39 p.m.

I tried doing an HTTP GET on /com.ibm.team.workitem.service.process.internal.rest.IWorkItemConfigRestService/workItemTypes and received the following server error:

2015-10-05 12:48:17,976 [http-bio-9443-exec-34 @@ 12:48 gdlxn <Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0@127.0.0.1> /ccm/service/com.ibm.team.workitem.service.process.internal.rest.IWorkItemConfigRestService/workItemTypes]  WARN .team.repository.servlet.AbstractTeamServerServlet  - CRJAZ1163I AssertionFailedException processing GET request for com.ibm.team.workitem.service.process.internal.rest.IWorkItemConfigRestService.getWorkItemTypes(). CRJAZ1170I The request was made by user "gdlxn" from "127.0.0.1".CRJAZ1166I The stack trace hash is 396650B9570089005DDEAF2CBF0D595C97ACA7CD.
org.eclipse.core.runtime.AssertionFailedException: assertion failed:
    at org.eclipse.core.runtime.Assert.isTrue(Assert.java:110)


Geoff Alexander commented Oct 05 '15, 1:47 p.m.

I've opened RTC Defect 371032 for the AFE server error I reported in my previous comment. The defect contains the full stack trace.


Geoff Alexander commented Oct 13 '15, 9:47 a.m.

I used the AFE stack trace to debug the AFE. It turns out that the AFE was because I didn't specify a projectAreaItemId parameter in the GET request.  The correct URI syntax is

https://<host>:<port>/ccm/service/com.ibm.team.workitem.service.process.internal.rest.IWorkItemConfigRestService/workItemTypes?projectAreaItemId=<Project Area ID>.

While it's not ideal to use internal APIs, this internal rest request looks promising.  Where can I find additional information on this and other similar RTC rest requests, both public and internal requests?  I'm even willing to look thru the RTC source that comes with the RTC SDK if necessary.

showing 5 of 9 show 4 more comments

permanent link
Jim Ruehlin (79114) | answered Sep 30 '15, 5:28 p.m.
JAZZ DEVELOPER
 Hi Geoff,

I might not understand what you're going for here, but it seems to me that you're getting a list of all the work item attributes. Team Area, for example, is an attribute of a work item because work items need to reference their team areas.

Possibly you're looking for a particular set of attributes, such as attributes that are directly modifiable by the user?

Comments
Geoff Alexander commented Oct 01 '15, 9:15 a.m. | edited Oct 01 '15, 9:17 a.m.

This list of work item type properties includes more than just attributes such as

<rdf:Description rdf:about="https://sport6.rtp.raleigh.ibm.com:9463/ccm/oslc/context/_pyf14FrmEeWs66yN_e1diA/shapes/workitems/defect/property/com.ibm.team.enterprise.promotion.linktype.promotionBuildResult.promotionBuildResult">
For example, 115 properties are returned for the defect work item type.  However the defect work item type only has 29 attributes as shown in the project area editor in the RTC Eclipse client. 


Jonas Studer commented Jul 28 '16, 2:18 a.m.

Hy Geoff, it mitght be a little late, but I guess this might be the solution you're searching for:

1: Getting all the possible types from the wished PA
So we  know exactely what it's ID looks like.
https://localhost:7443/jazz/oslc/types/<ProjectAreaID>;

2: Now we watch the shape of the specific type you want to know its attributes.
E.g. com.ibm.team.workitem.workItemType.defect

https://localhost:7443/jazz/oslc/context/<ProjectAreaID>/shapes/workitems/com.ibm.team.workitem.workItemType.defect

There you should find all needed values.


permanent link
Dinesh Kumar B (4.1k413) | answered Aug 23 '17, 3:52 a.m.
JAZZ DEVELOPER

Just in case someone might find it useful, here is a Reportable REST API to list all custom attributes from a repository :

https://<repo_url>:<port>/ccm/rpt/repository/workitem?fields=workitem/projectArea/(name|itemId|extensionMetadata/(key|displayName|workItemType/*))

For the repository, this will list the custom attributes under each project area along with the work item type they belong to.

Sample output extract :
        <projectArea>
            <name>JKE Banking (Change Management)</name>
            <itemId>_G3WWMHKEEeesP9BHAhBzgg</itemId>
            <extensionMetadata>
                <key>bv_el</key>
                <displayName>bv_el</displayName>
                <workItemType>
                    <id>defect</id>
                    <name>Defect</name>
                </workItemType>
            </extensionMetadata>

Your answer


Register or 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.