response.setEchoedScanRequest(ert);
}
public void setEchoedSearchRetrieveRequestType(SearchRetrieveRequestType request, SearchRetrieveResponseType response) {
EchoedSearchRetrieveRequestType ert=response.getEchoedSearchRetrieveRequest();
if(ert==null) {
ert=new EchoedSearchRetrieveRequestType();
}
ert.setMaximumRecords(request.getMaximumRecords());
String query=request.getQuery();
if(query!=null && query.length()>0) {
ert.setQuery(query);
try {
CQLNode root=cqlparser.parse(query);
ert.setXQuery(toOperandType(root));
}
catch (CQLParseException e) {
log.error("parse problem: \""+query+"\"",e);
RelationType rt=new RelationType("", null);
SearchClauseType sct=new SearchClauseType("", rt, "");
OperandType ot=new OperandType();
ot.setSearchClause(sct);
ert.setXQuery(ot);
}
catch (IOException e) {
log.error(e,e);
RelationType rt=new RelationType("", null);
SearchClauseType sct=new SearchClauseType("", rt, "");
OperandType ot=new OperandType();
ot.setSearchClause(sct);
ert.setXQuery(ot);
}
}
else { // sadly, just because the request didn't include it doesn't mean
// that the response gets to omit it. So, provide an empty query
ert.setQuery("");
RelationType rt=new RelationType("", null);
SearchClauseType sct=new SearchClauseType("", rt, "");
OperandType ot=new OperandType();
ot.setSearchClause(sct);
ert.setXQuery(ot);
}
ert.setResultSetTTL( request.getResultSetTTL());
ert.setRecordPacking( request.getRecordPacking());
ert.setSortKeys( request.getSortKeys());
ert.setStartRecord( request.getStartRecord());
if(request.getExtraRequestData()!=null)
ert.setExtraRequestData(request.getExtraRequestData());
if(request.getVersion()!=null)
ert.setVersion(request.getVersion());
else
ert.setVersion("1.1");
if(request.getRecordSchema()!=null)
ert.setRecordSchema(request.getRecordSchema());
else
ert.setRecordSchema("default");
response.setEchoedSearchRetrieveRequest(ert);
}