use of org.apache.cxf.jaxrs.ext.search.PropertyNotFoundException in project opennms by OpenNMS.
the class AbstractDaoRestService method getCriteria.
protected Criteria getCriteria(UriInfo uriInfo, SearchContext searchContext) {
final MultivaluedMap<String, String> params = uriInfo.getQueryParameters();
final CriteriaBuilder builder = getCriteriaBuilder();
if (searchContext != null) {
try {
SearchCondition<T> condition = searchContext.getCondition(getDaoClass());
if (condition != null) {
SearchConditionVisitor<T, CriteriaBuilder> visitor = new CriteriaBuilderSearchVisitor<T>(builder, getDaoClass());
condition.accept(visitor);
}
} catch (PropertyNotFoundException | ArrayIndexOutOfBoundsException e) {
LOG.warn(e.getClass().getSimpleName() + " while parsing FIQL search, ignoring: " + e.getMessage(), e);
}
}
// Apply limit, offset, orderBy, order params
applyLimitOffsetOrderBy(params, builder);
Criteria crit = builder.toCriteria();
return crit;
}
use of org.apache.cxf.jaxrs.ext.search.PropertyNotFoundException in project opennms by OpenNMS.
the class AbstractDaoRestServiceWithDTO method getCriteria.
protected Criteria getCriteria(UriInfo uriInfo, SearchContext searchContext) {
final CriteriaBuilder builder = getCriteriaBuilder(uriInfo);
if (searchContext != null) {
try {
SearchCondition<Q> condition = searchContext.getCondition(getQueryBeanClass(), getSearchBeanPropertyMap());
if (condition != null) {
SearchConditionVisitor<Q, CriteriaBuilder> visitor = new CriteriaBuilderSearchVisitor<T, Q>(builder, getDaoClass(), getCriteriaBehaviors());
condition.accept(visitor);
}
} catch (PropertyNotFoundException | ArrayIndexOutOfBoundsException e) {
LOG.warn(e.getClass().getSimpleName() + " while parsing FIQL search, ignoring: " + e.getMessage(), e);
}
}
// Apply limit, offset, orderBy, order parameters
final MultivaluedMap<String, String> params = uriInfo.getQueryParameters();
applyLimitOffsetOrderBy(params, builder);
Criteria crit = builder.toCriteria();
/*
* TODO: Figure out how to do stuff like this
*
* // Don't include deleted nodes by default
* final String type = params.getFirst("type");
* if (type == null) {
* final List<Restriction> restrictions = new ArrayList<Restriction>(crit.getRestrictions());
* restrictions.add(Restrictions.ne("type", "D"));
* crit.setRestrictions(restrictions);
* }
*/
return crit;
}
Aggregations