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 private ContextSelectionCriteria(String namespaceCode, String name, Map<String, String> contextQualifiers) {
75 this.namespaceCode = namespaceCode;
76 this.name = name;
77 this.contextQualifiers = new HashMap<String, String>();
78 if (contextQualifiers != null) {
79 this.contextQualifiers.putAll(contextQualifiers);
80 }
81 }
82
83 public static ContextSelectionCriteria newCriteria(String namespaceCode, String name, Map<String, String> contextQualifiers) {
84 return new ContextSelectionCriteria(namespaceCode, name, contextQualifiers);
85 }
86
87 public static ContextSelectionCriteria newCriteria(String namespaceCode, Map<String, String> contextQualifiers) {
88 return newCriteria(namespaceCode, null, contextQualifiers);
89 }
90
91 public static ContextSelectionCriteria newCriteria(Map<String, String> contextQualifiers) {
92 return newCriteria(null, contextQualifiers);
93 }
94
95 public String getNamespaceCode() {
96 return this.namespaceCode;
97 }
98
99 public String getName() {
100 return this.name;
101 }
102
103 public Map<String, String> getContextQualifiers() {
104 return this.contextQualifiers;
105 }
106
107
108
109
110 static class Constants {
111 final static String ROOT_ELEMENT_NAME = "contextSelectionCriteria";
112 final static String TYPE_NAME = "ContextSelectionCriteriaType";
113 }
114
115
116
117
118
119 static class Elements {
120 final static String NAMESPACE_CODE = "namespaceCode";
121 final static String NAME = "name";
122 final static String CONTEXT_QUALIFIERS = "contextQualifiers";
123 }
124
125 }