use of org.jowidgets.cap.common.api.filter.IFilter in project jo-client-platform by jo-source.
the class CriteriaQueryCreator method createBooleanFilterPredicate.
private Predicate createBooleanFilterPredicate(final CriteriaBuilder criteriaBuilder, final Root<?> bean, final CriteriaQuery<?> query, final IBooleanFilter filter, final PARAM_TYPE parameter) {
final List<Predicate> predicates = new LinkedList<Predicate>();
for (final IFilter subFilter : filter.getFilters()) {
final Predicate predicate = createFilterPredicate(criteriaBuilder, bean, query, subFilter, parameter);
predicates.add(predicate);
}
if (filter.getOperator() == BooleanOperator.AND) {
return criteriaBuilder.and(predicates.toArray(new Predicate[0]));
}
return criteriaBuilder.or(predicates.toArray(new Predicate[0]));
}
use of org.jowidgets.cap.common.api.filter.IFilter in project jo-client-platform by jo-source.
the class BeanRelationNodeModelImpl method getFilter.
private IFilter getFilter() {
final IFilter addedDataFilter = getAddedDataFilter();
if (filters.size() > 0 || addedDataFilter != null) {
final IBooleanFilterBuilder builder = CapCommonToolkit.filterFactory().booleanFilterBuilder();
builder.setOperator(BooleanOperator.AND);
final IUiFilterFactory filterFactory = CapUiToolkit.filterToolkit().filterFactory();
for (final IUiFilter uiFilter : filters.values()) {
builder.addFilter(filterFactory.convert(uiFilter));
}
if (addedDataFilter != null) {
builder.addFilter(addedDataFilter);
}
return builder.build();
} else {
return addedDataFilter;
}
}
use of org.jowidgets.cap.common.api.filter.IFilter in project jo-client-platform by jo-source.
the class BeanTableModelImpl method getFilter.
private IFilter getFilter() {
final IFilter addedDataFilter = getAddedDataFilter();
if (filters.size() > 0 || addedDataFilter != null) {
final IBooleanFilterBuilder builder = CapCommonToolkit.filterFactory().booleanFilterBuilder();
builder.setOperator(BooleanOperator.AND);
final IUiFilterFactory filterFactory = CapUiToolkit.filterToolkit().filterFactory();
for (final IUiFilter uiFilter : filters.values()) {
builder.addFilter(filterFactory.convert(uiFilter));
}
if (addedDataFilter != null) {
builder.addFilter(addedDataFilter);
}
return builder.build();
} else {
return addedDataFilter;
}
}
use of org.jowidgets.cap.common.api.filter.IFilter in project jo-client-platform by jo-source.
the class OrderedBeansCrudInterceptorImpl method createReadFilter.
private IFilter createReadFilter(final Object group) {
final IFilter groupFilter = groupMapper.createGroupFilter(group);
final IFilter orderNumberNotNullFilter = createOrderNumberNotNullFilter();
if (groupFilter == null) {
return orderNumberNotNullFilter;
} else {
return BooleanFilter.create(groupFilter, orderNumberNotNullFilter);
}
}
use of org.jowidgets.cap.common.api.filter.IFilter in project jo-client-platform by jo-source.
the class UniqueConstraintCheckerImpl method checkCreation.
@Override
public void checkCreation(final Collection<? extends IBeanData> beansData, final IExecutionCallback executionCallback) {
final IFilter filter = createFilter(beansData);
final SyncResultCallback<Integer> resultCallback = new SyncResultCallback<Integer>();
final List<IBeanKey> parentBeanKeys = Collections.emptyList();
this.readerService.count(resultCallback, parentBeanKeys, filter, null, executionCallback);
final Integer result = resultCallback.getResultSynchronious();
if (result != null && result.intValue() > 0) {
throw new UniqueConstraintViolationException(propertyNames);
}
}
Aggregations