Commit 167dfd29 authored by Matija Obreza's avatar Matija Obreza

Filters without nested JPAExpression

parent 274f6895
......@@ -19,12 +19,10 @@ import static org.genesys.catalog.model.vocab.QControlledVocabulary.controlledVo
import org.genesys.blocks.model.filters.StringFilter;
import org.genesys.blocks.model.filters.UuidModelFilter;
import org.genesys.catalog.model.QPartner;
import org.genesys.catalog.model.vocab.ControlledVocabulary;
import com.querydsl.core.BooleanBuilder;
import com.querydsl.core.types.Predicate;
import com.querydsl.jpa.JPAExpressions;
public class ControlledVocabularyFilter extends UuidModelFilter<ControlledVocabularyFilter, ControlledVocabulary> {
......@@ -60,7 +58,7 @@ public class ControlledVocabularyFilter extends UuidModelFilter<ControlledVocabu
and.and(description.buildQuery(controlledVocabulary.description));
}
if (owner != null) {
and.and(controlledVocabulary.owner.in(JPAExpressions.selectFrom(QPartner.partner).where(owner.buildPredicate())));
and.and(owner.buildQuery(controlledVocabulary.owner));
}
return and;
}
......
......@@ -25,15 +25,12 @@ import org.apache.commons.lang3.StringUtils;
import org.genesys.blocks.model.filters.NumberFilter;
import org.genesys.blocks.model.filters.StringFilter;
import org.genesys.blocks.model.filters.UuidModelFilter;
import org.genesys.catalog.model.QPartner;
import org.genesys.catalog.model.traits.Descriptor;
import org.genesys.catalog.model.traits.QDescriptor;
import org.genesys.catalog.model.traits.QDescriptorList;
import org.genesys2.server.model.PublishState;
import com.querydsl.core.BooleanBuilder;
import com.querydsl.core.types.Predicate;
import com.querydsl.jpa.JPAExpressions;
import org.genesys2.server.model.PublishState;
/**
* The Class DescriptorFilter.
......@@ -141,7 +138,7 @@ public class DescriptorFilter extends UuidModelFilter<DescriptorFilter, Descript
and.and(bibliographicCitation.buildQuery(descriptorPath.bibliographicCitation));
}
if (owner != null) {
and.and(descriptorPath.owner.in(JPAExpressions.selectFrom(QPartner.partner).where(owner.buildPredicate())));
and.and(owner.buildQuery(descriptorPath.owner));
}
if (minValue != null) {
and.and(minValue.buildQuery(descriptorPath.minValue));
......@@ -150,7 +147,7 @@ public class DescriptorFilter extends UuidModelFilter<DescriptorFilter, Descript
and.and(maxValue.buildQuery(descriptorPath.maxValue));
}
if (list != null) {
and.and(descriptorPath.descriptorLists.any().in(JPAExpressions.selectFrom(QDescriptorList.descriptorList).where(list.buildPredicate())));
and.and(list.buildQuery(descriptorPath.descriptorLists.any()));
}
if (used != null) {
if (used.booleanValue()==true) {
......
......@@ -25,6 +25,7 @@ import org.apache.commons.lang3.StringUtils;
import org.genesys.blocks.model.filters.StringFilter;
import org.genesys.blocks.model.filters.UuidModelFilter;
import org.genesys.catalog.model.traits.DescriptorList;
import org.genesys.catalog.model.traits.QDescriptorList;
import org.genesys2.server.model.PublishState;
import com.querydsl.core.BooleanBuilder;
......@@ -68,6 +69,10 @@ public class DescriptorListFilter extends UuidModelFilter<DescriptorListFilter,
* @return the predicate
*/
public Predicate buildPredicate() {
return buildQuery(descriptorList);
}
public Predicate buildQuery(QDescriptorList descriptorList) {
final BooleanBuilder and = new BooleanBuilder();
super.buildQuery(descriptorList, descriptorList._super, and);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment