Coverage Report - org.kuali.rice.core.api.uif.RemotableQuickFinder
 
Classes in this File Line Coverage Branch Coverage Complexity
RemotableQuickFinder
0%
0/18
N/A
1.235
RemotableQuickFinder$1
N/A
N/A
1.235
RemotableQuickFinder$Builder
0%
0/25
0%
0/6
1.235
RemotableQuickFinder$Constants
0%
0/1
N/A
1.235
RemotableQuickFinder$Elements
0%
0/1
N/A
1.235
 
 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.core.api.uif;
 17  
 
 18  
 import org.apache.commons.lang.StringUtils;
 19  
 import org.kuali.rice.core.api.CoreConstants;
 20  
 import org.kuali.rice.core.api.util.jaxb.MapStringStringAdapter;
 21  
 import org.w3c.dom.Element;
 22  
 
 23  
 import javax.xml.bind.annotation.XmlAccessType;
 24  
 import javax.xml.bind.annotation.XmlAccessorType;
 25  
 import javax.xml.bind.annotation.XmlAnyElement;
 26  
 import javax.xml.bind.annotation.XmlElement;
 27  
 import javax.xml.bind.annotation.XmlRootElement;
 28  
 import javax.xml.bind.annotation.XmlType;
 29  
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 30  
 import java.util.Collection;
 31  
 import java.util.Collections;
 32  
 import java.util.HashMap;
 33  
 import java.util.Map;
 34  
 
 35  
 /**
 36  
  * A quick finder widget that can be used by a TextInput, HiddenInput, Select, or MultiSelect control types.
 37  
  */
 38  
 @XmlRootElement(name = RemotableQuickFinder.Constants.ROOT_ELEMENT_NAME)
 39  
 @XmlAccessorType(XmlAccessType.NONE)
 40  
 @XmlType(name = RemotableQuickFinder.Constants.TYPE_NAME, propOrder = {
 41  
                 RemotableQuickFinder.Elements.BASE_LOOKUP_URL,
 42  
         RemotableQuickFinder.Elements.DATA_OBJECT_CLASS,
 43  
         RemotableQuickFinder.Elements.LOOKUP_PARAMETERS,
 44  
         RemotableQuickFinder.Elements.FIELD_CONVERSIONS,
 45  
                 CoreConstants.CommonElements.FUTURE_ELEMENTS })
 46  0
 public final class RemotableQuickFinder extends RemotableAbstractWidget {
 47  
 
 48  
     @XmlElement(name = Elements.BASE_LOOKUP_URL, required = false)
 49  
     private final String baseLookupUrl;
 50  
 
 51  
     @XmlElement(name = Elements.DATA_OBJECT_CLASS, required = true)
 52  
     private final String dataObjectClass;
 53  
 
 54  
     @XmlElement(name = Elements.LOOKUP_PARAMETERS, required = false)
 55  
     @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
 56  
     private final Map<String, String> lookupParameters;
 57  
 
 58  
     @XmlElement(name = Elements.FIELD_CONVERSIONS, required = false)
 59  
     @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
 60  
     private final Map<String, String> fieldConversions;
 61  
 
 62  0
     @SuppressWarnings("unused")
 63  
     @XmlAnyElement
 64  
     private final Collection<Element> _futureElements = null;
 65  
 
 66  
     /**
 67  
      * Should only be invoked by JAXB.
 68  
      */
 69  
     @SuppressWarnings("unused")
 70  0
     private RemotableQuickFinder() {
 71  0
         baseLookupUrl = null;
 72  0
         dataObjectClass = null;
 73  0
         lookupParameters = null;
 74  0
         fieldConversions = null;
 75  0
     }
 76  
 
 77  0
     private RemotableQuickFinder(Builder b) {
 78  0
         baseLookupUrl = b.baseLookupUrl;
 79  0
         dataObjectClass = b.dataObjectClass;
 80  0
         lookupParameters = b.lookupParameters;
 81  0
         fieldConversions = b.fieldConversions;
 82  0
     }
 83  
 
 84  
     public String getBaseLookupUrl() {
 85  0
         return baseLookupUrl;
 86  
     }
 87  
 
 88  
     public String getDataObjectClass() {
 89  0
         return dataObjectClass;
 90  
     }
 91  
 
 92  
     public Map<String, String> getLookupParameters() {
 93  0
         return Collections.unmodifiableMap(lookupParameters);
 94  
     }
 95  
 
 96  
     public Map<String, String> getFieldConversions() {
 97  0
         return Collections.unmodifiableMap(fieldConversions);
 98  
     }
 99  
 
 100  0
     public static final class Builder extends RemotableAbstractWidget.Builder {
 101  
         private String baseLookupUrl;
 102  
         private String dataObjectClass;
 103  0
         private Map<String, String> lookupParameters = Collections.emptyMap();
 104  0
         private Map<String, String> fieldConversions = Collections.emptyMap();
 105  
 
 106  0
         private Builder(String baseLookupUrl, String dataObjectClass) {
 107  0
             setBaseLookupUrl(baseLookupUrl);
 108  0
             setDataObjectClass(dataObjectClass);
 109  0
         }
 110  
 
 111  
         public static Builder create(String baseLookupUrl, String dataObjectClass) {
 112  0
             return new Builder(baseLookupUrl, dataObjectClass);
 113  
         }
 114  
 
 115  
         public String getBaseLookupUrl() {
 116  0
             return baseLookupUrl;
 117  
         }
 118  
 
 119  
         public void setBaseLookupUrl(String baseLookupUrl) {
 120  
             /*if (StringUtils.isBlank(baseLookupUrl)) {
 121  
                 throw new IllegalArgumentException("baseLookupUrl is blank");
 122  
             }*/
 123  
 
 124  0
             this.baseLookupUrl = baseLookupUrl;
 125  0
         }
 126  
 
 127  
         public String getDataObjectClass() {
 128  0
             return dataObjectClass;
 129  
         }
 130  
 
 131  
         public void setDataObjectClass(String dataObjectClass) {
 132  0
             if (StringUtils.isBlank(dataObjectClass)) {
 133  0
                 throw new IllegalArgumentException("dataObjectClass is blank");
 134  
             }
 135  
 
 136  0
             this.dataObjectClass = dataObjectClass;
 137  0
         }
 138  
 
 139  
         public Map<String, String> getLookupParameters() {
 140  0
             return Collections.unmodifiableMap(lookupParameters);
 141  
         }
 142  
 
 143  
         public void setLookupParameters(Map<String, String> lookupParameters) {
 144  0
             if (lookupParameters != null) {
 145  0
                 this.lookupParameters = new HashMap<String, String>(lookupParameters);
 146  
             }
 147  0
         }
 148  
 
 149  
         public Map<String, String> getFieldConversions() {
 150  0
             return Collections.unmodifiableMap(fieldConversions);
 151  
         }
 152  
 
 153  
         public void setFieldConversions(Map<String, String> fieldConversions) {
 154  0
             if (fieldConversions != null) {
 155  0
                 this.fieldConversions = new HashMap<String, String>(fieldConversions);
 156  
             }
 157  0
         }
 158  
 
 159  
         @Override
 160  
         public RemotableQuickFinder build() {
 161  0
             return new RemotableQuickFinder(this);
 162  
         }
 163  
     }
 164  
 
 165  
     /**
 166  
      * Defines some internal constants used on this class.
 167  
      */
 168  0
     static final class Constants {
 169  
         static final String TYPE_NAME = "QuickFinderType";
 170  
         final static String ROOT_ELEMENT_NAME = "quickFinder";
 171  
     }
 172  
 
 173  0
     static final class Elements {
 174  
         static final String BASE_LOOKUP_URL = "baseLookupUrl";
 175  
         static final String DATA_OBJECT_CLASS = "dataObjectClass";
 176  
         static final String LOOKUP_PARAMETERS = "lookupParameters";
 177  
         static final String FIELD_CONVERSIONS = "fieldConversions";
 178  
     }
 179  
 }