Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Unable to fetch the custom attribute prefix tag of artifect type defect

RTC Version 4.0.3

I have created custom attribute in the RTC of WorkItem type Defect.
I have marked these attributes as a mandatory . I want to create defects in RTC using my java client.

Questions:
1. How to fetch the attribute prefix Tag to create the XML change request .
i.e 
<rtc_ext:Test1 rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">10</rtc_ext:Test1>
here, Test1 is a mandatory attribute of type integer added in Workitem type Defect.
rtc_ext:Test1 Tag is required to create XML Change Request to create defects in RTC which i am unable to fetch.

2. what about system defined attributes , how to fetch the prefix tags for those?
i.e.

<
rtc_cm:filedAgainst rdf:resource="https://localhost:9443/ccm/resource/itemOid/com.ibm.team.workitem.Category/_BzHUxJiHEeO_g7YLV-uN1A"/>

here, I need to fetch the Tag
rtc_cm:filedAgainst.
I am able to fetch the internal name of the attribute from the resource shape. 

Thanks
Rahul

0 votes



One answer

Permanent link
It sounds strange that you cannot find the information in the resource shape. I suppose you get confused with what the "prefix" is - it is simply a namespace declaration, or a "shorthand" if you like. Here is something you can do, and hopefully get what you want.
1. Follow the usual chain of discovery till you get the resource shape of the defect. In the shape content, search the custom attribute name and you should get something like this
<oslc:propertyDefinition rdf:resource="http://jazz.net/xmlns/prod/jazz/rtc/ext/1.0/customAttribute"/>
Here the name space is http://jazz.net/xmlns/prod/jazz/rtc/ext/1.0/ and you need to declare this before you can use it in a request body.
2. Depending on the name of your choice, you can declare the namespace as below
xmlns:rtc_ext="http://jazz.net/xmlns/prod/jazz/rtc/ext/1.0/"
In this case, you can use <rtc_ext:customAttribute> to refer to your custom attribute in your request body.
3. If you want to get a sample of the RDF/XML presentation of a Defect work item, simply do a GET request of an existing Defect work item with the custom attribute. At the top part of the response, you should observe the same line as quoted above. All the attributes with the "rtc_ext" prefix are custom attributes. The other attributes have different prefix depending on in which namespace they are defined.
I don't know how you do the "fetch", but to get consistent result, always use HTTP headers "Accept: application/rdf+xml" and "OSLC-Core-Version: 2.0" with your request.

1 vote

Comments

Thanks Donald for your quick response. Now i am able to identify the attribute prefix based on the name spaces defined for them.

Your answer

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

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 11,007
× 7,549
× 1,710
× 458

Question asked: Mar 10 '14, 6:44 a.m.

Question was seen: 5,962 times

Last updated: Mar 11 '14, 10:19 a.m.

Confirmation Cancel Confirm