Transformer transformer = null; // Start out w/no transformer and no doc
Document doc = null; // Don't make 'em if we don't need 'em
boolean sentAtLeastOne = false; // Track if we send any profiles at all
Exception exception = null; // And save any exception
for (Iterator i = handlers.iterator(); i.hasNext();) try { // To iterate over each handler
ProfileHandler handler = (ProfileHandler) i.next(); // Get the handler
String id = handler.getID(); // Get the ID, and if targeting to IDs
if (!ids.isEmpty() && !ids.contains(id)) continue; // ... and it's not one we want, skip it.
List results = handler.findProfiles(query); // Have it find profiles
if (results == null) results = Collections.EMPTY_LIST; // Assume nothing
for (Iterator j = results.iterator(); j.hasNext();) { // For each matching profile
Profile profile = (Profile) j.next(); // Get the profile
if (transformer == null) { // No transformer/doc yet?
transformer = createTransformer(); // Then make the transformer