Topic
  • 4 replies
  • Latest Post - ‏2012-10-19T14:01:01Z by SystemAdmin
SystemAdmin
SystemAdmin
24948 Posts

Pinned topic Determining the name of the record a reference points to using REST

‏2012-10-17T23:45:32Z |
I have a requirement to update Clearquest data from machines that do not have Clearquest installed. As such I am using the REST interface to update Clearquest data from such machines.

In order to update fields in Clearquest records you need to formulate XML to describe the record and which fields you are updating. Unfortunately different field types require different formats in the XML. For example:

<VersionInfo
xmlns="http://www.ibm.com/xmlns/prod/rational/clearquest/1.0/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/terms/"
xmlns:oslc_cm="http://open-services.net/xmlns/cm/1.0/">
<Projects><value rdf:resource="http://<server>/cqweb/oslc/repo/<DBSet>/db/<database>/record/16777895-35681818" oslc_cm:label="Island"/>
<value rdf:resource="http://<server>/cqweb/oslc/repo/<DBSet>/db/<database>/record/16777895-35681804" oslc_cm:label="Athena"/>
</Projects>
<Deprecated>1</Deprecated>
</VersionInfo>'

Simple field types like short_strings, ints etc. can be represented simply "<Deprecated>1</Deprecated>". But more complex field types like references and reference lists like Projects above require that you format out a URL that points to the referenced record.
So I need to know what type each field is. I have code that determines this already. However the record numbers in the URLs need also be computed. The 1677895 above represents the dbid of the record type or what is known in the Clearquest Designer as "Reference To". I also have code that will figure that out based on the record name.

So in the above example we have a VersionInfo stateless record that has a reference list field named Projects. However the problem is that Projects points to Project - not Projects.

So my question is, given the REST/OSLC interface, how do I determine what the Reference to record name (or dbid) is for a reference list (or a reference)?
Updated on 2012-10-19T14:01:01Z at 2012-10-19T14:01:01Z by SystemAdmin
  • Leesa_Hicks
    Leesa_Hicks
    269 Posts

    Re: Determining the name of the record a reference points to using REST

    ‏2012-10-18T17:58:42Z  
    Not sure about the details of the REST URL, but you can ascertain the field type and what it refers to with EntityDef object methods, GetFieldDefType, GetFieldReferenceEntityDef
    Leesa Hicks
    Principal Engineer
    Tektronix Instruments
  • SystemAdmin
    SystemAdmin
    24948 Posts

    Re: Determining the name of the record a reference points to using REST

    ‏2012-10-18T18:11:34Z  
    Not sure about the details of the REST URL, but you can ascertain the field type and what it refers to with EntityDef object methods, GetFieldDefType, GetFieldReferenceEntityDef
    Leesa Hicks
    Principal Engineer
    Tektronix Instruments
    No, I can't. You don't understand. The whole idea of using a REST interface is to allow machines who do not have direct access to the Perl/Clearquest API to be able to interface with Clearquest using REST. That said there is no GetFieldDefType an dGetFieldReferenceEntityDef calls to call!

    For example, using REST one can read, change, delete Clearquest records from say a Linux machine who has never seen nor had installed any IBM/Rational Clearquest software at all! In such a situation there is no CQPerlExt to use, nor is there a cqperl or a ratlperl for that matter. This is the main reason and the main benefit of using REST to access Clearquest and it is a requirement for my task.

    Another complication that forbids us from even installing IBM/Rational Clearquest on a Linux based machine is the fact that our Clearquest instance is (unfortunately) using Visual Basic for its action hook code. It is my understanding that since there is no Visual Basic for Linux, accessing a Clearquest instance whose action hook code is Visual Basic is not doable from a Linux machine that obviously does not have a Microsoft based Visual Basic with which to run the action hook code! So, in these circumstances REST is the only way to go (or write a daemon, which I've done before and which has its own set of issues).
  • pdubovitsky
    pdubovitsky
    376 Posts

    Re: Determining the name of the record a reference points to using REST

    ‏2012-10-19T13:02:38Z  
    Hello,

    You can get this information from record shape.
    http://<cqwebserver>/cqweb/oslc/repo/<DBSet>/db/<DB>/shape/<record_type_dbid>

    Pavel
  • SystemAdmin
    SystemAdmin
    24948 Posts

    Re: Determining the name of the record a reference points to using REST

    ‏2012-10-19T14:01:01Z  
    Hello,

    You can get this information from record shape.
    http://<cqwebserver>/cqweb/oslc/repo/<DBSet>/db/<DB>/shape/<record_type_dbid>

    Pavel
    Ugh! This is as I feared, that I'd have to get into these shape thingies. Pavel you've helped me before (how did you get to know so much about this?). At least I know the right direction to head. Thanks and I'll report back when I know more...