View Javadoc

1   /**
2    * Copyright 2010 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
14   */
15  
16  package org.kuali.student.core.assembly.data;
17  
18  import java.io.Serializable;
19  import java.util.ArrayList;
20  import java.util.List;
21  import java.util.Map;
22  
23  public class LookupMetadata implements Serializable {
24  
25      private static final long serialVersionUID = 1L;
26      
27      private String id;				//unique ID of this lookup
28      private String searchTypeId;    //id of search type defined in search xml
29      private String name;			//name of this search
30      private String desc;
31      private String title;   		//advanced search window title
32  
33      private List<LookupParamMetadata> params;
34      
35      private List<LookupResultMetadata> results;
36      
37      private LookupQosMetadata qosMetadata;
38      
39      private String searchParamIdKey;
40      
41      private String resultReturnKey;
42      
43      private String resultDisplayKey;
44      
45      private String resultSortKey;
46  
47      // how a search criteria will be used. ADVANCED_CUSTOM is shown on both advanced
48  	// and custom screens of the advanced search lightbox
49      //TODO is DEFAULT needed? it has 0 references
50      public enum Usage {
51          DEFAULT, ADVANCED, CUSTOM, ADVANCED_CUSTOM
52      }
53  
54      private Usage usage;
55      
56      //TODO BUTTON has 0 references. Is it needed?
57      public enum Widget {
58          NO_WIDGET, SUGGEST_BOX, ADVANCED_LIGHTBOX, DROP_DOWN, BUTTON, CHECKBOX_LIST, RADIO
59      }
60      private Widget widget;    
61  
62      public enum WidgetOption {
63          ADVANCED_LIGHTBOX_PREVIEW_MODE, ADVANCED_LIGHTBOX_ACTION_LABEL
64      }
65      
66      private Map<WidgetOption, String> widgetOptions;
67      
68      public Map<WidgetOption, String> getWidgetOptions() {
69          return widgetOptions;
70      }
71      
72      public void setWidgetOptions(Map<WidgetOption, String> widgetOptions) {
73          this.widgetOptions = widgetOptions;
74      }
75      
76      public String getWidgetOptionValue(WidgetOption widgetOption) {
77          if (widgetOptions == null) return null;
78          return widgetOptions.get(widgetOption);
79      }
80  
81      public String getName() {
82          return name;
83      }
84  
85      public void setName(String name) {
86          this.name = name;
87      }
88  
89      public String getDesc() {
90          return desc;
91      }
92  
93      public void setDesc(String desc) {
94          this.desc = desc;
95      }
96  
97      public String getTitle() {
98  		return title;
99  	}
100 
101 	public void setTitle(String title) {
102 		this.title = title;
103 	}
104     
105     public List<LookupParamMetadata> getParams() {
106         if (params == null) {
107             params = new ArrayList<LookupParamMetadata>();
108         }
109         return params;
110     }
111 
112     public void setParams(List<LookupParamMetadata> params) {
113         this.params = params;
114     }
115 
116     public List<LookupResultMetadata> getResults() {
117         if (results == null) {
118             results = new ArrayList<LookupResultMetadata>();
119         }
120         return results;
121     }
122 
123     public void setResults(List<LookupResultMetadata> results) {
124         this.results = results;
125     }
126 
127     public String getSearchTypeId() {
128         return searchTypeId;
129     }
130 
131     public void setSearchTypeId(String searchTypeId) {
132         this.searchTypeId = searchTypeId;
133     }
134 
135     public String getResultReturnKey() {
136         return resultReturnKey;
137     }
138 
139     public void setResultReturnKey(String resultReturnKey) {
140         this.resultReturnKey = resultReturnKey;
141     }
142 
143     public String getResultDisplayKey() {
144         return resultDisplayKey;
145     }
146 
147     public void setResultDisplayKey(String resultDisplayKey) {
148         this.resultDisplayKey = resultDisplayKey;
149     }
150 
151     public String getResultSortKey() {
152         return resultSortKey;
153     }
154 
155     public void setResultSortKey(String resultSortKey) {
156         this.resultSortKey = resultSortKey;
157     }
158 
159     public LookupQosMetadata getQosMetadata() {
160         return qosMetadata;
161     }
162 
163     public void setQosMetadata(LookupQosMetadata qosMetadata) {
164         this.qosMetadata = qosMetadata;
165     }
166 
167 	public String getSearchParamIdKey() {
168 		return searchParamIdKey;
169 	}
170 
171 	public void setSearchParamIdKey(String searchParamIdKey) {
172 		this.searchParamIdKey = searchParamIdKey;
173 	}
174     
175     public String getId() {
176         return id;
177     }
178 
179     public void setId(String id) {
180         this.id = id;
181     }
182 
183     /**
184     * @deprecated not used so eventually want to remove
185     */
186     public Usage getUsage() {
187         return usage;
188     }
189 
190     /**
191     * @deprecated not used so eventually want to remove
192     */
193     public void setUsage(Usage usage) {
194         this.usage = usage;
195     }
196     
197     public Widget getWidget() {
198 		return widget;
199 	}
200 
201 	public void setWidget(Widget widget) {
202 		this.widget = widget;
203 	}
204 
205     public String toString(){
206         StringBuffer sb = new StringBuffer();
207         sb.append(id);
208         sb.append(",");        
209         sb.append(searchTypeId);
210         sb.append(",");
211         sb.append(name);
212         sb.append(",");
213         sb.append(desc);
214         return sb.toString();
215     }
216 }