How to obtain a list of attributes for a given RTC work item type via OSLC?
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>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?
<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>
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
Comments
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.
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?
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"/>
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.
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?
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?
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.
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)
I've opened RTC Defect 371032 for the AFE server error I reported in my previous comment. The defect contains the full stack trace.
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.
Comments
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.
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.
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>