Sunday, December 21, 2014

Account API: how to get and set account attributes

There are 2 type of Account objects:

  • com.netegrity.llsdk6.imsapi.managedobject.Account
  • com.ca.identitymanager.provisioning.managedobject.Account

For quick answer to question : how to get and set account attributes?
I will use the second one API to get/set account attributes.


The first one,com.netegrity.llsdk6.imsapi.managedobject.Account, you can get from User Object



Vector<Account> accounts = user.getAccounts();


Pros:
- Easy to get object
Cons:
- This code is so slow because you have to get all account and query from all endpoint.
- contains a few methods.

I prefer the second one,com.ca.identitymanager.provisioning.managedobject.Account,

 Pros:
- So powerful, it has method setAttribute(), you can set value to account
- You can  get account by specific endpoint.
Cons:
- A little bit difficult to initiate AccountProvider Object

For more detail let see Chapter 9 of CA Identity Manager Volume II: Learn by Example Code. I just showed how to use the API (the second one) to update account attributes. I put employee number then my code disable AD account by setting attribute




account.setAttribute(Account.PROPERTY_LOCKED_STATE,"TRUE");


You can see java doc here:
  • https://support.ca.com/cadocs/0/CA%20IdentityMinder%2012%206%203-JPN/Bookshelf_Files/javadoc-im/com/ca/identitymanager/provisioning/managedobject/Account.html

  • https://support.ca.com/cadocs/0/CA%20IdentityMinder%2012%206%203-JPN/Bookshelf_Files/javadoc-im/com/netegrity/llsdk6/imsapi/managedobject/Account.html