protected Client loadClient(String clientType){
  Client client=null;
  long st=currentTimeMillis();
  Map iMap=loadInternalClient(clientType);
  Map eMap=loadExternalClient(clientType);
  if ((iMap == null) && (eMap == null)) {
    return client;
  }
  Map mergedMap=mergeMap(iMap,eMap);
  String ct=clientType;
  String parentID=getParentID(mergedMap);
  OrderedSet os=new OrderedSet();
  while ((parentID != null) && (!(ct.equals(parentID)))) {
    os.add(parentID);
    Map pMap=loadInternalClient(parentID);
    if (pMap == null) {
      break;
    }
 else {
      mergedMap=mergeMap(pMap,mergedMap);
      ct=getClientType(pMap);
      parentID=getParentID(pMap);
    }
  }
  if (os.size() > 0) {
    mergedMap.put(PARENT_ID,os);
  }
  mergedClientData.put(clientType,mergedMap);
  client=new Client(clientType,mergedMap);
  loadedClientsMap.put(clientType,client);
  long end=currentTimeMillis();
  if (debug.messageEnabled()) {
    debug.message(CLASS + "Load Client " + clientType+ " Time (ms) = "+ (end - st));
  }
  return client;
}

protected Client loadClient ( String clientType ) { Client client = null ; long st = currentTimeMillis ( ) ; Map iMap = loadInternalClient ( clientType ) ; Map eMap = loadExternalClient ( clientType ) ; if ( ( iMap == null ) && ( eMap == null ) ) { return client ; } Map mergedMap = mergeMap ( iMap , eMap ) ; String ct = clientType ; String parentID = getParentID ( mergedMap ) ; OrderedSet os = new OrderedSet ( ) ; while ( ( parentID != null ) && ( ! ( ct . equals ( parentID ) ) ) ) { os . add ( parentID ) ; Map pMap = loadInternalClient ( parentID ) ; if ( pMap == null ) { break ; } else { mergedMap = mergeMap ( pMap , mergedMap ) ; ct = getClientType ( pMap ) ; parentID = getParentID ( pMap ) ; } } if ( os . size ( ) > 0 ) { mergedMap . put ( PARENT_ID , os ) ; } mergedClientData . put ( clientType , mergedMap ) ; client = new Client ( clientType , mergedMap ) ; loadedClientsMap . put ( clientType , client ) ; long end = currentTimeMillis ( ) ; if ( debug . messageEnabled ( ) ) { debug . message ( CLASS + "Load Client " + clientType + " Time (ms) = " + ( end - st ) ) ; } return client ; }
1 . load internal client data and set parent data 2 . load external client data and merge with internal client data 3 . load merged client data to mergedclientdata set 4 . construct client object and add to loadedclientsmap
