}
}
}
catch (SortException se)
{
throw new UIException("Unable to get sort options", se);
}
}
params.scope.setBrowseIndex(bi);
params.scope.setSortBy(sortBy);
params.scope.setJumpToItem(RequestUtils.getIntParameter(request, BrowseParams.JUMPTO_ITEM));
params.scope.setOrder(request.getParameter(BrowseParams.ORDER));
int offset = RequestUtils.getIntParameter(request, BrowseParams.OFFSET);
params.scope.setOffset(offset > 0 ? offset : 0);
params.scope.setResultsPerPage(RequestUtils.getIntParameter(request,
BrowseParams.RESULTS_PER_PAGE));
params.scope.setStartsWith(URLDecode(request.getParameter(BrowseParams.STARTS_WITH)));
String filterValue = request.getParameter(BrowseParams.FILTER_VALUE[0]);
if (filterValue == null)
{
filterValue = request.getParameter(BrowseParams.FILTER_VALUE[1]);
params.scope.setAuthorityValue(filterValue);
}
params.scope.setFilterValue(filterValue);
params.scope.setJumpToValue(URLDecode(request.getParameter(BrowseParams.JUMPTO_VALUE)));
params.scope.setJumpToValueLang(URLDecode(request.getParameter(BrowseParams.JUMPTO_VALUE_LANG)));
params.scope.setFilterValueLang(URLDecode(request.getParameter(BrowseParams.FILTER_VALUE_LANG)));
// Filtering to a value implies this is a second level browse
if (params.scope.getFilterValue() != null)
params.scope.setBrowseLevel(1);
// if year and perhaps month have been selected, we translate these
// into "startsWith"
// if startsWith has already been defined then it is overwritten
if (params.year != null && !"".equals(params.year) && !"-1".equals(params.year))
{
String startsWith = params.year;
if ((params.month != null) && !"-1".equals(params.month)
&& !"".equals(params.month))
{
// subtract 1 from the month, so the match works
// appropriately
if ("ASC".equals(params.scope.getOrder()))
{
params.month = Integer.toString((Integer.parseInt(params.month) - 1));
}
// They've selected a month as well
if (params.month.length() == 1)
{
// Ensure double-digit month number
params.month = "0" + params.month;
}
startsWith = params.year + "-" + params.month;
if ("ASC".equals(params.scope.getOrder()))
{
startsWith = startsWith + "-32";
}
}
params.scope.setStartsWith(startsWith);
}
}
catch (BrowseException bex)
{
throw new UIException("Unable to create browse parameters", bex);
}
this.userParams = params;
return params;
}