use of com.sun.identity.liberty.ws.disco.jaxb.QueryType.RequestedServiceTypeType in project OpenAM by OpenRock.
the class DiscoEntryHandlerImplUtils method getQueryResults.
/*
* Finds the matching resource offering according to RequestedServiceType.
* Used by <code>DiscoEntryHandler</code>s.
*
* @param discoEntries all discovery entries
* @param reqServiceTypes List of requested service types
* @return Map of matching discovery entries. In this map,
* key is <code>entryId</code>, value is <code>DiscoEntryElement</code>.
*/
public static Map getQueryResults(Map discoEntries, List reqServiceTypes) {
Map results = null;
if ((reqServiceTypes == null) || (reqServiceTypes.size() == 0)) {
if (debug.messageEnabled()) {
debug.message("DiscoEntryHandlerImplUtils.getQueryResults: " + "no reqServiceTypes");
}
results = discoEntries;
} else {
results = new HashMap();
Iterator i = discoEntries.keySet().iterator();
while (i.hasNext()) {
String curKey = (String) i.next();
DiscoEntryElement cur = (DiscoEntryElement) discoEntries.get(curKey);
ResourceOfferingType offering = cur.getResourceOffering();
String serviceType = offering.getServiceInstance().getServiceType();
List options = null;
if (offering.getOptions() != null) {
options = offering.getOptions().getOption();
}
Iterator j = reqServiceTypes.iterator();
while (j.hasNext()) {
RequestedServiceTypeType curReqType = (RequestedServiceTypeType) j.next();
String requestedServiceType = curReqType.getServiceType();
if (!requestedServiceType.equals(serviceType)) {
continue;
}
List queryOptions = null;
if (curReqType.getOptions() != null) {
queryOptions = curReqType.getOptions().getOption();
}
if (evaluateOptionsRules(queryOptions, options)) {
/* code for proxy support
if (proxyServiceTypes.contains(serviceType)) {
if (this cur is that proxy) {
results.add(cur);
} else if (requester is the provider) {
results.add(cur);
}
} else {
results.add(cur);
}
*/
results.put(curKey, cur);
break;
}
}
}
}
return results;
}
Aggregations