UCMDB and UD Practitioners Forum (Previously CMS)
cancel
Showing results for 
Search instead for 
Did you mean: 

How to query a link_id in uCMDB?

Highlighted
Charlemagne
Occasional Contributor

How to query a link_id in uCMDB?

Hi everyone,

 

I would like to know how I can build a query to fetch the attributes of a link from the link_id attribute (UcmdbId class) I am getting after doing an HistoryQuery.

 

I am only interested into attributes of a link that is created/deleted and it seems it is not possible to build a topology query to get them. I cannot just query the end1_id TopologyCI since I am seeking for a relation that may no longer exist. The information I have from the HistoryQuery is the link_id, the end2_id and obviously I have the end1_id since this is how I build a query to get the link_id into the History.

 

The documentation is very mute on everything related to History, HistoryQuery. I tried the following Topology Query, but it returns nothing:

 

QueryNode linkNode = qdef.addNode("mylink").ofType("connection").withIds(ids);

linkNode.queryProperties("data_note", "data_updated_by", "last_modified_time", "description");

 

Where ids is a collection (Set) of UcmdbId matching the link_id(s) of the relations I am interested in. The type "connection" is supposed to map to the Relation's type in uCMDB for the type of links I am querying. qdef is a QueryDefinition object.

 

Here is a sample output from the history query for one record and link_id I am interested in:

 

 Date: jeu., 2 juillet 2015 15:38:59 EDT    Type: REMOVE_RELATION    [Some One(someone),LoggedInUser:ServiceHPUCMDB]
         dfe95ca37a9f7e414d575a8ab1d9511f    Type: unavailability_cause

             end2_type    host_node
             link_id    56fee250f21ff9e9562f8ee1d7305fe3
             end2_id    d2b5afddcaf92308a1d23ee9da173757
             Remove Related CI    m1582(host_node)
             end2_display_label    m1582
             link_type    connection

 

Any hints?

//Add this to "OnDomLoad" event