Saturday, September 6, 2014

How to search by OIMITResource Type not ITResourceName

hello everyone,

Today I got stuck on OIM API because it was not clear for me how to get parameters values from OIM ITResource searching by ITResourceTYPE instead of ITResourceName. So, I would like to help everybody that maybe had problems on this and want some help:

...
   try {
            tcITResourceInstanceOperationsIntf op = oimClient.getService(tcITResourceInstanceOperationsIntf.class);
            Hashmap mapLeoncio = new Hashmap();
            //mapLeoncio.put("IT Resources.Name", itResourceName);  ***OLD CALL by NAME***
            mapLeoncio.put("IT Resources Type Definition.Server Type", itResourceType);
            tcResultSet rs = op.findITResourceInstances(mapLeoncio);
            if (rs.getRowCount() == 0) {
                System.out.println("Cannot find the Directory Server IT Resource type:" + itResourceType);
            }
            rs.goToRow(0);
            long key = rs.getLongValue("IT Resource.Key");
            tcResultSet resth = op.getITResourceInstanceParameters(key);
            return getValues(attributes, resth);
        } catch (Exception e) {
            System.out.println(e);
        }
...

Into OIM API there is a small call regarding the 'IT Resources Type Definition.Server Type'. So, must check carefully to get the right information.

Ref:
http://docs.oracle.com/cd/E17904_01/apirefs.1111/e17334/Thor/API/Operations/tcITResourceInstanceOperationsIntf.html


I hope it helps you,
Thiago Leoncio.