Coverage Report - org.kuali.rice.kew.rule.WorkgroupRoleAttribute
 
Classes in this File Line Coverage Branch Coverage Complexity
WorkgroupRoleAttribute
0%
0/14
0%
0/2
1.333
 
 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.rule;
 17  
 
 18  
 import java.util.ArrayList;
 19  
 import java.util.List;
 20  
 
 21  
 import org.apache.commons.lang.StringUtils;
 22  
 import org.kuali.rice.kew.identity.Id;
 23  
 import org.kuali.rice.kew.util.Utilities;
 24  
 import org.kuali.rice.kew.workgroup.GroupNameId;
 25  
 
 26  
 /**
 27  
  * A generic Role Attribute that can be used to route to a Workgroup Name.  Can take as configuration the
 28  
  * label to use for the element name in the XML.  This allows for re-use of this component in different
 29  
  * contexts.
 30  
  * 
 31  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 32  
  */
 33  0
 public class WorkgroupRoleAttribute extends AbstractIdRoleAttribute {
 34  
 
 35  
     private static final long serialVersionUID = 5562142284908152678L;
 36  
     
 37  
     private static final String WORKGROUP_ROLE_NAME = "workgroupName";
 38  
     private static final String ATTRIBUTE_ELEMENT = "WorkgroupRoleAttribute";
 39  
     private static final String WORKGROUP_ELEMENT = "workgroupName";
 40  
         
 41  
     public List<Role> getRoleNames() {
 42  0
         List<Role> roleNames = new ArrayList<Role>();
 43  0
         roleNames.add(new Role(getClass(), WORKGROUP_ROLE_NAME, "Workgroup Name"));
 44  0
         return roleNames;
 45  
     }
 46  
     
 47  
     protected String getAttributeElementName() {
 48  0
         return ATTRIBUTE_ELEMENT;
 49  
     }
 50  
     
 51  
     protected Id resolveId(String id) {
 52  0
             if (StringUtils.isBlank(id)) {
 53  0
                     return null;
 54  
             }
 55  0
             String groupName = Utilities.parseGroupName(id);
 56  0
             String namespace = Utilities.parseGroupNamespaceCode(id);
 57  0
             return new GroupNameId(namespace, groupName);
 58  
     }
 59  
     
 60  
     protected String getIdName() {
 61  0
         return WORKGROUP_ELEMENT;
 62  
     }
 63  
 
 64  
     public String getWorkgroupName() {
 65  0
         return getIdValue();
 66  
     }
 67  
 
 68  
     public void setWorkgroupName(String workgroupName) {
 69  0
         setIdValue(workgroupName);
 70  0
     }
 71  
 
 72  
 }