SearchCriteria gptSearchCriteria) {
CswSearchCriteria cswClientCriteria = new CswSearchCriteria();
cswClientCriteria.setSearchText(
gptSearchCriteria.getSearchFilterKeyword().getSearchText());
Envelope gptEnvelope =
gptSearchCriteria.getSearchFilterSpatial().getEnvelope();
double maxX = 180;
double maxY = 90;
double minX = -180;
double minY = -90;
if(gptEnvelope != null && !gptEnvelope.isEmpty() &&
!gptSearchCriteria.getSearchFilterSpatial().getSelectedBounds().equals(
ISearchFilterSpatialObj.OptionsBounds.anywhere.toString())) {
if(!gptEnvelope.isValid()) {
gptEnvelope.setMaxX(maxX);
gptEnvelope.setMinX(minX);
gptEnvelope.setMaxY(maxY);
gptEnvelope.setMinY(minY);
}
if(gptEnvelope.getMinX() < minX || gptEnvelope.getMinX() > maxX) {
gptEnvelope.setMinX(minX);
}
if(gptEnvelope.getMaxX() < minX || gptEnvelope.getMaxX() > maxX) {
gptEnvelope.setMaxX(maxX);
}
if(gptEnvelope.getMaxY() < minY || gptEnvelope.getMaxY() > maxY) {
gptEnvelope.setMaxY(maxY);
}
if(gptEnvelope.getMinY() < minY || gptEnvelope.getMinY() > maxY) {
gptEnvelope.setMinY(minY);
}
cswClientCriteria.setEnvelope(new com.esri.gpt.server.csw.client.Envelope(
gptEnvelope.getMinX(), gptEnvelope.getMinY(),
gptEnvelope.getMaxX(), gptEnvelope.getMaxY()));
}
//Work around reset of pagecursor if there are no totalRecordCounts
int tmp = gptSearchCriteria.getSearchFilterPageCursor().getTotalPageCount();