OIM API Method to get IT Resource by ID

classic Classic list List threaded Threaded
6 messages Options
David David
Reply | Threaded
Open this post in threaded view
|

OIM API Method to get IT Resource by ID

Hi, I am trying to made a java class which can get the parameters of an IT Resource?
I am doing with Java Code for Update User, Delete User and Search User (OIM API's) but i don´t know how to do it with IT Resources objects.
Could anyone help me?
Thanks!
chinniraviteja chinniraviteja
Reply | Threaded
Open this post in threaded view
|

Re: OIM API Method to get IT Resource by ID

Hi David,

Are you looking for performing operations directly on target resource ?

Thanks and Regards,
Chinni
David David
Reply | Threaded
Open this post in threaded view
|

Re: OIM API Method to get IT Resource by ID

Hi chinni,
No, only I need a class that can read the paremeters stored in OIM for an IT Resource. For example in OIM I have installed and configured an Active Directory IT Resource and I need to get the parameters of this AD, ldaphostname, container, domainname...
I think is a similar method like search user show in the web but...
Thank you!!
 
chinniraviteja chinniraviteja
Reply | Threaded
Open this post in threaded view
|

Re: OIM API Method to get IT Resource by ID

Here is the complete code to perform different operations of IT Resource:

tcITResourceInstanceOperationsIntf API Usage:

The following tasks needs to be performed to add, update, and delete the IT Resource Instance from Oracle Identity Manager. They are

1.    Create the OIMClient Handle

OIMClient client= new OIMClient();
client.login(username,password.toCharArray());

2.    Get tcITResourceInstanceOperationsIntf service object

tcITResourceInstanceOperationsIntf itResource = client.getService(tcITResourceInstanceOperationsIntf.class);

3.    Find the It Resource Instance Key
String itResourceName = "ADITResource"
Map filter= new HashMap();
filter.put("IT Resources.Name","IT Resource Name");
tcResultSet trs=itResource.findItResourceInstances(filter);
int rowCount=trs.getRowCount();
long itResourceKey=-1
if(rowCount >0)
{
    trs.goToRow(0);
    itResourceKey = trs.getLongValue("IT Resource.Key");
}

4.    Getting IT Resource Attributes
Map attributes= new HashMap();
If(itResourceKey >0)
{
tcResultSet itrParams=itResource.getITResourceInstanceParameters(itResourceInstanceKey);
int paramCount= itrParams.getRowCount();
 for(int i=0;i<paramCount;i++)
 {
        itrParams.goToRow(i);
        attributes.put itrParams.getStringValue("IT Resources Type Parameter.Name"),itrParams.getLongValue("IT Resource.Parameter.Key"));
}

<b>5.    Updating the IT Resource Instance Attribute


If(attributes.ContainsKey("Admin FQDN"))
{
Map<String, String> updateattributes= new HashMap<String, String>();
updateattributes.put("Admin FQDN","test@test.com");
itResource.updateITResourceInstanceParameters(itResourceKey,  updateAttributes);
}

6.    Getting the tcITResourceDefinitionOperationsIntf Service Handle

tcITResourceDefinitionOperationsIntf  itresdef= client.getService(tcITResourceDefinitionOperationsIntf.class);

7.    Getting the IT Resource Type Key

Map itRtypemap= new HashMap();
itRtypemap.put("IT Resources Type Definition.Server Type","AD Server");
long itresourceTypeKey= -1;
tcResultSet  itrestypers=itresdef. getITResourceDefinition(itRtypemap);
int typecount= itrestypers.getRowCount();
if(typecount >0)
{
    Itrestypers.goToRow(0);
itresourceTypeKey= itrestypers.getLongValue("IT Resources Type Definition.Key
");
}

8.    Adding the It Resource Instance

Map addAttrs= new HashMap();
addAttrs.put("Admin FQDN ","test@test.com");
addAttrs.put("Admin FQDN ","abc123");
addAttrs.put("IT Resources Type Parameter.Key",itresourceTypeKey);
itResourceKey=itResource.createITResourceInstance(addAttrs);

9.    Removing the It Resource Instance

If(itResourceKey >0)
{
    itResource. deleteITResourceInstance(itResourceKey);
}

.............................................................
Reference: http://idmoim.blogspot.com/2012/07/tcitresourceinstanceoperationsintf-api.html
Thanks and Regards,
Chinni
David David
Reply | Threaded
Open this post in threaded view
|

Re: OIM API Method to get IT Resource by ID

Hi chinni,
Thanks a lot. I´m going to try it and tell you.
Thanks again!
David David
Reply | Threaded
Open this post in threaded view
|

Re: OIM API Method to get IT Resource by ID

Hi chinni, Java code works great!!!
Thank you so much!!