public void assignService(Map map) throws AMConsoleException {
  String[] params={currentRealm,serviceName};
  logEvent("ATTEMPT_ASSIGN_SERVICE_TO_REALM",params);
  try {
    AMIdentityRepository repo=new AMIdentityRepository(getUserSSOToken(),currentRealm);
    AMIdentity realmIdentity=repo.getRealmIdentity();
    Set servicesFromIdRepo=realmIdentity.getAssignableServices();
    if (servicesFromIdRepo.contains(serviceName)) {
      realmIdentity.assignService(serviceName,map);
    }
 else {
      OrganizationConfigManager orgCfgMgr=new OrganizationConfigManager(getUserSSOToken(),currentRealm);
      orgCfgMgr.assignService(serviceName,map);
    }
    logEvent("SUCCEED_ASSIGN_SERVICE_TO_REALM",params);
  }
 catch (  SSOException e) {
    String strError=getErrorString(e);
    String[] paramsEx={currentRealm,serviceName,strError};
    logEvent("SSO_EXCEPTION_ASSIGN_SERVICE_TO_REALM",paramsEx);
    throw new AMConsoleException(strError);
  }
catch (  IdRepoException e) {
    String strError=getErrorString(e);
    String[] paramsEx={currentRealm,serviceName,strError};
    logEvent("IDREPO_EXCEPTION_ASSIGN_SERVICE_TO_REALM",paramsEx);
    throw new AMConsoleException(strError);
  }
catch (  SMSException e) {
    String strError=getErrorString(e);
    String[] paramsEx={currentRealm,serviceName,strError};
    logEvent("SMS_EXCEPTION_ASSIGN_SERVICE_TO_REALM",paramsEx);
    throw new AMConsoleException(strError);
  }
}

public void assignService ( Map map ) throws AMConsoleException { String [ ] params = { currentRealm , serviceName } ; logEvent ( "ATTEMPT_ASSIGN_SERVICE_TO_REALM" , params ) ; try { AMIdentityRepository repo = new AMIdentityRepository ( getUserSSOToken ( ) , currentRealm ) ; AMIdentity realmIdentity = repo . getRealmIdentity ( ) ; Set servicesFromIdRepo = realmIdentity . getAssignableServices ( ) ; if ( servicesFromIdRepo . contains ( serviceName ) ) { realmIdentity . assignService ( serviceName , map ) ; } else { OrganizationConfigManager orgCfgMgr = new OrganizationConfigManager ( getUserSSOToken ( ) , currentRealm ) ; orgCfgMgr . assignService ( serviceName , map ) ; } logEvent ( "SUCCEED_ASSIGN_SERVICE_TO_REALM" , params ) ; } catch ( SSOException e ) { String strError = getErrorString ( e ) ; String [ ] paramsEx = { currentRealm , serviceName , strError } ; logEvent ( "SSO_EXCEPTION_ASSIGN_SERVICE_TO_REALM" , paramsEx ) ; throw new AMConsoleException ( strError ) ; } catch ( IdRepoException e ) { String strError = getErrorString ( e ) ; String [ ] paramsEx = { currentRealm , serviceName , strError } ; logEvent ( "IDREPO_EXCEPTION_ASSIGN_SERVICE_TO_REALM" , paramsEx ) ; throw new AMConsoleException ( strError ) ; } catch ( SMSException e ) { String strError = getErrorString ( e ) ; String [ ] paramsEx = { currentRealm , serviceName , strError } ; logEvent ( "SMS_EXCEPTION_ASSIGN_SERVICE_TO_REALM" , paramsEx ) ; throw new AMConsoleException ( strError ) ; } }
assigns service to a realm .
