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-2007 The Kuali Foundation
 3  
  *
 4  
  *
 5  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 6  
  * you may not use this file except in compliance with the License.
 7  
  * You may obtain a copy of the License at
 8  
  *
 9  
  * http://www.opensource.org/licenses/ecl2.php
 10  
  *
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 package org.kuali.rice.kew.web;
 18  
 
 19  
 import org.apache.commons.lang.StringUtils;
 20  
 import org.kuali.rice.core.api.util.ConcreteKeyValue;
 21  
 import org.kuali.rice.core.api.util.KeyValue;
 22  
 import org.kuali.rice.kew.docsearch.SearchableAttributeValue;
 23  
 
 24  
 
 25  
 /**
 26  
  * A simple bean for storing key/value pairs that can be used for a number of
 27  
  * tasks. Right now it is used to hold information that will be display on a jsp
 28  
  * for drop down boxes.
 29  
  *
 30  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 31  
  */
 32  
 public class KeyValueSort implements KeyValue {
 33  
 
 34  
         private static final long serialVersionUID = 3575440091286391804L;
 35  
 
 36  
         private String userDisplayValue;
 37  
         private Object sortValue;
 38  
     private Class sortClass;
 39  
     private SearchableAttributeValue searchableAttributeValue;
 40  
     private final ConcreteKeyValue keyValue;
 41  
     
 42  
     
 43  0
         public KeyValueSort() {
 44  0
                 keyValue = new ConcreteKeyValue();
 45  0
         }
 46  
 
 47  0
         public KeyValueSort(String key, String value) {
 48  0
                 keyValue = new ConcreteKeyValue(key, value);
 49  0
         }
 50  
 
 51  
     public KeyValueSort(String key, String value, Object sortValue, SearchableAttributeValue searchableAttributeValue) {
 52  0
         this(key,value);
 53  0
         this.sortValue = sortValue;
 54  0
         this.searchableAttributeValue = searchableAttributeValue;
 55  0
     }
 56  
 
 57  
     public KeyValueSort(String key, String value, String userDisplayValue, Object sortValue, SearchableAttributeValue searchableAttributeValue) {
 58  0
             this(key,value,sortValue,searchableAttributeValue);
 59  0
         this.userDisplayValue = userDisplayValue;
 60  0
     }
 61  
 
 62  
     public KeyValueSort(KeyValueSort kvs) {
 63  0
         this(kvs.getKey(),kvs.getValue(),kvs.getUserDisplayValue(),kvs.getSortValue(),kvs.getSearchableAttributeValue());
 64  0
     }
 65  
 
 66  
         public Object getSortValue() {
 67  0
                 return sortValue;
 68  
         }
 69  
 
 70  
         public void setSortValue(Object sortValue) {
 71  0
                 this.sortValue = sortValue;
 72  0
         this.sortClass = sortValue.getClass();
 73  0
         }
 74  
 
 75  
     public Class getSortClass() {
 76  0
         return sortClass;
 77  
     }
 78  
 
 79  
     public SearchableAttributeValue getSearchableAttributeValue() {
 80  0
         return searchableAttributeValue;
 81  
     }
 82  
     
 83  
     public String getUserDisplayValue() {
 84  0
             if (StringUtils.isNotBlank(userDisplayValue)) {
 85  0
                     return userDisplayValue;
 86  
             }
 87  0
             return getValue();
 88  
     }
 89  
 
 90  
         @Override
 91  
         public String getKey() {
 92  0
                 return keyValue.getKey();
 93  
         }
 94  
 
 95  
         @Override
 96  
         public String getValue() {
 97  0
                 return keyValue.getValue();
 98  
         }
 99  
 
 100  
         public void setKey(String k) {
 101  0
                 keyValue.setKey(k);
 102  0
         }
 103  
 
 104  
         public void setValue(String v) {
 105  0
                 keyValue.setValue(v);
 106  0
         }
 107  
 
 108  
 }