1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krms.api.repository.context;
17
18 import org.kuali.rice.core.api.CoreConstants;
19 import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
20 import org.kuali.rice.core.api.util.jaxb.MapStringStringAdapter;
21 import org.w3c.dom.Element;
22
23 import javax.xml.bind.annotation.XmlAccessType;
24 import javax.xml.bind.annotation.XmlAccessorType;
25 import javax.xml.bind.annotation.XmlAnyElement;
26 import javax.xml.bind.annotation.XmlElement;
27 import javax.xml.bind.annotation.XmlRootElement;
28 import javax.xml.bind.annotation.XmlType;
29 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
30 import java.util.Collection;
31 import java.util.HashMap;
32 import java.util.Map;
33
34
35
36
37
38
39
40 @XmlRootElement(name = ContextSelectionCriteria.Constants.ROOT_ELEMENT_NAME)
41 @XmlAccessorType(XmlAccessType.NONE)
42 @XmlType(name = ContextSelectionCriteria.Constants.TYPE_NAME, propOrder = {
43 ContextSelectionCriteria.Elements.NAMESPACE_CODE,
44 ContextSelectionCriteria.Elements.NAME,
45 ContextSelectionCriteria.Elements.CONTEXT_QUALIFIERS,
46 CoreConstants.CommonElements.FUTURE_ELEMENTS
47 })
48 public final class ContextSelectionCriteria extends AbstractDataTransferObject {
49
50 @XmlElement(name = Elements.NAMESPACE_CODE, required = true)
51 private final String namespaceCode;
52
53 @XmlElement(name = Elements.NAME, required = false)
54 private final String name;
55
56 @XmlElement(name = Elements.CONTEXT_QUALIFIERS)
57 @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
58 private final Map<String, String> contextQualifiers;
59
60 @SuppressWarnings("unused")
61 @XmlAnyElement
62 private final Collection<Element> _futureElements = null;
63
64
65
66
67 @SuppressWarnings("unused")
68 private ContextSelectionCriteria() {
69 this.namespaceCode = null;
70 this.name = null;
71 this.contextQualifiers = null;
72 }
73
74
75
76
77 private ContextSelectionCriteria(String namespaceCode, String name, Map<String, String> contextQualifiers) {
78 this.namespaceCode = namespaceCode;
79 this.name = name;
80 this.contextQualifiers = new HashMap<String, String>();
81 if (contextQualifiers != null) {
82 this.contextQualifiers.putAll(contextQualifiers);
83 }
84 }
85
86
87
88
89
90
91
92
93
94 public static ContextSelectionCriteria newCriteria(String namespaceCode, String name, Map<String, String> contextQualifiers) {
95 return new ContextSelectionCriteria(namespaceCode, name, contextQualifiers);
96 }
97
98
99
100
101
102
103
104
105 public static ContextSelectionCriteria newCriteria(String namespaceCode, Map<String, String> contextQualifiers) {
106 return newCriteria(namespaceCode, null, contextQualifiers);
107 }
108
109
110
111
112
113
114
115 public static ContextSelectionCriteria newCriteria(Map<String, String> contextQualifiers) {
116 return newCriteria(null, contextQualifiers);
117 }
118
119
120
121
122
123 public String getNamespaceCode() {
124 return this.namespaceCode;
125 }
126
127
128
129
130
131 public String getName() {
132 return this.name;
133 }
134
135
136
137
138
139 public Map<String, String> getContextQualifiers() {
140 return this.contextQualifiers;
141 }
142
143
144
145
146 static class Constants {
147 final static String ROOT_ELEMENT_NAME = "contextSelectionCriteria";
148 final static String TYPE_NAME = "ContextSelectionCriteriaType";
149 }
150
151
152
153
154
155 static class Elements {
156 final static String NAMESPACE_CODE = "namespaceCode";
157 final static String NAME = "name";
158 final static String CONTEXT_QUALIFIERS = "contextQualifiers";
159 }
160
161 }