View Javadoc
1   package de.dlr.shepard.util;
2   
3   import de.dlr.shepard.neo4Core.orderBy.OrderByAttribute;
4   import lombok.EqualsAndHashCode;
5   import lombok.Getter;
6   import lombok.NoArgsConstructor;
7   import lombok.ToString;
8   
9   @Getter
10  @ToString
11  @EqualsAndHashCode
12  @NoArgsConstructor
13  public class QueryParamHelper {
14  
15    private String name;
16    private PaginationHelper pagination;
17    private Long parentId;
18    private Long predecessorId;
19    private Long successorId;
20    private OrderByAttribute orderByAttribute;
21    private Boolean orderDesc;
22  
23    public QueryParamHelper withName(String name) {
24      this.name = name;
25      return this;
26    }
27  
28    public boolean hasName() {
29      return this.name != null;
30    }
31  
32    public QueryParamHelper withPageAndSize(int page, int size) {
33      this.pagination = new PaginationHelper(page, size);
34      return this;
35    }
36  
37    public boolean hasPagination() {
38      return this.pagination != null;
39    }
40  
41    public QueryParamHelper withPredecessorId(long predecessorId) {
42      this.predecessorId = predecessorId;
43      return this;
44    }
45  
46    public boolean hasPredecessorId() {
47      return this.predecessorId != null;
48    }
49  
50    public QueryParamHelper withSuccessorId(long successorId) {
51      this.successorId = successorId;
52      return this;
53    }
54  
55    public boolean hasSuccessorId() {
56      return this.successorId != null;
57    }
58  
59    public QueryParamHelper withParentId(long parentId) {
60      this.parentId = parentId;
61      return this;
62    }
63  
64    public boolean hasParentId() {
65      return this.parentId != null;
66    }
67  
68    public QueryParamHelper withOrderByAttribute(OrderByAttribute orderBy, Boolean orderDesc) {
69      this.orderByAttribute = orderBy;
70      this.orderDesc = orderDesc;
71      return this;
72    }
73  
74    public boolean hasOrderByAttribute() {
75      return this.orderByAttribute != null;
76    }
77  }