OIM Delete Organizations API


  1. package com.oimacademy.orgs;
  2. import com.oimacademy.connection.OIMConnection;
  3. import oracle.iam.identity.exception.NoSuchOrganizationException;
  4. import oracle.iam.identity.exception.OrganizationAlreadyDeletedException;
  5. import oracle.iam.identity.exception.OrganizationDeleteException;
  6. import oracle.iam.identity.exception.OrganizationDeleteSubOrgsExistException;
  7. import oracle.iam.identity.exception.OrganizationDeleteSubOrgsUsersExistException;
  8. import oracle.iam.identity.exception.OrganizationDeleteUsersExistException;
  9. import oracle.iam.identity.exception.OrganizationOrphanedPublishedEntitiesException;
  10. import oracle.iam.identity.orgmgmt.api.OrganizationManager;
  11. import oracle.iam.platform.OIMClient;
  12. import oracle.iam.platform.authz.exception.AccessDeniedException;
  13. public class DeleteOrganizations {
  14.  protected static OIMClient platform = OIMConnection.getConnection();
  15.  protected static OrganizationManager m_orgManagerService =(OrganizationManager) platform.getService(OrganizationManager.class);
  16.   public void deleteOrganizations() throws OrganizationDeleteException, NoSuchOrganizationException, OrganizationAlreadyDeletedException, OrganizationDeleteSubOrgsExistException, OrganizationDeleteSubOrgsUsersExistException, OrganizationDeleteUsersExistException, OrganizationOrphanedPublishedEntitiesException, AccessDeniedException {
  17.   //for (int i = 4; i <100 ; i++) {
  18.    String orgKey= Integer.toString(81);
  19.    try{
  20.     m_orgManagerService.delete(orgKey, false);
  21.    }catch(Exception e){
  22.     System.out.println(" orgKey -> "+ orgKey);
  23.    }
  24.  // }
  25.    System.out.println("Done");
  26.  }
  27. }

No comments:

Post a Comment