001 /*
002 * Copyright 2007-2009 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.rice.kew.rule;
017
018 import java.util.ArrayList;
019 import java.util.List;
020
021 import org.kuali.rice.kew.identity.EmployeeId;
022 import org.kuali.rice.kew.identity.Id;
023
024
025 /**
026 * A generic Role Attribute that can be used to route to an Empl ID. Can take as configuration the
027 * label to use for the element name in the XML. This allows for re-use of this component in different
028 * contexts.
029 *
030 * @author Kuali Rice Team (rice.collab@kuali.org)
031 */
032 public class UniversityIdRoleAttribute extends AbstractIdRoleAttribute {
033
034 private static final long serialVersionUID = -7258860156654681708L;
035
036 private static final String UNIVERSITY_ID_ROLE_NAME = "universityId";
037 private static final String ATTRIBUTE_ELEMENT = "UniversityIdRoleAttribute";
038 private static final String UNIVERSITY_ID_ELEMENT = "universityId";
039
040 public List<Role> getRoleNames() {
041 List<Role> roleNames = new ArrayList<Role>();
042 roleNames.add(new Role(getClass(), UNIVERSITY_ID_ROLE_NAME, "University ID"));
043 return roleNames;
044 }
045
046 protected String getAttributeElementName() {
047 return ATTRIBUTE_ELEMENT;
048 }
049
050 protected Id resolveId(String id) {
051 return id == null ? null : new EmployeeId(id);
052 }
053
054 protected String getIdName() {
055 return UNIVERSITY_ID_ELEMENT;
056 }
057
058 public String getUniversityId() {
059 return getIdValue();
060 }
061
062 public void setUniversityId(String universityId) {
063 setIdValue(universityId);
064 }
065
066 }