001 /* 002 * Copyright 2005-2007 The Kuali Foundation 003 * 004 * 005 * Licensed under the Educational Community License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * You may obtain a copy of the License at 008 * 009 * http://www.opensource.org/licenses/ecl2.php 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 package org.kuali.rice.kew.web; 018 019 import org.apache.commons.lang.StringUtils; 020 import org.kuali.rice.kew.docsearch.SearchableAttributeValue; 021 022 023 024 /** 025 * A simple bean for storing key/value pairs that can be used for a number of 026 * tasks. Right now it is used to hold information that will be display on a jsp 027 * for drop down boxes. 028 * 029 * @author Kuali Rice Team (rice.collab@kuali.org) 030 */ 031 public class KeyValueSort extends KeyValue { 032 033 private static final long serialVersionUID = 3575440091286391804L; 034 035 private String userDisplayValue; 036 private Object sortValue; 037 private Class sortClass; 038 private SearchableAttributeValue searchableAttributeValue; 039 040 public KeyValueSort() { 041 super(); 042 } 043 044 public KeyValueSort(String key, String value) { 045 super(key,value); 046 } 047 048 public KeyValueSort(String key, String value, Object sortValue, SearchableAttributeValue searchableAttributeValue) { 049 super(key,value); 050 this.sortValue = sortValue; 051 this.searchableAttributeValue = searchableAttributeValue; 052 } 053 054 public KeyValueSort(String key, String value, String userDisplayValue, Object sortValue, SearchableAttributeValue searchableAttributeValue) { 055 this(key,value,sortValue,searchableAttributeValue); 056 this.userDisplayValue = userDisplayValue; 057 } 058 059 public KeyValueSort(KeyValueSort kvs) { 060 this(kvs.getkey(),kvs.getValue(),kvs.getUserDisplayValue(),kvs.getSortValue(),kvs.getSearchableAttributeValue()); 061 } 062 063 public Object getSortValue() { 064 return sortValue; 065 } 066 067 public void setSortValue(Object sortValue) { 068 this.sortValue = sortValue; 069 this.sortClass = sortValue.getClass(); 070 } 071 072 public Class getSortClass() { 073 return sortClass; 074 } 075 076 public SearchableAttributeValue getSearchableAttributeValue() { 077 return searchableAttributeValue; 078 } 079 080 public String getUserDisplayValue() { 081 if (StringUtils.isNotBlank(userDisplayValue)) { 082 return userDisplayValue; 083 } 084 return getValue(); 085 } 086 087 }