001    package org.kuali.student.common.assembly.data;
002    
003    import java.util.ArrayList;
004    import java.util.List;
005    import java.util.Map;
006    
007    import javax.xml.bind.annotation.XmlElement;
008    import javax.xml.bind.annotation.XmlElementWrapper;
009    
010    import org.kuali.student.common.dictionary.dto.CommonLookup;
011    
012    
013    public class UILookupData extends CommonLookup{
014    
015            private static final long serialVersionUID = 1L;
016            
017               private String id;                           //unique ID of this lookup
018                private String name;                        //name of this search
019                private String desc;
020                private String title;               //advanced search window title
021    
022    //              @XmlElement(name="param")
023    //          @XmlElementWrapper
024    //          private List<LookupParamMetadata> params;
025                
026                @XmlElement(name="result")
027                @XmlElementWrapper
028                private List<LookupResultMetadata> results;
029                
030                private LookupQosMetadata qosMetadata;
031                
032                 
033                private String resultDisplayKey;
034                
035                private String resultSortKey;
036    
037                // how a search criteria will be used. ADVANCED_CUSTOM is shown on both advanced
038                    // and custom screens of the advanced search lightbox
039                //TODO is DEFAULT needed? it has 0 references
040                public enum Usage {
041                    DEFAULT, ADVANCED, CUSTOM, ADVANCED_CUSTOM
042                }
043    
044                private Usage usage;
045                
046                //TODO BUTTON has 0 references. Is it needed?
047                public enum Widget {
048                    NO_WIDGET, SUGGEST_BOX, ADVANCED_LIGHTBOX, DROP_DOWN, BUTTON, CHECKBOX_LIST, RADIO
049                }
050                private Widget widget;    
051    
052                public enum WidgetOption {
053                    ADVANCED_LIGHTBOX_PREVIEW_MODE, ADVANCED_LIGHTBOX_ACTION_LABEL
054                }
055                
056                private Map<WidgetOption, String> widgetOptions;
057                
058                public Map<WidgetOption, String> getWidgetOptions() {
059                    return widgetOptions;
060                }
061                
062                public void setWidgetOptions(Map<WidgetOption, String> widgetOptions) {
063                    this.widgetOptions = widgetOptions;
064                }
065                
066                public String getWidgetOptionValue(WidgetOption widgetOption) {
067                    if (widgetOptions == null) return null;
068                    return widgetOptions.get(widgetOption);
069                }
070    
071                public String getName() {
072                    return name;
073                }
074    
075                public void setName(String name) {
076                    this.name = name;
077                }
078    
079                public String getDesc() {
080                    return desc;
081                }
082    
083                public void setDesc(String desc) {
084                    this.desc = desc;
085                }
086    
087                public String getTitle() {
088                            return title;
089                    }
090    
091                    public void setTitle(String title) {
092                            this.title = title;
093                    }
094                
095    //          public List<LookupParamMetadata> getParams() {
096    //              if (params == null) {
097    //                  params = new ArrayList<LookupParamMetadata>();
098    //              }
099    //              return params;
100    //          }
101    //
102    //          public void setParams(List<LookupParamMetadata> params) {
103    //              this.params = params;
104    //          }
105    
106                public List<LookupResultMetadata> getResults() {
107                    if (results == null) {
108                        results = new ArrayList<LookupResultMetadata>();
109                    }
110                    return results;
111                }
112    
113                public void setResults(List<LookupResultMetadata> results) {
114                    this.results = results;
115                }
116    
117    
118    
119                public String getResultDisplayKey() {
120                    return resultDisplayKey;
121                }
122    
123                public void setResultDisplayKey(String resultDisplayKey) {
124                    this.resultDisplayKey = resultDisplayKey;
125                }
126    
127                public String getResultSortKey() {
128                    return resultSortKey;
129                }
130    
131                public void setResultSortKey(String resultSortKey) {
132                    this.resultSortKey = resultSortKey;
133                }
134    
135                public LookupQosMetadata getQosMetadata() {
136                    return qosMetadata;
137                }
138    
139                public void setQosMetadata(LookupQosMetadata qosMetadata) {
140                    this.qosMetadata = qosMetadata;
141                }
142                
143                public String getId() {
144                    return id;
145                }
146    
147                public void setId(String id) {
148                    this.id = id;
149                }
150    
151                public Usage getUsage() {
152                    return usage;
153                }
154    
155                public void setUsage(Usage usage) {
156                    this.usage = usage;
157                }
158                
159                public Widget getWidget() {
160                            return widget;
161                    }
162    
163                    public void setWidget(Widget widget) {
164                            this.widget = widget;
165                    }
166    
167                public String toString(){
168                    StringBuffer sb = new StringBuffer();
169                    sb.append(id);
170                    sb.append(",");        
171                    sb.append(",");
172                    sb.append(name);
173                    sb.append(",");
174                    sb.append(desc);
175                    return sb.toString();
176                }
177    
178    }