1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kew.api.action;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.rice.core.api.CoreConstants;
20 import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
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 java.util.Collection;
30
31
32
33
34
35
36
37 @XmlRootElement(name = ActionInvocation.Constants.ROOT_ELEMENT_NAME)
38 @XmlAccessorType(XmlAccessType.NONE)
39 @XmlType(name = ActionInvocation.Constants.TYPE_NAME, propOrder = {
40 ActionInvocation.Elements.ACTION,
41 ActionInvocation.Elements.ACTION_ITEM_ID,
42 CoreConstants.CommonElements.FUTURE_ELEMENTS
43 })
44 public class ActionInvocation extends AbstractDataTransferObject {
45
46 @XmlElement(name = Elements.ACTION, required = true)
47 private final ActionType action;
48
49 @XmlElement(name = Elements.ACTION_ITEM_ID, required = true)
50 private final String actionItemId;
51
52 @SuppressWarnings("unused")
53 @XmlAnyElement
54 private final Collection<Element> _futureElements = null;
55
56 @SuppressWarnings("unused")
57 private ActionInvocation() {
58 this.action = null;
59 this.actionItemId = null;
60 }
61
62 private ActionInvocation(ActionType action, String actionItemId) {
63 if (action == null) {
64 throw new IllegalArgumentException("action was null");
65 }
66 if (StringUtils.isBlank(actionItemId)) {
67 throw new IllegalArgumentException("actionItemId was a null or blank value");
68 }
69 this.actionItemId = actionItemId;
70 this.action = action;
71 }
72
73
74
75
76
77
78
79
80
81
82
83
84 public static ActionInvocation create(ActionType action, String actionItemId) {
85 return new ActionInvocation(action, actionItemId);
86 }
87
88 public ActionType getAction() {
89 return action;
90 }
91
92 public String getActionItemId() {
93 return actionItemId;
94 }
95
96
97
98
99 static class Constants {
100 final static String ROOT_ELEMENT_NAME = "actionInvocation";
101 final static String TYPE_NAME = "ActionInvocationType";
102 }
103
104
105
106
107 static class Elements {
108 final static String ACTION = "action";
109 final static String ACTION_ITEM_ID = "actionItemId";
110 }
111
112 }