}
return criteriaHash;
}
public static QueryCriteria getQueryCriteriaFromXmlRpc(Hashtable<String, Object> criteriaHash) {
QueryCriteria criteria = null;
if(((String)criteriaHash.get("class")).equals(TermQueryCriteria.class.getCanonicalName())){
criteria = new TermQueryCriteria();
criteria.setElementName((String) criteriaHash.get("elementName"));
((TermQueryCriteria)criteria).setValue((String) criteriaHash.get("elementValue"));
} else if(((String)criteriaHash.get("class")).equals(RangeQueryCriteria.class.getCanonicalName())){
criteria = new RangeQueryCriteria();
criteria.setElementName((String) criteriaHash.get("elementName"));
String startVal = criteriaHash.get("elementStartValue").equals("") ?
null : (String)criteriaHash.get("elementStartValue");
String endVal = criteriaHash.get("elementEndValue").equals("") ?
null : (String)criteriaHash.get("elementEndValue");
((RangeQueryCriteria)criteria).setStartValue(startVal);
((RangeQueryCriteria)criteria).setEndValue(endVal);
((RangeQueryCriteria)criteria).setInclusive(Boolean.parseBoolean((String) criteriaHash.get("inclusive")));
} else if(((String)criteriaHash.get("class")).equals(BooleanQueryCriteria.class.getCanonicalName())){
criteria = new BooleanQueryCriteria();
try{
((BooleanQueryCriteria)criteria).setOperator( ((Integer)criteriaHash.get("operator")).intValue() );
} catch (QueryFormulationException e){
System.out.println("Error generating Boolean Query.");
}
List<Hashtable<String, Object>> terms = (List<Hashtable<String, Object>>) criteriaHash.get("terms");
for(int i=0;i<terms.size();i++){
Hashtable<String, Object> term = terms.get(i);
QueryCriteria termCriteria = getQueryCriteriaFromXmlRpc(term);
try{
((BooleanQueryCriteria)criteria).addTerm(termCriteria);
} catch (QueryFormulationException e){
System.out.println("Error generating Boolean Query.");
}