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