Coverage Report - org.kuali.rice.kew.web.KeyValueSort
 
Classes in this File Line Coverage Branch Coverage Complexity
KeyValueSort
0%
0/30
0%
0/2
1.143
 
 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.web;
 17  
 
 18  
 import org.apache.commons.lang.StringUtils;
 19  
 import org.kuali.rice.core.api.util.ConcreteKeyValue;
 20  
 import org.kuali.rice.core.api.util.KeyValue;
 21  
 import org.kuali.rice.kew.docsearch.SearchableAttributeValue;
 22  
 
 23  
 
 24  
 /**
 25  
  * A simple bean for storing key/value pairs that can be used for a number of
 26  
  * tasks. Right now it is used to hold information that will be display on a jsp
 27  
  * for drop down boxes.
 28  
  *
 29  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 30  
  */
 31  
 public class KeyValueSort implements KeyValue {
 32  
 
 33  
         private static final long serialVersionUID = 3575440091286391804L;
 34  
 
 35  
         private String userDisplayValue;
 36  
         private Object sortValue;
 37  
     private Class sortClass;
 38  
     private SearchableAttributeValue searchableAttributeValue;
 39  
     private final ConcreteKeyValue keyValue;
 40  
     
 41  
     
 42  0
         public KeyValueSort() {
 43  0
                 keyValue = new ConcreteKeyValue();
 44  0
         }
 45  
 
 46  0
         public KeyValueSort(String key, String value) {
 47  0
                 keyValue = new ConcreteKeyValue(key, value);
 48  0
         }
 49  
 
 50  
     public KeyValueSort(String key, String value, Object sortValue, SearchableAttributeValue searchableAttributeValue) {
 51  0
         this(key,value);
 52  0
         this.sortValue = sortValue;
 53  0
         this.searchableAttributeValue = searchableAttributeValue;
 54  0
     }
 55  
 
 56  
     public KeyValueSort(String key, String value, String userDisplayValue, Object sortValue, SearchableAttributeValue searchableAttributeValue) {
 57  0
             this(key,value,sortValue,searchableAttributeValue);
 58  0
         this.userDisplayValue = userDisplayValue;
 59  0
     }
 60  
 
 61  
     public KeyValueSort(KeyValueSort kvs) {
 62  0
         this(kvs.getKey(),kvs.getValue(),kvs.getUserDisplayValue(),kvs.getSortValue(),kvs.getSearchableAttributeValue());
 63  0
     }
 64  
 
 65  
         public Object getSortValue() {
 66  0
                 return sortValue;
 67  
         }
 68  
 
 69  
         public void setSortValue(Object sortValue) {
 70  0
                 this.sortValue = sortValue;
 71  0
         this.sortClass = sortValue.getClass();
 72  0
         }
 73  
 
 74  
     public Class getSortClass() {
 75  0
         return sortClass;
 76  
     }
 77  
 
 78  
     public SearchableAttributeValue getSearchableAttributeValue() {
 79  0
         return searchableAttributeValue;
 80  
     }
 81  
     
 82  
     public String getUserDisplayValue() {
 83  0
             if (StringUtils.isNotBlank(userDisplayValue)) {
 84  0
                     return userDisplayValue;
 85  
             }
 86  0
             return getValue();
 87  
     }
 88  
 
 89  
         @Override
 90  
         public String getKey() {
 91  0
                 return keyValue.getKey();
 92  
         }
 93  
 
 94  
         @Override
 95  
         public String getValue() {
 96  0
                 return keyValue.getValue();
 97  
         }
 98  
 
 99  
         public void setKey(String k) {
 100  0
                 keyValue.setKey(k);
 101  0
         }
 102  
 
 103  
         public void setValue(String v) {
 104  0
                 keyValue.setValue(v);
 105  0
         }
 106  
 
 107  
 }