Coverage Report - org.kuali.rice.kew.rule.QualifiedRoleName
 
Classes in this File Line Coverage Branch Coverage Complexity
QualifiedRoleName
0%
0/14
0%
0/4
1.429
 
 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.rule;
 17  
 
 18  
 /**
 19  
  * Helper class that encapsulates a qualified rolename, and can encode and decode to String representation.
 20  
  * 
 21  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 22  
  */
 23  
 public class QualifiedRoleName {
 24  
     private final String baseRoleName;
 25  
     private final String qualifier;
 26  
 
 27  
     public QualifiedRoleName(String baseRoleName) {
 28  0
         this(baseRoleName, null);
 29  0
     }
 30  0
     public QualifiedRoleName(String baseRoleName, String qualifier) {
 31  0
         this.baseRoleName = baseRoleName;
 32  0
         this.qualifier = qualifier;
 33  0
     }
 34  
     public String getBaseRoleName() {
 35  0
         return baseRoleName;
 36  
     }
 37  
     public String getQualifier() {
 38  0
         return qualifier;
 39  
     }
 40  
     public String encode() {
 41  0
         if (qualifier == null) {
 42  0
             return baseRoleName;
 43  
         } else {
 44  0
             return baseRoleName + '\0' + qualifier;
 45  
         }
 46  
     }
 47  
 
 48  
     public static QualifiedRoleName parse(String qualifiedRoleName) {
 49  0
         String[] parts = qualifiedRoleName.split("\0", 2);
 50  0
         return new QualifiedRoleName(parts[0], parts.length > 1 ? parts[1] : null);
 51  
     }
 52  
 
 53  
     public String toString() {
 54  0
         return "[QualifiedRoleName: baseRoleName=" + baseRoleName +
 55  
                                  ", qualifier=" + qualifier + "]";
 56  
     }
 57  
 }