Commit 706e0c84 authored by Matija Obreza's avatar Matija Obreza

DescriptorFilter: added filter for descriptors in use

- "used": true -- descriptors referenced in a Dataset or DescriptorList
- "used": false -- not referenced in Dataset and DescriptorList
parent 0b14abfd
......@@ -91,6 +91,9 @@ public class DescriptorFilter extends UuidModelFilter<DescriptorFilter, Descript
/** Descriptor list filter */
public DescriptorListFilter list;
/** Descriptor is in use: referenced in Dataset or DescriptorList. */
public Boolean used;
/**
* Builds the query.
*
......@@ -149,6 +152,13 @@ public class DescriptorFilter extends UuidModelFilter<DescriptorFilter, Descript
if (list != null) {
and.and(descriptorPath.descriptorLists.any().in(JPAExpressions.selectFrom(QDescriptorList.descriptorList).where(list.buildQuery())));
}
if (used != null) {
if (used.booleanValue()==true) {
and.and(descriptorPath.descriptorLists.isNotEmpty().or(descriptorPath.datasets.isNotEmpty()));
} else {
and.and(descriptorPath.descriptorLists.isEmpty().and(descriptorPath.datasets.isEmpty()));
}
}
if (StringUtils.isNotBlank(_text)) {
/*@formatter:off*/
......
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