| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.kuali.rice.kew.api.peopleflow; |
| 17 | |
|
| 18 | |
import org.apache.commons.lang.StringUtils; |
| 19 | |
import org.kuali.rice.core.api.CoreConstants; |
| 20 | |
import org.kuali.rice.core.api.delegation.DelegationType; |
| 21 | |
import org.kuali.rice.core.api.membership.MemberType; |
| 22 | |
import org.kuali.rice.core.api.mo.AbstractDataTransferObject; |
| 23 | |
import org.kuali.rice.core.api.mo.ModelBuilder; |
| 24 | |
import org.kuali.rice.kew.api.action.ActionRequestPolicy; |
| 25 | |
import org.w3c.dom.Element; |
| 26 | |
|
| 27 | |
import javax.xml.bind.annotation.XmlAccessType; |
| 28 | |
import javax.xml.bind.annotation.XmlAccessorType; |
| 29 | |
import javax.xml.bind.annotation.XmlAnyElement; |
| 30 | |
import javax.xml.bind.annotation.XmlElement; |
| 31 | |
import javax.xml.bind.annotation.XmlRootElement; |
| 32 | |
import javax.xml.bind.annotation.XmlType; |
| 33 | |
import java.io.Serializable; |
| 34 | |
import java.util.Collection; |
| 35 | |
|
| 36 | |
@XmlRootElement(name = PeopleFlowDelegate.Constants.ROOT_ELEMENT_NAME) |
| 37 | |
@XmlAccessorType(XmlAccessType.NONE) |
| 38 | |
@XmlType(name = PeopleFlowDelegate.Constants.TYPE_NAME, propOrder = { |
| 39 | |
PeopleFlowDelegate.Elements.MEMBER_ID, |
| 40 | |
PeopleFlowDelegate.Elements.MEMBER_TYPE, |
| 41 | |
PeopleFlowDelegate.Elements.ACTION_REQUEST_POLICY, |
| 42 | |
PeopleFlowDelegate.Elements.DELEGATION_TYPE, |
| 43 | |
PeopleFlowDelegate.Elements.RESPONSIBILITY_ID, |
| 44 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS |
| 45 | |
}) |
| 46 | 0 | public final class PeopleFlowDelegate extends AbstractDataTransferObject implements PeopleFlowDelegateContract { |
| 47 | |
|
| 48 | |
@XmlElement(name = Elements.MEMBER_ID, required = true) |
| 49 | |
private final String memberId; |
| 50 | |
|
| 51 | |
@XmlElement(name = Elements.MEMBER_TYPE, required = true) |
| 52 | |
private final MemberType memberType; |
| 53 | |
|
| 54 | |
@XmlElement(name = Elements.ACTION_REQUEST_POLICY, required = false) |
| 55 | |
private final ActionRequestPolicy actionRequestPolicy; |
| 56 | |
|
| 57 | |
@XmlElement(name = Elements.DELEGATION_TYPE, required = true) |
| 58 | |
private final DelegationType delegationType; |
| 59 | |
|
| 60 | |
@XmlElement(name = Elements.RESPONSIBILITY_ID, required = false) |
| 61 | |
private final String responsibilityId; |
| 62 | |
|
| 63 | 0 | @SuppressWarnings("unused") |
| 64 | |
@XmlAnyElement |
| 65 | |
private final Collection<Element> _futureElements = null; |
| 66 | |
|
| 67 | |
|
| 68 | |
|
| 69 | |
|
| 70 | |
@SuppressWarnings("unused") |
| 71 | 0 | private PeopleFlowDelegate() { |
| 72 | 0 | this.memberId = null; |
| 73 | 0 | this.memberType = null; |
| 74 | 0 | this.actionRequestPolicy = null; |
| 75 | 0 | this.delegationType = null; |
| 76 | 0 | this.responsibilityId = null; |
| 77 | 0 | } |
| 78 | |
|
| 79 | 0 | private PeopleFlowDelegate(Builder builder) { |
| 80 | 0 | this.memberId = builder.getMemberId(); |
| 81 | 0 | this.memberType = builder.getMemberType(); |
| 82 | 0 | this.actionRequestPolicy = builder.getActionRequestPolicy(); |
| 83 | 0 | this.delegationType = builder.getDelegationType(); |
| 84 | 0 | this.responsibilityId = builder.getResponsibilityId(); |
| 85 | 0 | } |
| 86 | |
|
| 87 | |
@Override |
| 88 | |
public String getMemberId() { |
| 89 | 0 | return this.memberId; |
| 90 | |
} |
| 91 | |
|
| 92 | |
@Override |
| 93 | |
public MemberType getMemberType() { |
| 94 | 0 | return this.memberType; |
| 95 | |
} |
| 96 | |
|
| 97 | |
@Override |
| 98 | |
public ActionRequestPolicy getActionRequestPolicy() { |
| 99 | 0 | return actionRequestPolicy; |
| 100 | |
} |
| 101 | |
|
| 102 | |
@Override |
| 103 | |
public DelegationType getDelegationType() { |
| 104 | 0 | return this.delegationType; |
| 105 | |
} |
| 106 | |
|
| 107 | |
@Override |
| 108 | |
public String getResponsibilityId() { |
| 109 | 0 | return responsibilityId; |
| 110 | |
} |
| 111 | |
|
| 112 | |
|
| 113 | |
|
| 114 | |
|
| 115 | |
|
| 116 | |
|
| 117 | 0 | public final static class Builder implements Serializable, ModelBuilder, PeopleFlowDelegateContract { |
| 118 | |
|
| 119 | |
private String memberId; |
| 120 | |
private MemberType memberType; |
| 121 | |
private ActionRequestPolicy actionRequestPolicy; |
| 122 | |
private DelegationType delegationType; |
| 123 | |
private String responsibilityId; |
| 124 | |
|
| 125 | 0 | private Builder(String memberId, MemberType memberType) { |
| 126 | 0 | setMemberId(memberId); |
| 127 | 0 | setMemberType(memberType); |
| 128 | 0 | setDelegationType(DelegationType.SECONDARY); |
| 129 | 0 | } |
| 130 | |
|
| 131 | |
public static Builder create(String memberId, MemberType memberType) { |
| 132 | 0 | return new Builder(memberId, memberType); |
| 133 | |
} |
| 134 | |
|
| 135 | |
public static Builder create(PeopleFlowDelegateContract contract) { |
| 136 | 0 | if (contract == null) { |
| 137 | 0 | throw new IllegalArgumentException("contract was null"); |
| 138 | |
} |
| 139 | 0 | Builder builder = create(contract.getMemberId(), contract.getMemberType()); |
| 140 | 0 | builder.setActionRequestPolicy(contract.getActionRequestPolicy()); |
| 141 | 0 | builder.setDelegationType(contract.getDelegationType()); |
| 142 | 0 | builder.setResponsibilityId(contract.getResponsibilityId()); |
| 143 | 0 | return builder; |
| 144 | |
} |
| 145 | |
|
| 146 | |
public PeopleFlowDelegate build() { |
| 147 | 0 | return new PeopleFlowDelegate(this); |
| 148 | |
} |
| 149 | |
|
| 150 | |
@Override |
| 151 | |
public String getMemberId() { |
| 152 | 0 | return this.memberId; |
| 153 | |
} |
| 154 | |
|
| 155 | |
@Override |
| 156 | |
public MemberType getMemberType() { |
| 157 | 0 | return this.memberType; |
| 158 | |
} |
| 159 | |
|
| 160 | |
@Override |
| 161 | |
public ActionRequestPolicy getActionRequestPolicy() { |
| 162 | 0 | return actionRequestPolicy; |
| 163 | |
} |
| 164 | |
|
| 165 | |
@Override |
| 166 | |
public DelegationType getDelegationType() { |
| 167 | 0 | return this.delegationType; |
| 168 | |
} |
| 169 | |
|
| 170 | |
@Override |
| 171 | |
public String getResponsibilityId() { |
| 172 | 0 | return responsibilityId; |
| 173 | |
} |
| 174 | |
|
| 175 | |
public void setMemberId(String memberId) { |
| 176 | 0 | if (StringUtils.isBlank(memberId)) { |
| 177 | 0 | throw new IllegalArgumentException("memberId was a null or blank value"); |
| 178 | |
} |
| 179 | 0 | this.memberId = memberId; |
| 180 | 0 | } |
| 181 | |
|
| 182 | |
public void setMemberType(MemberType memberType) { |
| 183 | 0 | if (memberType == null) { |
| 184 | 0 | throw new IllegalArgumentException("memberType was null"); |
| 185 | |
} |
| 186 | 0 | this.memberType = memberType; |
| 187 | 0 | } |
| 188 | |
|
| 189 | |
public void setActionRequestPolicy(ActionRequestPolicy actionRequestPolicy) { |
| 190 | 0 | this.actionRequestPolicy = actionRequestPolicy; |
| 191 | 0 | } |
| 192 | |
|
| 193 | |
public void setDelegationType(DelegationType delegationType) { |
| 194 | 0 | if (delegationType == null) { |
| 195 | 0 | throw new IllegalArgumentException("delegationType was null"); |
| 196 | |
} |
| 197 | 0 | this.delegationType = delegationType; |
| 198 | 0 | } |
| 199 | |
|
| 200 | |
public void setResponsibilityId(String responsibilityId) { |
| 201 | 0 | this.responsibilityId = responsibilityId; |
| 202 | 0 | } |
| 203 | |
|
| 204 | |
} |
| 205 | |
|
| 206 | |
|
| 207 | |
|
| 208 | |
|
| 209 | 0 | static class Constants { |
| 210 | |
final static String ROOT_ELEMENT_NAME = "peopleFlowDelegate"; |
| 211 | |
final static String TYPE_NAME = "PeopleFlowDelegateType"; |
| 212 | |
} |
| 213 | |
|
| 214 | |
|
| 215 | |
|
| 216 | |
|
| 217 | 0 | static class Elements { |
| 218 | |
final static String MEMBER_ID = "memberId"; |
| 219 | |
final static String MEMBER_TYPE = "memberType"; |
| 220 | |
final static String ACTION_REQUEST_POLICY = "actionRequestPolicy"; |
| 221 | |
final static String DELEGATION_TYPE = "delegationType"; |
| 222 | |
final static String RESPONSIBILITY_ID = "responsibilityId"; |
| 223 | |
} |
| 224 | |
|
| 225 | |
} |