Coverage Report - org.kuali.rice.kew.rule.PrincipalIdRoleAttribute
 
Classes in this File Line Coverage Branch Coverage Complexity
PrincipalIdRoleAttribute
0%
0/10
0%
0/2
1.167
 
 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  
 import java.util.ArrayList;
 19  
 import java.util.List;
 20  
 
 21  
 import org.kuali.rice.kew.api.identity.Id;
 22  
 import org.kuali.rice.kew.api.identity.PrincipalId;
 23  
 import org.kuali.rice.kew.api.rule.RoleName;
 24  
 
 25  
 /**
 26  
  * A generic Role Attribute that can be used to route to a Principal ID. Can
 27  
  * take as configuration the label to use for the element name in the XML. This
 28  
  * allows for re-use of this component in different contexts.
 29  
  * 
 30  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 31  
  */
 32  0
 public class PrincipalIdRoleAttribute extends AbstractIdRoleAttribute {
 33  
 
 34  
         private static final long serialVersionUID = 8784036641718163820L;
 35  
 
 36  
         private static final String PRINCIPAL_ID_ROLE_NAME = "principalId";
 37  
         private static final String ATTRIBUTE_ELEMENT = "PrincipalIdRoleAttribute";
 38  
         private static final String PRINCIPAL_ID_ELEMENT = "principalId";
 39  
 
 40  
         public List<RoleName> getRoleNames() {
 41  0
                 List<RoleName> roleNames = new ArrayList<RoleName>();
 42  0
                 roleNames.add(new RoleName(getClass().getName(), PRINCIPAL_ID_ROLE_NAME, "Principal ID"));
 43  0
                 return roleNames;
 44  
         }
 45  
 
 46  
         protected String getAttributeElementName() {
 47  0
                 return ATTRIBUTE_ELEMENT;
 48  
         }
 49  
 
 50  
         protected Id resolveId(String id) {
 51  0
                 return id == null ? null : new PrincipalId(id);
 52  
         }
 53  
 
 54  
         protected String getIdName() {
 55  0
                 return PRINCIPAL_ID_ELEMENT;
 56  
         }
 57  
 
 58  
         public String getPrincipalId() {
 59  0
                 return getIdValue();
 60  
         }
 61  
 
 62  
         public void setPrincipalId(String principalId) {
 63  0
                 setIdValue(principalId);
 64  0
         }
 65  
 
 66  
 }