001: /*
002: * Copyright 2005-2006 The Kuali Foundation.
003: *
004: *
005: * Licensed under the Educational Community License, Version 1.0 (the "License");
006: * you may not use this file except in compliance with the License.
007: * You may obtain a copy of the License at
008: *
009: * http://www.opensource.org/licenses/ecl1.php
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package edu.iu.uis.eden.util;
018:
019: import java.io.Serializable;
020:
021: import edu.iu.uis.eden.actionrequests.ActionRequestValue;
022: import edu.iu.uis.eden.user.UserId;
023: import edu.iu.uis.eden.workgroup.GroupId;
024:
025: /**
026: * A user, workgroup, or role who is responsible for an Action Request.
027: *
028: * @see ActionRequestValue
029: *
030: * @author rkirkend
031: * @author bmcgough
032: */
033: public class ResponsibleParty implements Serializable {
034:
035: private static final long serialVersionUID = 6788236688949489851L;
036:
037: private UserId userId;
038: private GroupId groupId;
039: private String roleName;
040:
041: public ResponsibleParty() {
042: }
043:
044: public ResponsibleParty(GroupId groupId) {
045: this .groupId = groupId;
046: }
047:
048: public ResponsibleParty(UserId userId) {
049: this .userId = userId;
050: }
051:
052: public ResponsibleParty(String roleName) {
053: this .roleName = roleName;
054: }
055:
056: public String toString() {
057: StringBuffer sb = new StringBuffer("[");
058: if (userId != null) {
059: sb.append("user=");
060: sb.append(userId.toString());
061: } else if (groupId != null) {
062: sb.append("workgroupID=");
063: sb.append(groupId.toString());
064: } else if (roleName != null) {
065: sb.append("roleName=");
066: sb.append(roleName);
067: }
068: sb.append("]");
069: return sb.toString();
070: }
071:
072: public GroupId getGroupId() {
073: return groupId;
074: }
075:
076: public UserId getUserId() {
077: return userId;
078: }
079:
080: public String getRoleName() {
081: return roleName;
082: }
083:
084: public void setGroupId(GroupId groupId) {
085: this .groupId = groupId;
086: }
087:
088: public void setRoleName(String roleName) {
089: this .roleName = roleName;
090: }
091:
092: public void setUserId(UserId userId) {
093: this .userId = userId;
094: }
095:
096: public boolean isUser() {
097: return getUserId() != null;
098: }
099:
100: public boolean isWorkgroup() {
101: return getGroupId() != null;
102: }
103:
104: public boolean isRole() {
105: return getRoleName() != null;
106: }
107:
108: }
|