public class AccountManagement {
OIMClient client=ClientOIM.initialise();
oracle.iam.provisioning.api.ApplicationInstanceService appInstanceService=client.getService(oracle.iam.provisioning.api.ApplicationInstanceService.class);
ProvisioningService provisioningService=client.getService(ProvisioningService.class);
ClientOIM oim=new ClientOIM();
public void provisionAccount(String accName,String userID)
{
try
{
if (accName!=null && !accName.equals("") && userID!=null && !userID.equals("") )
{
ApplicationInstance appInstance=appInstanceService.findApplicationInstanceByName(accName);
long appKey=appInstance.getApplicationInstanceKey();
System.out.println("AppKey is "+appKey);
FormInfo formInfo=appInstance.getAccountForm();
String formKey=String.valueOf(formInfo.getFormKey());
System.out.println("formKey is "+formKey);
HashMap parentData=new HashMap();
/*Madatory Form Values to be passed if required
* long itResKey=appInstance.getItResourceKey();
parentData.put("UD_LDAP_USR_SERVER", itResKey);
*/
AccountData accntData=new AccountData(formKey, null, parentData);
Account accnt=new Account (appInstance, accntData);
accnt.setAccountType(Account.ACCOUNT_TYPE.Primary);
String userKey=oim.getUserKey(userID);
System.out.println("User Key is " +userKey);
provisioningService.provision(userKey, accnt);
}
}
catch(Exception e)
{
System.out.println("Exception Caught is "+e.getMessage());
e.printStackTrace();
}
}
public static void main(String[] args)
{
AccountManagement ac=new AccountManagement();
ac.provisionAccount("ACCOUNT", "USERID");
}
}
OIMClient client=ClientOIM.initialise();
oracle.iam.provisioning.api.ApplicationInstanceService appInstanceService=client.getService(oracle.iam.provisioning.api.ApplicationInstanceService.class);
ProvisioningService provisioningService=client.getService(ProvisioningService.class);
ClientOIM oim=new ClientOIM();
public void provisionAccount(String accName,String userID)
{
try
{
if (accName!=null && !accName.equals("") && userID!=null && !userID.equals("") )
{
ApplicationInstance appInstance=appInstanceService.findApplicationInstanceByName(accName);
long appKey=appInstance.getApplicationInstanceKey();
System.out.println("AppKey is "+appKey);
FormInfo formInfo=appInstance.getAccountForm();
String formKey=String.valueOf(formInfo.getFormKey());
System.out.println("formKey is "+formKey);
HashMap parentData=new HashMap();
/*Madatory Form Values to be passed if required
* long itResKey=appInstance.getItResourceKey();
parentData.put("UD_LDAP_USR_SERVER", itResKey);
*/
AccountData accntData=new AccountData(formKey, null, parentData);
Account accnt=new Account (appInstance, accntData);
accnt.setAccountType(Account.ACCOUNT_TYPE.Primary);
String userKey=oim.getUserKey(userID);
System.out.println("User Key is " +userKey);
provisioningService.provision(userKey, accnt);
}
}
catch(Exception e)
{
System.out.println("Exception Caught is "+e.getMessage());
e.printStackTrace();
}
}
public static void main(String[] args)
{
AccountManagement ac=new AccountManagement();
ac.provisionAccount("ACCOUNT", "USERID");
}
}
Comments
Post a Comment