001/**
002 * Copyright 2005-2015 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package edu.sampleu.demo;
017
018import java.util.ArrayList;
019import java.util.Arrays;
020import java.util.List;
021
022/**
023 * @author Kuali Rice Team (rice.collab@kuali.org)
024 */
025public class TestSuggestClass {
026
027    public static List<String> getLanguages(String term) {
028        List<String> matchingLanguages = new ArrayList<String>();
029
030        String[] languageArray =
031                {"ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang",
032                        "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby",
033                        "Scala", "Scheme"};
034
035        for (int i = 0; i < languageArray.length; i++) {
036            String language = languageArray[i];
037            if (language.toLowerCase().startsWith(term.toLowerCase())) {
038                matchingLanguages.add(language);
039            }
040        }
041
042        return matchingLanguages;
043    }
044
045    public static List<String> getAllLanguages() {
046        String[] languageArray =
047                {"ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang",
048                        "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby",
049                        "Scala", "Scheme"};
050
051        return Arrays.asList(languageArray);
052    }
053
054    public static List<TestLabelValue> getRichOptions() {
055        List<TestLabelValue> options = new ArrayList<TestLabelValue>();
056
057        options.add(new TestLabelValue("r1", "<b>Rich Option 1</b><br/><i>this is a desc for option 1</i>"));
058        options.add(new TestLabelValue("r1", "<b>Rich Option 2</b><br/><i>this is a desc for option 2</i>"));
059        options.add(new TestLabelValue("r1", "<b>Rich Option 3</b><br/><i>this is a desc for option 3</i>"));
060
061        return options;
062    }
063
064    public static List<TestSuggestObject> getComplexOptions() {
065        List<TestSuggestObject> options = new ArrayList<TestSuggestObject>();
066
067        options.add(new TestSuggestObject("1", "jhbon", "Bohan, Jack"));
068        options.add(new TestSuggestObject("2", "jmcross", "Cross, Jeff"));
069        options.add(new TestSuggestObject("3", "jomot", "Mot, Joe"));
070
071        return options;
072    }
073
074    public static List<TestLocationObject> getLocationOptions() {
075        List<TestLocationObject> options = new ArrayList<TestLocationObject>();
076
077        options.add(new TestLocationObject(null, "Google", "http://www.google.com"));
078        options.add(new TestLocationObject(null, "Kuali", "http://www.kuali.org"));
079        options.add(new TestLocationObject(null, "Jira", "https://jira.kuali.org"));
080
081        return options;
082    }
083
084    public static List<TestViewObject> getViewOptions() {
085        List<TestViewObject> options = new ArrayList<TestViewObject>();
086
087        options.add(new TestViewObject("UifCompView"));
088        options.add(new TestViewObject("RichMessagesView"));
089        options.add(new TestViewObject("ConfigurationTestView-Collections"));
090        options.add(new TestViewObject("ConfigurationTestView"));
091
092        return options;
093    }
094
095    public static List<TestObject> getObjectOptions(String term) {
096        List<TestObject> options = new ArrayList<TestObject>();
097
098        options.add(new TestObject("Apple", "AppleType", "aaa"));
099        options.add(new TestObject("Orange", "OrangeType", "ooo"));
100        options.add(new TestObject("Strawberry", "StrawberryType", "sss"));
101
102        return options;
103    }
104
105    public static class TestObject {
106        private String name;
107        private String val;
108        private String data;
109
110        public TestObject(String name, String val, String data) {
111            this.name = name;
112            this.val = val;
113            this.data = data;
114        }
115
116        public String getName() {
117            return name;
118        }
119
120        public void setName(String name) {
121            this.name = name;
122        }
123
124        public String getVal() {
125            return val;
126        }
127
128        public void setVal(String val) {
129            this.val = val;
130        }
131
132        public String getData() {
133            return data;
134        }
135
136        public void setData(String data) {
137            this.data = data;
138        }
139    }
140
141    public static class TestViewObject extends TestLabelValue{
142
143        private String id;
144
145        public TestViewObject(String id){
146            super(id, id);
147            this.id = id;
148        }
149
150        public TestViewObject(String value, String label, String id) {
151            super(value, label);
152            this.id = id;
153        }
154
155        public String getId() {
156            return id;
157        }
158
159        public void setId(String id) {
160            this.id = id;
161        }
162    }
163
164    public static class TestLabelValue {
165        private String label;
166        private String value;
167
168        public TestLabelValue() {
169
170        }
171
172        public TestLabelValue(String value, String label) {
173            this.value = value;
174            this.label = label;
175        }
176
177        public String getLabel() {
178            return label;
179        }
180
181        public void setLabel(String label) {
182            this.label = label;
183        }
184
185        public String getValue() {
186            return value;
187        }
188
189        public void setValue(String value) {
190            this.value = value;
191        }
192    }
193
194    public static class TestSuggestObject extends TestLabelValue {
195        private String description;
196
197        public TestSuggestObject(String value, String label, String description) {
198            super(value, label);
199            this.description = description;
200        }
201
202        public String getDescription() {
203            return description;
204        }
205
206        public void setDescription(String description) {
207            this.description = description;
208        }
209    }
210
211    private static class TestLocationObject extends TestLabelValue {
212        private String href;
213
214        public TestLocationObject(String value, String label, String href) {
215            super(value, label);
216            this.href = href;
217        }
218
219        public String getHref() {
220            return href;
221        }
222
223        public void setHref(String href) {
224            this.href = href;
225        }
226
227    }
228}