/** * Return a hash code value for the given search. */ public static int hashCode(ISearch search) { int hash = 1; hash = hash * 31 + (search.getSearchClass() == null ? 0 : search.getSearchClass().hashCode()); hash = hash * 31 + (search.getFields() == null ? 0 : search.getFields().hashCode()); hash = hash * 31 + (search.getFilters() == null ? 0 : search.getFilters().hashCode()); hash = hash * 31 + (search.getSorts() == null ? 0 : search.getSorts().hashCode()); hash = hash * 31 + (search.isDisjunction() ? 1 : 0); hash = hash * 31 + (new Integer(search.getResultMode()).hashCode()); hash = hash * 31 + (new Integer(search.getFirstResult()).hashCode()); hash = hash * 31 + (new Integer(search.getPage()).hashCode()); hash = hash * 31 + (new Integer(search.getMaxResults()).hashCode()); return hash; }
sb.append("] {\n resultMode: "); switch (search.getResultMode()) { case RESULT_AUTO: sb.append("AUTO"); break; default: sb.append("**INVALID RESULT MODE: (" + search.getResultMode() + ")**"); break;
return results; int resultMode = search.getResultMode(); if (resultMode == ISearch.RESULT_AUTO) { int count = 0;
private void addResultMode(Query query, ISearch search) { int resultMode = search.getResultMode(); if (resultMode == ISearch.RESULT_AUTO) { int count = 0;
/** * Return true if the search objects have equivalent contents. */ public static boolean equals(ISearch search, Object obj) { if (search == obj) return true; if (!(obj instanceof ISearch)) return false; ISearch s = (ISearch) obj; if (search.getSearchClass() == null ? s.getSearchClass() != null : !search.getSearchClass().equals( s.getSearchClass())) return false; if (search.isDisjunction() != s.isDisjunction() || search.getResultMode() != s.getResultMode() || search.getFirstResult() != s.getFirstResult() || search.getPage() != s.getPage() || search.getMaxResults() != s.getMaxResults()) return false; if (search.getFetches() == null ? s.getFetches() != null : !search.getFetches().equals(s.getFetches())) return false; if (search.getFields() == null ? s.getFields() != null : !search.getFields().equals(s.getFields())) return false; if (search.getFilters() == null ? s.getFilters() != null : !search.getFilters().equals(s.getFilters())) return false; if (search.getSorts() == null ? s.getSorts() != null : !search.getSorts().equals(s.getSorts())) return false; return true; }
/** * Copy the contents of the source search object to the destination search * object, overriding any contents previously found in the destination. All * destination properties reference the same objects from the source * properties. */ public static IMutableSearch shallowCopy(ISearch source, IMutableSearch destination) { destination.setSearchClass(source.getSearchClass()); destination.setDistinct(source.isDistinct()); destination.setDisjunction(source.isDisjunction()); destination.setResultMode(source.getResultMode()); destination.setFirstResult(source.getFirstResult()); destination.setPage(source.getPage()); destination.setMaxResults(source.getMaxResults()); destination.setFetches(source.getFetches()); destination.setFields(source.getFields()); destination.setFilters(source.getFilters()); destination.setSorts(source.getSorts()); return destination; }