private Map addFormats(String realm){
  Set values=null;
  Map map=null;
  try {
    AMIdentityRepository repo=new AMIdentityRepository(adminSSOToken,realm);
    AMIdentity realmIdentity=repo.getRealmIdentity();
    Set servicesFromIdRepo=realmIdentity.getAssignedServices();
    if (servicesFromIdRepo.contains(G11N_SERVICE_NAME)) {
      map=realmIdentity.getServiceAttributes(G11N_SERVICE_NAME);
    }
 else {
      OrganizationConfigManager orgCfgMgr=new OrganizationConfigManager(adminSSOToken,realm);
      map=orgCfgMgr.getServiceAttributes(G11N_SERVICE_NAME);
    }
  }
 catch (  SSOException e) {
    debug.warning("AMCommonNameGenerator.addFormats",e);
  }
catch (  SMSException e) {
    debug.warning("AMCommonNameGenerator.addFormats",e);
  }
catch (  IdRepoException e) {
    debug.warning("AMCommonNameGenerator.addFormats",e);
  }
  if ((map != null) && !map.isEmpty()) {
    values=(Set)map.get(G11N_SERIVCE_COMMON_NAME_FORMAT);
  }
  if ((values == null) || values.isEmpty()) {
    if (serviceSchemaManager != null) {
      try {
        values=AMAdminUtils.getAttribute(serviceSchemaManager,SchemaType.ORGANIZATION,G11N_SERIVCE_COMMON_NAME_FORMAT);
      }
 catch (      SMSException e) {
        debug.error("AMCommonNameGenerator.addFormats",e);
      }
    }
 else {
      debug.error("AMCommonNameGenerator.addFormats: " + "formats are not added because Console cannot get " + "an instance of service schema manager.");
    }
  }
  Map mapFormats=getFormatMap(values);
synchronized (mapRealmToFormat) {
    mapRealmToFormat.put(realm,mapFormats);
  }
  return mapFormats;
}

private Map addFormats ( String realm ) { Set values = null ; Map map = null ; try { AMIdentityRepository repo = new AMIdentityRepository ( adminSSOToken , realm ) ; AMIdentity realmIdentity = repo . getRealmIdentity ( ) ; Set servicesFromIdRepo = realmIdentity . getAssignedServices ( ) ; if ( servicesFromIdRepo . contains ( G11N_SERVICE_NAME ) ) { map = realmIdentity . getServiceAttributes ( G11N_SERVICE_NAME ) ; } else { OrganizationConfigManager orgCfgMgr = new OrganizationConfigManager ( adminSSOToken , realm ) ; map = orgCfgMgr . getServiceAttributes ( G11N_SERVICE_NAME ) ; } } catch ( SSOException e ) { debug . warning ( "AMCommonNameGenerator.addFormats" , e ) ; } catch ( SMSException e ) { debug . warning ( "AMCommonNameGenerator.addFormats" , e ) ; } catch ( IdRepoException e ) { debug . warning ( "AMCommonNameGenerator.addFormats" , e ) ; } if ( ( map != null ) && ! map . isEmpty ( ) ) { values = ( Set ) map . get ( G11N_SERIVCE_COMMON_NAME_FORMAT ) ; } if ( ( values == null ) || values . isEmpty ( ) ) { if ( serviceSchemaManager != null ) { try { values = AMAdminUtils . getAttribute ( serviceSchemaManager , SchemaType . ORGANIZATION , G11N_SERIVCE_COMMON_NAME_FORMAT ) ; } catch ( SMSException e ) { debug . error ( "AMCommonNameGenerator.addFormats" , e ) ; } } else { debug . error ( "AMCommonNameGenerator.addFormats: " + "formats are not added because Console cannot get " + "an instance of service schema manager." ) ; } } Map mapFormats = getFormatMap ( values ) ; synchronized ( mapRealmToFormat ) { mapRealmToFormat . put ( realm , mapFormats ) ; } return mapFormats ; }
adds format by retrieving the globalization service attributes to get the list of formats and add them accordingly .
