1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.fosstrak.epcis.repository.query;
22
23 import java.util.ArrayList;
24 import java.util.List;
25
26
27
28
29
30
31 public class SimpleEventQueryDTO {
32
33 private List<EventQueryParam> eventQueryParams;
34
35 protected String eventType;
36 private int maxEventCount = -1;
37 private int limit = -1;
38 private String orderBy = null;
39 private OrderDirection orderDirection = null;
40 private boolean isAnyEpc = false;
41
42 public enum OrderDirection {
43 ASC, DESC
44 }
45
46 public enum Operation {
47 EQ, LT, GT, LE, GE, HASATTR, EQATTR, MATCH, WD, EXISTS
48 }
49
50 public SimpleEventQueryDTO(String eventType) {
51 this.eventType = eventType;
52 resetQuery();
53 }
54
55 public void addEventQueryParam(String eventField, Operation op, Object value) {
56 eventQueryParams.add(new EventQueryParam(eventField, op, value));
57 }
58
59 public void addEventQueryParam(EventQueryParam queryParam) {
60 eventQueryParams.add(queryParam);
61 }
62
63 public String getEventType() {
64 return eventType;
65 }
66
67 public int getLimit() {
68 return limit;
69 }
70
71 public int getMaxEventCount() {
72 return maxEventCount;
73 }
74
75 public List<EventQueryParam> getEventQueryParams() {
76 return eventQueryParams;
77 }
78
79 public String getOrderBy() {
80 return orderBy;
81 }
82
83 public OrderDirection getOrderDirection() {
84 return orderDirection;
85 }
86
87 public boolean isAnyEpc() {
88 return isAnyEpc;
89 }
90
91 public void setIsAnyEpc(boolean isAnyEpc) {
92 this.isAnyEpc = isAnyEpc;
93 }
94
95 public void setLimit(int limit) {
96 this.limit = limit;
97 }
98
99 public void setMaxEventCount(int maxEventCount) {
100 this.maxEventCount = maxEventCount;
101 }
102
103 public void setOrderBy(String orderBy) {
104 this.orderBy = orderBy;
105 }
106
107 public void setOrderDirection(OrderDirection orderDirection) {
108 this.orderDirection = orderDirection;
109 }
110
111 public void resetQuery() {
112 eventQueryParams = new ArrayList<EventQueryParam>();
113 maxEventCount = -1;
114 limit = -1;
115 orderBy = null;
116 orderDirection = null;
117 isAnyEpc = false;
118 }
119
120 public static class EventQueryParam {
121 private String eventField;
122 private Operation op;
123 private Object value;
124
125 public EventQueryParam() {
126 }
127
128 public EventQueryParam(String eventField, Operation op, Object value) {
129 this.eventField = eventField;
130 this.op = op;
131 this.value = value;
132 }
133
134 public String getEventField() {
135 return eventField;
136 }
137
138 public void setEventField(String eventField) {
139 this.eventField = eventField;
140 }
141
142 public Operation getOp() {
143 return op;
144 }
145
146 public void setOp(Operation op) {
147 this.op = op;
148 }
149
150 public Object getValue() {
151 return value;
152 }
153
154 public void setValue(Object value) {
155 this.value = value;
156 }
157 }
158 }