private SearchParameters getSearchParameters(SearchType searchType, String constraint) {
    SearchParameters searchParams = new SearchParameters(constraint, searchType);
    HashMap<String, String> matrixConstraints =
        QueryHelper.getMatrixConstraints(
            getUriInfo(), CASE_SENSITIVE_CONSTRAINT_PARAMETER, FROM_CONSTRAINT_PARAMETER);

    // preserved in sake if backward compatibility until 4.0
    HashMap<String, String> queryConstraints =
        QueryHelper.getQueryConstraints(getUriInfo(), FROM_CONSTRAINT_PARAMETER);

    if (matrixConstraints.containsKey(FROM_CONSTRAINT_PARAMETER)) {
      try {
        searchParams.setSearchFrom(
            Long.parseLong(matrixConstraints.get(FROM_CONSTRAINT_PARAMETER)));
      } catch (Exception ex) {
        LOG.error(
            "Unwrapping of '" + FROM_CONSTRAINT_PARAMETER + "' matrix search parameter failed.",
            ex);
      }
    } else if (queryConstraints.containsKey(FROM_CONSTRAINT_PARAMETER)) {
      // preserved in sake if backward compatibility until 4.0
      try {
        searchParams.setSearchFrom(Long.parseLong(queryConstraints.get(FROM_CONSTRAINT_PARAMETER)));
      } catch (Exception ex) {
        LOG.error(
            "Unwrapping of '" + FROM_CONSTRAINT_PARAMETER + "' query search parameter failed.", ex);
      }
    }
    if (matrixConstraints.containsKey(CASE_SENSITIVE_CONSTRAINT_PARAMETER)) {
      try {
        searchParams.setCaseSensitive(
            Boolean.parseBoolean(matrixConstraints.get(CASE_SENSITIVE_CONSTRAINT_PARAMETER)));
      } catch (Exception ex) {
        LOG.error(
            "Unwrapping of '" + CASE_SENSITIVE_CONSTRAINT_PARAMETER + "' search parameter failed.",
            ex);
      }
    }

    try {
      if (QueryHelper.hasMatrixParam(getUriInfo(), MAX) && getMaxResults() != NO_LIMIT) {
        searchParams.setMaxCount(getMaxResults());
      }
    } catch (MalformedNumberException ex) {
      handleError(ex, false);
    }
    return searchParams;
  }
 private String getConstraint() {
   StringBuilder buffer = new StringBuilder();
   buffer.append("Providers: type=");
   buffer.append(ProviderType.FOREMAN.name());
   String query = QueryHelper.getConstraint(getUriInfo(), null, modelType, false);
   if (StringUtils.isNotBlank(query)) {
     buffer.append(" AND (");
     buffer.append(query);
     buffer.append(")");
   }
   return buffer.toString();
 }
 protected List<Q> getBackendCollection(SearchType searchType) {
   return getBackendCollection(searchType, QueryHelper.getConstraint(getUriInfo(), "", modelType));
 }
示例#4
0
 private boolean isNextRunRequested() {
   return QueryHelper.getMatrixConstraints(getUriInfo(), NEXT_RUN).containsKey(NEXT_RUN);
 }