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