| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| PrincipalName | 
 | 
 | 2.4444444444444446;2.444 | 
| 1 |  /* | |
| 2 |   * Copyright 2007-2009 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.identity; | |
| 17 | ||
| 18 |  import org.kuali.rice.kew.user.UserId; | |
| 19 | ||
| 20 |  /** | |
| 21 |   * The name of a Principal in KIM | |
| 22 |   *  | |
| 23 |   * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 24 |   * | |
| 25 |   */ | |
| 26 | public class PrincipalName implements UserId { | |
| 27 | ||
| 28 |          private String id; | |
| 29 | ||
| 30 |          public PrincipalName() { | |
| 31 | 0 |                  super(); | 
| 32 | 0 |          } | 
| 33 | ||
| 34 | 0 |          public PrincipalName(String principalName) { | 
| 35 | 0 |                  id = principalName; | 
| 36 | 0 |          } | 
| 37 | ||
| 38 |          public String getPrincipalName() { | |
| 39 | 0 |                  return id; | 
| 40 | } | |
| 41 | ||
| 42 | public void setPrincipalName(String principalName) { | |
| 43 | 0 |                  id = principalName; | 
| 44 | 0 |          } | 
| 45 | ||
| 46 | @Override | |
| 47 |          public String getId() { | |
| 48 | 0 |                  return getPrincipalName(); | 
| 49 | } | |
| 50 | ||
| 51 | @Override | |
| 52 | public boolean isEmpty() { | |
| 53 | 0 |                  return id == null || id.trim().length() == 0; | 
| 54 | } | |
| 55 | ||
| 56 | @Override | |
| 57 | public int hashCode() { | |
| 58 | 0 |                  final int prime = 31; | 
| 59 | 0 |                  int result = 1; | 
| 60 | 0 |                  result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); | 
| 61 | 0 |                  return result; | 
| 62 | } | |
| 63 | ||
| 64 | @Override | |
| 65 | public boolean equals(Object obj) { | |
| 66 | 0 |                  if (this == obj) | 
| 67 | 0 |                          return true; | 
| 68 | 0 |                  if (obj == null) | 
| 69 | 0 |                          return false; | 
| 70 | 0 |                  if (getClass() != obj.getClass()) | 
| 71 | 0 |                          return false; | 
| 72 | 0 |                  PrincipalName other = (PrincipalName) obj; | 
| 73 | 0 |                  if (this.id == null) { | 
| 74 | 0 |                          if (other.id != null) | 
| 75 | 0 |                                  return false; | 
| 76 | 0 |                  } else if (!this.id.equals(other.id)) | 
| 77 | 0 |                          return false; | 
| 78 | 0 |                  return true; | 
| 79 | } | |
| 80 | ||
| 81 | @Override | |
| 82 |          public String toString() { | |
| 83 | 0 |                  return "PrincipalName [id=" + this.id + "]"; | 
| 84 | } | |
| 85 | } |