1 | |
package org.kuali.rice.krms.api.engine; |
2 | |
|
3 | |
import java.util.Collections; |
4 | |
import java.util.Date; |
5 | |
import java.util.HashMap; |
6 | |
import java.util.Map; |
7 | |
|
8 | |
public final class SelectionCriteria { |
9 | |
|
10 | |
private final Long effectiveExecutionTime; |
11 | |
private final String eventName; |
12 | |
private final Map<String, String> contextQualifiers; |
13 | |
private final Map<String, String> agendaQualifiers; |
14 | |
|
15 | 0 | private SelectionCriteria(String eventName, Date effectiveDate) { |
16 | 0 | if (eventName == null || "".equals(eventName.trim())) { |
17 | 0 | throw new IllegalArgumentException("Event name must not be null or empty."); |
18 | |
} |
19 | 0 | this.eventName = eventName; |
20 | |
|
21 | 0 | if (effectiveDate != null) { |
22 | 0 | this.effectiveExecutionTime = effectiveDate.getTime(); |
23 | |
} else { |
24 | 0 | this.effectiveExecutionTime = null; |
25 | |
} |
26 | |
|
27 | 0 | this.contextQualifiers = new HashMap<String, String>(); |
28 | 0 | this.agendaQualifiers = new HashMap<String, String>(); |
29 | 0 | } |
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
public static SelectionCriteria createCriteria(String eventName, Date effectiveExecutionTime, Map<String, String> contextQualifiers, Map<String, String> agendaQualifiers) { |
41 | 0 | SelectionCriteria criteria = new SelectionCriteria(eventName, effectiveExecutionTime); |
42 | 0 | criteria.contextQualifiers.putAll(contextQualifiers); |
43 | 0 | criteria.agendaQualifiers.putAll(agendaQualifiers); |
44 | 0 | return criteria; |
45 | |
} |
46 | |
|
47 | |
public String getEventName() { |
48 | 0 | return eventName; |
49 | |
} |
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | |
|
57 | |
public Long getEffectiveExecutionTime() { |
58 | 0 | return effectiveExecutionTime; |
59 | |
} |
60 | |
|
61 | |
public Map<String, String> getContextQualifiers() { |
62 | 0 | return Collections.unmodifiableMap(contextQualifiers); |
63 | |
} |
64 | |
|
65 | |
public Map<String, String> getAgendaQualifiers() { |
66 | 0 | return Collections.unmodifiableMap(agendaQualifiers); |
67 | |
} |
68 | |
|
69 | |
} |