Coverage Report - org.kuali.rice.kew.util.ResponsibleParty
 
Classes in this File Line Coverage Branch Coverage Complexity
ResponsibleParty
0%
0/35
0%
0/12
1.214
 
 1  
 /*
 2  
  * Copyright 2005-2007 The Kuali Foundation
 3  
  * 
 4  
  * 
 5  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 6  
  * you may not use this file except in compliance with the License.
 7  
  * You may obtain a copy of the License at
 8  
  * 
 9  
  * http://www.opensource.org/licenses/ecl2.php
 10  
  * 
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 package org.kuali.rice.kew.util;
 18  
 
 19  
 import java.io.Serializable;
 20  
 
 21  
 import org.kuali.rice.kew.actionrequest.ActionRequestValue;
 22  
 
 23  
 
 24  
 /**
 25  
  * A user, workgroup, or role who is responsible for an Action Request.
 26  
  * 
 27  
  * @see ActionRequestValue
 28  
  *
 29  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 30  
  */
 31  
 public class ResponsibleParty implements Serializable {
 32  
 
 33  
         private static final long serialVersionUID = 6788236688949489851L;
 34  
 
 35  
         private String principalId;
 36  
     private String groupId;
 37  
     private String roleName;
 38  
 
 39  0
     public ResponsibleParty() {
 40  0
     }
 41  
 
 42  
     public static ResponsibleParty fromGroupId(String groupId) {
 43  0
                 ResponsibleParty responsibleParty = new ResponsibleParty();
 44  0
                 responsibleParty.setGroupId(groupId);
 45  0
                 return responsibleParty;
 46  
         }
 47  
         
 48  
         public static ResponsibleParty fromPrincipalId(String principalId) {
 49  0
                 ResponsibleParty responsibleParty = new ResponsibleParty();
 50  0
                 responsibleParty.setPrincipalId(principalId);
 51  0
                 return responsibleParty;
 52  
         }
 53  
         
 54  
         public static ResponsibleParty fromRoleName(String roleName) {
 55  0
                 ResponsibleParty responsibleParty = new ResponsibleParty();
 56  0
                 responsibleParty.setRoleName(roleName);
 57  0
                 return responsibleParty;
 58  
         }
 59  
 
 60  
     public String toString() {
 61  0
         StringBuffer sb = new StringBuffer("[");
 62  0
         if (principalId != null) {
 63  0
             sb.append("user=");
 64  0
             sb.append(principalId.toString());
 65  0
         } else if (groupId != null) {
 66  0
             sb.append("groupID=");
 67  0
             sb.append(groupId.toString());
 68  0
         } else if (roleName != null) {
 69  0
             sb.append("roleName=");
 70  0
             sb.append(roleName);
 71  
         }
 72  0
         sb.append("]");
 73  0
         return sb.toString();
 74  
     }
 75  
 
 76  
     public String getGroupId() {
 77  0
         return groupId;
 78  
     }
 79  
 
 80  
     public String getPrincipalId() {
 81  0
         return principalId;
 82  
     }
 83  
     
 84  
     public void setPrincipalId(String principalId) {
 85  0
         this.principalId = principalId;
 86  0
     }
 87  
 
 88  
     public String getRoleName() {
 89  0
         return roleName;
 90  
     }
 91  
 
 92  
     public void setGroupId(String groupId) {
 93  0
         this.groupId = groupId;
 94  0
     }
 95  
 
 96  
     public void setRoleName(String roleName) {
 97  0
         this.roleName = roleName;
 98  0
     }
 99  
 
 100  
     public boolean isPrincipal() {
 101  0
         return getPrincipalId() != null;
 102  
     }
 103  
 
 104  
     public boolean isGroup() {
 105  0
         return getGroupId() != null;
 106  
     }
 107  
 
 108  
     public boolean isRole() {
 109  0
         return getRoleName() != null;
 110  
     }
 111  
     
 112  
 }