Adding anchors list on annotation entity lookup / query
This commit is contained in:
parent
40f56986b4
commit
6ebbb885fb
|
@ -35,6 +35,8 @@ public class AnnotationQuery extends QueryBase<AnnotationEntity> {
|
|||
|
||||
private Collection<String> entityTypes;
|
||||
|
||||
private Collection<String> anchors;
|
||||
|
||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||
|
||||
private final UserScope userScope;
|
||||
|
@ -126,6 +128,21 @@ public class AnnotationQuery extends QueryBase<AnnotationEntity> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public AnnotationQuery anchors(String value) {
|
||||
this.anchors = List.of(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public AnnotationQuery anchors(String... value) {
|
||||
this.anchors = Arrays.asList(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public AnnotationQuery anchors(Collection<String> values) {
|
||||
this.anchors = values;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Boolean isFalseQuery() {
|
||||
return this.isEmpty(this.ids) || this.isEmpty(this.excludedIds) || this.isEmpty(this.isActives) || this.isEmpty(this.entityIds);
|
||||
|
@ -176,6 +193,12 @@ public class AnnotationQuery extends QueryBase<AnnotationEntity> {
|
|||
inClause.value(item);
|
||||
predicates.add(inClause);
|
||||
}
|
||||
if (this.anchors != null) {
|
||||
CriteriaBuilder.In<String> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(AnnotationEntity._anchor));
|
||||
for (String item : this.anchors)
|
||||
inClause.value(item);
|
||||
predicates.add(inClause);
|
||||
}
|
||||
|
||||
if (!predicates.isEmpty()) {
|
||||
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||
|
|
|
@ -22,6 +22,8 @@ public class AnnotationLookup extends Lookup {
|
|||
|
||||
private List<String> entityTypes;
|
||||
|
||||
private List<String> anchors;
|
||||
|
||||
public String getLike() {
|
||||
return like;
|
||||
}
|
||||
|
@ -70,6 +72,14 @@ public class AnnotationLookup extends Lookup {
|
|||
this.entityTypes = entityTypes;
|
||||
}
|
||||
|
||||
public List<String> getAnchors() {
|
||||
return anchors;
|
||||
}
|
||||
|
||||
public void setAnchors(List<String> anchors) {
|
||||
this.anchors = anchors;
|
||||
}
|
||||
|
||||
public AnnotationQuery enrich(QueryFactory queryFactory) {
|
||||
AnnotationQuery query = queryFactory.query(AnnotationQuery.class);
|
||||
if (this.like != null)
|
||||
|
@ -84,6 +94,8 @@ public class AnnotationLookup extends Lookup {
|
|||
query.entityIds(this.entityIds);
|
||||
if (this.entityTypes != null)
|
||||
query.entityTypes(this.entityTypes);
|
||||
if (this.anchors != null)
|
||||
query.anchors(this.anchors);
|
||||
|
||||
this.enrichCommon(query);
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ export class AnnotationLookup extends Lookup implements AnnotationFilter {
|
|||
isActive: IsActive;
|
||||
entityIds: Guid[];
|
||||
entityTypes: string[];
|
||||
anchors: string[];
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
|
Loading…
Reference in New Issue