View Javadoc
1   /**
2    * Copyright 2005-2015 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.krad.labs;
17  
18  import org.kuali.rice.krad.web.controller.UifControllerBase;
19  import org.kuali.rice.krad.web.form.UifFormBase;
20  import org.springframework.stereotype.Controller;
21  import org.springframework.validation.BindingResult;
22  import org.springframework.web.bind.annotation.ModelAttribute;
23  import org.springframework.web.bind.annotation.RequestMapping;
24  import org.springframework.web.servlet.ModelAndView;
25  
26  import java.io.*;
27  import java.net.*;
28  
29  import javax.json.*;
30  
31  import javax.servlet.http.HttpServletRequest;
32  import javax.servlet.http.HttpServletResponse;
33  import java.util.ArrayList;
34  import java.util.List;
35  
36  /**
37   * This class is the controller class for kitchen sink performance page.
38   *
39   * @author Kuali Student Team
40   */
41  @Controller
42  @RequestMapping(value = "/kitchensinkperformance")
43  public class KitchenSinkPerformanceController extends UifControllerBase {
44  
45      public static final String KUALI_ATP_2012_FALL = "kuali.atp.2012Fall";
46  //    ScheduleOfClassesService scheduleOfClassesService;
47  
48      /**
49       * @see org.kuali.rice.krad.web.controller.UifControllerBase#createInitialForm(javax.servlet.http.HttpServletRequest)
50       */
51      @Override
52      protected KitchenSinkPerformanceForm createInitialForm() {
53          return new KitchenSinkPerformanceForm();
54      }
55  
56      @Override
57      @RequestMapping(params = "methodToCall=start")
58      public ModelAndView start(UifFormBase form) {
59          KitchenSinkPerformanceForm perfForm = (KitchenSinkPerformanceForm) form;
60  
61          return getModelAndView(perfForm);
62      }
63  
64      /**
65       *  This method takes the user input (int) and generates a collection with that many rows. That collection is saved
66       *  to the form object so it can be displayed on the page.
67       * @param form    KitchenSinkPerformanceForm
68       * @param result
69       * @param request
70       * @param response
71       * @return    ModelAndView
72       */
73      @RequestMapping(params = "methodToCall=buildcollection")
74      public ModelAndView buildCollection(@ModelAttribute("KualiForm") KitchenSinkPerformanceForm form, BindingResult result,
75              HttpServletRequest request, HttpServletResponse response) {
76  
77          String courseCode = form.getInputOne(); // get input from page
78          String termId = KUALI_ATP_2012_FALL;
79          String termCode = "201208";
80          String temp = "[\n"
81                  + "   {\n"
82                  + "      \"courseOfferingId\":\"9e89ed85-66ba-4a9c-9765-c36e78929051\",\n"
83                  + "      \"courseOfferingCode\":\"CHEM105\",\n"
84                  + "      \"courseOfferingDesc\":\"Fundamental of Organic and Biochemistry\",\n"
85                  + "      \"courseOfferingCreditOptionDisplay\":\"3.0\",\n"
86                  + "      \"courseOfferingGradingOptionDisplay\":\"Letter\",\n"
87                  + "      \"studentSelectablePassFail\":true,\n"
88                  + "      \"auditCourse\":true,\n"
89                  + "      \"honorsCourse\":false\n"
90                  + "   },\n"
91                  + "   {\n"
92                  + "      \"courseOfferingId\":\"25a7e006-e71a-4d5d-806c-04675f365222\",\n"
93                  + "      \"courseOfferingCode\":\"CHEM131\",\n"
94                  + "      \"courseOfferingDesc\":\"Chemistry I - Fundamentals of General Chemistry\",\n"
95                  + "      \"courseOfferingCreditOptionDisplay\":\"3.0\",\n"
96                  + "      \"courseOfferingGradingOptionDisplay\":\"Allow students to audit\",\n"
97                  + "      \"studentSelectablePassFail\":true,\n"
98                  + "      \"auditCourse\":true,\n"
99                  + "      \"honorsCourse\":false\n"
100                 + "   },\n"
101                 + "   {\n"
102                 + "      \"courseOfferingId\":\"ea618cb3-8583-4833-bbe3-43c7961f70fb\",\n"
103                 + "      \"courseOfferingCode\":\"CHEM131S\",\n"
104                 + "      \"courseOfferingDesc\":\"Chemistry I - Fundamentals of General Chemistry\",\n"
105                 + "      \"courseOfferingCreditOptionDisplay\":\"3.0\",\n"
106                 + "      \"courseOfferingGradingOptionDisplay\":\"Allow students to audit\",\n"
107                 + "      \"studentSelectablePassFail\":true,\n"
108                 + "      \"auditCourse\":true,\n"
109                 + "      \"honorsCourse\":false\n"
110                 + "   },\n"
111                 + "   {\n"
112                 + "      \"courseOfferingId\":\"ee786c4b-57c9-4237-9519-4bdb961ca5d4\",\n"
113                 + "      \"courseOfferingCode\":\"CHEM132\",\n"
114                 + "      \"courseOfferingDesc\":\"General Chemistry I Laboratory\",\n"
115                 + "      \"courseOfferingCreditOptionDisplay\":\"1.0\",\n"
116                 + "      \"courseOfferingGradingOptionDisplay\":\"Letter\",\n"
117                 + "      \"studentSelectablePassFail\":true,\n"
118                 + "      \"auditCourse\":false,\n"
119                 + "      \"honorsCourse\":false\n"
120                 + "   },\n"
121                 + "   {\n"
122                 + "      \"courseOfferingId\":\"56802cf2-5577-4163-9fa7-a356396e8d45\",\n"
123                 + "      \"courseOfferingCode\":\"CHEM132C\",\n"
124                 + "      \"courseOfferingDesc\":\"General Chemistry I Laboratory\",\n"
125                 + "      \"courseOfferingCreditOptionDisplay\":\"1.0\",\n"
126                 + "      \"courseOfferingGradingOptionDisplay\":\"Pass/Fail Grading\",\n"
127                 + "      \"studentSelectablePassFail\":true,\n"
128                 + "      \"auditCourse\":false,\n"
129                 + "      \"honorsCourse\":false\n"
130                 + "   },\n"
131                 + "   {\n"
132                 + "      \"courseOfferingId\":\"5fc5ff07-eb70-4c0a-b549-124eb879c8cb\",\n"
133                 + "      \"courseOfferingCode\":\"CHEM132S\",\n"
134                 + "      \"courseOfferingDesc\":\"General Chemistry I Laboratory\",\n"
135                 + "      \"courseOfferingCreditOptionDisplay\":\"1.0\",\n"
136                 + "      \"courseOfferingGradingOptionDisplay\":\"Letter\",\n"
137                 + "      \"studentSelectablePassFail\":true,\n"
138                 + "      \"auditCourse\":false,\n"
139                 + "      \"honorsCourse\":false\n"
140                 + "   },\n"
141                 + "   {\n"
142                 + "      \"courseOfferingId\":\"ced6bd11-bcd2-445f-be16-3a46d8231323\",\n"
143                 + "      \"courseOfferingCode\":\"CHEM135\",\n"
144                 + "      \"courseOfferingDesc\":\"General Chemistry for Engineers\",\n"
145                 + "      \"courseOfferingCreditOptionDisplay\":\"3.0\",\n"
146                 + "      \"courseOfferingGradingOptionDisplay\":\"Letter\",\n"
147                 + "      \"studentSelectablePassFail\":false,\n"
148                 + "      \"auditCourse\":false,\n"
149                 + "      \"honorsCourse\":false\n"
150                 + "   },\n"
151                 + "   {\n"
152                 + "      \"courseOfferingId\":\"27f703ed-d24c-4580-a401-105b3b1e5825\",\n"
153                 + "      \"courseOfferingCode\":\"CHEM135U\",\n"
154                 + "      \"courseOfferingDesc\":\"General Chemistry for Engineers\",\n"
155                 + "      \"courseOfferingCreditOptionDisplay\":\"3.0\",\n"
156                 + "      \"courseOfferingGradingOptionDisplay\":\"Letter\",\n"
157                 + "      \"studentSelectablePassFail\":false,\n"
158                 + "      \"auditCourse\":false,\n"
159                 + "      \"honorsCourse\":false\n"
160                 + "   },\n"
161                 + "   {\n"
162                 + "      \"courseOfferingId\":\"e960defa-3c0c-4bf6-bb2f-0ec13d80096d\",\n"
163                 + "      \"courseOfferingCode\":\"CHEM136\",\n"
164                 + "      \"courseOfferingDesc\":\"General Chemistry Laboratory for Engineers\",\n"
165                 + "      \"courseOfferingCreditOptionDisplay\":\"1.0\",\n"
166                 + "      \"courseOfferingGradingOptionDisplay\":\"Letter\",\n"
167                 + "      \"studentSelectablePassFail\":false,\n"
168                 + "      \"auditCourse\":false,\n"
169                 + "      \"honorsCourse\":false\n"
170                 + "   },\n"
171                 + "   {\n"
172                 + "      \"courseOfferingId\":\"2403ccea-0951-4730-b481-445631cc14a9\",\n"
173                 + "      \"courseOfferingCode\":\"CHEM146\",\n"
174                 + "      \"courseOfferingDesc\":\"Principles of General Chemistry\",\n"
175                 + "      \"courseOfferingCreditOptionDisplay\":\"3.0\",\n"
176                 + "      \"courseOfferingGradingOptionDisplay\":\"Pass/Fail Grading\",\n"
177                 + "      \"studentSelectablePassFail\":true,\n"
178                 + "      \"auditCourse\":true,\n"
179                 + "      \"honorsCourse\":false\n"
180                 + "   },\n"
181                 + "   {\n"
182                 + "      \"courseOfferingId\":\"bc3cafeb-5c1a-452c-9ab3-dabb992d1178\",\n"
183                 + "      \"courseOfferingCode\":\"CHEM147\",\n"
184                 + "      \"courseOfferingDesc\":\"Principles of Chemistry Laboratory\",\n"
185                 + "      \"courseOfferingCreditOptionDisplay\":\"1.0\",\n"
186                 + "      \"courseOfferingGradingOptionDisplay\":\"Letter\",\n"
187                 + "      \"studentSelectablePassFail\":true,\n"
188                 + "      \"auditCourse\":false,\n"
189                 + "      \"honorsCourse\":false\n"
190                 + "   },\n"
191                 + "   {\n"
192                 + "      \"courseOfferingId\":\"2d847317-1c21-4c8c-990c-ab56f0897c75\",\n"
193                 + "      \"courseOfferingCode\":\"CHEM231\",\n"
194                 + "      \"courseOfferingDesc\":\"Organic Chemistry I\",\n"
195                 + "      \"courseOfferingCreditOptionDisplay\":\"3.0\",\n"
196                 + "      \"courseOfferingGradingOptionDisplay\":\"Allow students to audit\",\n"
197                 + "      \"studentSelectablePassFail\":true,\n"
198                 + "      \"auditCourse\":true,\n"
199                 + "      \"honorsCourse\":false\n"
200                 + "   },\n"
201                 + "   {\n"
202                 + "      \"courseOfferingId\":\"9c5f138c-951b-4d3a-8cd5-369a23f89caa\",\n"
203                 + "      \"courseOfferingCode\":\"CHEM232\",\n"
204                 + "      \"courseOfferingDesc\":\"Organic Chemistry Laboratory I\",\n"
205                 + "      \"courseOfferingCreditOptionDisplay\":\"1.0\",\n"
206                 + "      \"courseOfferingGradingOptionDisplay\":\"Letter\",\n"
207                 + "      \"studentSelectablePassFail\":false,\n"
208                 + "      \"auditCourse\":false,\n"
209                 + "      \"honorsCourse\":false\n"
210                 + "   },\n"
211                 + "   {\n"
212                 + "      \"courseOfferingId\":\"ebe93736-4f75-45fc-a313-e375575cdf4a\",\n"
213                 + "      \"courseOfferingCode\":\"CHEM241\",\n"
214                 + "      \"courseOfferingDesc\":\"Organic Chemistry II\",\n"
215                 + "      \"courseOfferingCreditOptionDisplay\":\"3.0\",\n"
216                 + "      \"courseOfferingGradingOptionDisplay\":\"Pass/Fail Grading\",\n"
217                 + "      \"studentSelectablePassFail\":true,\n"
218                 + "      \"auditCourse\":true,\n"
219                 + "      \"honorsCourse\":false\n"
220                 + "   },\n"
221                 + "   {\n"
222                 + "      \"courseOfferingId\":\"9133914d-53a1-49d6-ab4d-cf83a3848262\",\n"
223                 + "      \"courseOfferingCode\":\"CHEM242\",\n"
224                 + "      \"courseOfferingDesc\":\"Organic Chemistry Laboratory II\",\n"
225                 + "      \"courseOfferingCreditOptionDisplay\":\"1.0\",\n"
226                 + "      \"courseOfferingGradingOptionDisplay\":\"Letter\",\n"
227                 + "      \"studentSelectablePassFail\":false,\n"
228                 + "      \"auditCourse\":false,\n"
229                 + "      \"honorsCourse\":false\n"
230                 + "   },\n"
231                 + "   {\n"
232                 + "      \"courseOfferingId\":\"759bba9a-0ccf-4ddd-bdb9-8abe46f2b784\",\n"
233                 + "      \"courseOfferingCode\":\"CHEM247\",\n"
234                 + "      \"courseOfferingDesc\":\"Principles of Organic Chemistry II\",\n"
235                 + "      \"courseOfferingCreditOptionDisplay\":\"4.0\",\n"
236                 + "      \"courseOfferingGradingOptionDisplay\":\"Letter\",\n"
237                 + "      \"studentSelectablePassFail\":true,\n"
238                 + "      \"auditCourse\":true,\n"
239                 + "      \"honorsCourse\":false\n"
240                 + "   },\n"
241                 + "   {\n"
242                 + "      \"courseOfferingId\":\"d4208ae9-7a2a-4ad7-b570-7c060aa74d90\",\n"
243                 + "      \"courseOfferingCode\":\"CHEM271\",\n"
244                 + "      \"courseOfferingDesc\":\"General Chemistry and Energetics\",\n"
245                 + "      \"courseOfferingCreditOptionDisplay\":\"2.0\",\n"
246                 + "      \"courseOfferingGradingOptionDisplay\":\"Allow students to audit\",\n"
247                 + "      \"studentSelectablePassFail\":true,\n"
248                 + "      \"auditCourse\":true,\n"
249                 + "      \"honorsCourse\":false\n"
250                 + "   },\n"
251                 + "   {\n"
252                 + "      \"courseOfferingId\":\"fdfd8711-e66e-4618-8321-f4bc74062792\",\n"
253                 + "      \"courseOfferingCode\":\"CHEM272\",\n"
254                 + "      \"courseOfferingDesc\":\"General Bioanalytical Chemistry Laboratory\",\n"
255                 + "      \"courseOfferingCreditOptionDisplay\":\"2.0\",\n"
256                 + "      \"courseOfferingGradingOptionDisplay\":\"Letter\",\n"
257                 + "      \"studentSelectablePassFail\":true,\n"
258                 + "      \"auditCourse\":false,\n"
259                 + "      \"honorsCourse\":false\n"
260                 + "   },\n"
261                 + "   {\n"
262                 + "      \"courseOfferingId\":\"8e7fa3b9-9560-4f2e-88c5-59c29dc9f126\",\n"
263                 + "      \"courseOfferingCode\":\"CHEM277\",\n"
264                 + "      \"courseOfferingDesc\":\"Fundamentals of Analytical and Bioanalytical Chemistry Laboratory\",\n"
265                 + "      \"courseOfferingCreditOptionDisplay\":\"3.0\",\n"
266                 + "      \"courseOfferingGradingOptionDisplay\":\"Letter\",\n"
267                 + "      \"studentSelectablePassFail\":false,\n"
268                 + "      \"auditCourse\":false,\n"
269                 + "      \"honorsCourse\":false\n"
270                 + "   },\n"
271                 + "   {\n"
272                 + "      \"courseOfferingId\":\"3b84eca8-8664-4de1-8703-b1aebeddc1fb\",\n"
273                 + "      \"courseOfferingCode\":\"CHEM398\",\n"
274                 + "      \"courseOfferingDesc\":\"Special Projects\",\n"
275                 + "      \"courseOfferingCreditOptionDisplay\":\"2.0\",\n"
276                 + "      \"courseOfferingGradingOptionDisplay\":\"Allow students to audit\",\n"
277                 + "      \"studentSelectablePassFail\":true,\n"
278                 + "      \"auditCourse\":true,\n"
279                 + "      \"honorsCourse\":false\n"
280                 + "   },\n"
281                 + "   {\n"
282                 + "      \"courseOfferingId\":\"075b54a0-133a-4e58-9b89-99cb1498e0f0\",\n"
283                 + "      \"courseOfferingCode\":\"CHEM399A\",\n"
284                 + "      \"courseOfferingDesc\":\"Introduction to Chemical Research\",\n"
285                 + "      \"courseOfferingCreditOptionDisplay\":\"1.0,1.5,2.0,2.5,3.0\",\n"
286                 + "      \"courseOfferingGradingOptionDisplay\":\"Letter\",\n"
287                 + "      \"studentSelectablePassFail\":true,\n"
288                 + "      \"auditCourse\":true,\n"
289                 + "      \"honorsCourse\":false\n"
290                 + "   },\n"
291                 + "   {\n"
292                 + "      \"courseOfferingId\":\"9a3126b4-bcad-403a-87ba-ddc438141039\",\n"
293                 + "      \"courseOfferingCode\":\"CHEM399B\",\n"
294                 + "      \"courseOfferingDesc\":\"Introduction to Chemical Research\",\n"
295                 + "      \"courseOfferingCreditOptionDisplay\":\"1.0,1.5,2.0,2.5,3.0\",\n"
296                 + "      \"courseOfferingGradingOptionDisplay\":\"Pass/Fail Grading\",\n"
297                 + "      \"studentSelectablePassFail\":true,\n"
298                 + "      \"auditCourse\":true,\n"
299                 + "      \"honorsCourse\":false\n"
300                 + "   },\n"
301                 + "   {\n"
302                 + "      \"courseOfferingId\":\"26a79829-b42c-441b-b9cf-0d8f7a35629f\",\n"
303                 + "      \"courseOfferingCode\":\"CHEM399C\",\n"
304                 + "      \"courseOfferingDesc\":\"Introduction to Chemical Research\",\n"
305                 + "      \"courseOfferingCreditOptionDisplay\":\"1.0,1.5,2.0,2.5,3.0\",\n"
306                 + "      \"courseOfferingGradingOptionDisplay\":\"Allow students to audit\",\n"
307                 + "      \"studentSelectablePassFail\":true,\n"
308                 + "      \"auditCourse\":true,\n"
309                 + "      \"honorsCourse\":false\n"
310                 + "   },\n"
311                 + "   {\n"
312                 + "      \"courseOfferingId\":\"84d4cc82-a24f-4775-8374-a5a4ebcab530\",\n"
313                 + "      \"courseOfferingCode\":\"CHEM399X\",\n"
314                 + "      \"courseOfferingDesc\":\"Introduction to Chemical Research; Chemistry Instruction\",\n"
315                 + "      \"courseOfferingCreditOptionDisplay\":\"1.0,1.5,2.0,2.5,3.0\",\n"
316                 + "      \"courseOfferingGradingOptionDisplay\":\"Allow students to audit\",\n"
317                 + "      \"studentSelectablePassFail\":true,\n"
318                 + "      \"auditCourse\":true,\n"
319                 + "      \"honorsCourse\":false\n"
320                 + "   },\n"
321                 + "   {\n"
322                 + "      \"courseOfferingId\":\"0c5fcfef-11dd-4e89-b9ab-a28b4b2d7fb0\",\n"
323                 + "      \"courseOfferingCode\":\"CHEM403\",\n"
324                 + "      \"courseOfferingDesc\":\"Radiochemistry\",\n"
325                 + "      \"courseOfferingCreditOptionDisplay\":\"3.0\",\n"
326                 + "      \"courseOfferingGradingOptionDisplay\":\"Pass/Fail Grading\",\n"
327                 + "      \"studentSelectablePassFail\":true,\n"
328                 + "      \"auditCourse\":true,\n"
329                 + "      \"honorsCourse\":false\n"
330                 + "   },\n"
331                 + "   {\n"
332                 + "      \"courseOfferingId\":\"195107f1-0afb-4af3-a78a-d287a57f8a3c\",\n"
333                 + "      \"courseOfferingCode\":\"CHEM425\",\n"
334                 + "      \"courseOfferingDesc\":\"Instrumental Methods of Analysis\",\n"
335                 + "      \"courseOfferingCreditOptionDisplay\":\"4.0\",\n"
336                 + "      \"courseOfferingGradingOptionDisplay\":\"Allow students to audit\",\n"
337                 + "      \"studentSelectablePassFail\":true,\n"
338                 + "      \"auditCourse\":true,\n"
339                 + "      \"honorsCourse\":false\n"
340                 + "   },\n"
341                 + "   {\n"
342                 + "      \"courseOfferingId\":\"e67d87d6-8d89-401a-86ac-08ca8bd5195b\",\n"
343                 + "      \"courseOfferingCode\":\"CHEM441\",\n"
344                 + "      \"courseOfferingDesc\":\"Advanced Organic Chemistry\",\n"
345                 + "      \"courseOfferingCreditOptionDisplay\":\"3.0\",\n"
346                 + "      \"courseOfferingGradingOptionDisplay\":\"Allow students to audit\",\n"
347                 + "      \"studentSelectablePassFail\":true,\n"
348                 + "      \"auditCourse\":true,\n"
349                 + "      \"honorsCourse\":false\n"
350                 + "   },\n"
351                 + "   {\n"
352                 + "      \"courseOfferingId\":\"6f2cb68a-b09d-4b2b-8459-7fe17de11055\",\n"
353                 + "      \"courseOfferingCode\":\"CHEM460\",\n"
354                 + "      \"courseOfferingDesc\":\"Structure Determination Using Spectroscopic Methods\",\n"
355                 + "      \"courseOfferingCreditOptionDisplay\":\"3.0\",\n"
356                 + "      \"courseOfferingGradingOptionDisplay\":\"Pass/Fail Grading\",\n"
357                 + "      \"studentSelectablePassFail\":true,\n"
358                 + "      \"auditCourse\":true,\n"
359                 + "      \"honorsCourse\":false\n"
360                 + "   },\n"
361                 + "   {\n"
362                 + "      \"courseOfferingId\":\"abf9196f-a0d2-4558-b47b-308bf0257c35\",\n"
363                 + "      \"courseOfferingCode\":\"CHEM474\",\n"
364                 + "      \"courseOfferingDesc\":\"Environmental Chemistry\",\n"
365                 + "      \"courseOfferingCreditOptionDisplay\":\"3.0\",\n"
366                 + "      \"courseOfferingGradingOptionDisplay\":\"Pass/Fail Grading\",\n"
367                 + "      \"studentSelectablePassFail\":true,\n"
368                 + "      \"auditCourse\":true,\n"
369                 + "      \"honorsCourse\":false\n"
370                 + "   },\n"
371                 + "   {\n"
372                 + "      \"courseOfferingId\":\"87521128-54b5-4c97-a756-b1ecd7dcc5f5\",\n"
373                 + "      \"courseOfferingCode\":\"CHEM481\",\n"
374                 + "      \"courseOfferingDesc\":\"Physical Chemistry I\",\n"
375                 + "      \"courseOfferingCreditOptionDisplay\":\"3.0\",\n"
376                 + "      \"courseOfferingGradingOptionDisplay\":\"Allow students to audit\",\n"
377                 + "      \"studentSelectablePassFail\":true,\n"
378                 + "      \"auditCourse\":true,\n"
379                 + "      \"honorsCourse\":false\n"
380                 + "   },\n"
381                 + "   {\n"
382                 + "      \"courseOfferingId\":\"99f82ba5-ad01-4489-b446-99ea8f62d292\",\n"
383                 + "      \"courseOfferingCode\":\"CHEM482\",\n"
384                 + "      \"courseOfferingDesc\":\"Physical Chemistry II\",\n"
385                 + "      \"courseOfferingCreditOptionDisplay\":\"3.0\",\n"
386                 + "      \"courseOfferingGradingOptionDisplay\":\"Pass/Fail Grading\",\n"
387                 + "      \"studentSelectablePassFail\":true,\n"
388                 + "      \"auditCourse\":true,\n"
389                 + "      \"honorsCourse\":false\n"
390                 + "   },\n"
391                 + "   {\n"
392                 + "      \"courseOfferingId\":\"7a84cb1d-51ad-44a5-a315-69451dea6154\",\n"
393                 + "      \"courseOfferingCode\":\"CHEM483\",\n"
394                 + "      \"courseOfferingDesc\":\"Physical Chemistry Laboratory I\",\n"
395                 + "      \"courseOfferingCreditOptionDisplay\":\"2.0\",\n"
396                 + "      \"courseOfferingGradingOptionDisplay\":\"Allow students to audit\",\n"
397                 + "      \"studentSelectablePassFail\":true,\n"
398                 + "      \"auditCourse\":true,\n"
399                 + "      \"honorsCourse\":false\n"
400                 + "   },\n"
401                 + "   {\n"
402                 + "      \"courseOfferingId\":\"9118cf6c-a573-4443-9208-89079ff89d8b\",\n"
403                 + "      \"courseOfferingCode\":\"CHEM484\",\n"
404                 + "      \"courseOfferingDesc\":\"Physical Chemistry Laboratory II\",\n"
405                 + "      \"courseOfferingCreditOptionDisplay\":\"2.0\",\n"
406                 + "      \"courseOfferingGradingOptionDisplay\":\"Letter\",\n"
407                 + "      \"studentSelectablePassFail\":true,\n"
408                 + "      \"auditCourse\":true,\n"
409                 + "      \"honorsCourse\":false\n"
410                 + "   },\n"
411                 + "   {\n"
412                 + "      \"courseOfferingId\":\"d5604c9f-664c-4dc1-94b1-695a821b7c8f\",\n"
413                 + "      \"courseOfferingCode\":\"CHEM491\",\n"
414                 + "      \"courseOfferingDesc\":\"Advanced Organic Chemistry Laboratory\",\n"
415                 + "      \"courseOfferingCreditOptionDisplay\":\"4.0\",\n"
416                 + "      \"courseOfferingGradingOptionDisplay\":\"Pass/Fail Grading\",\n"
417                 + "      \"studentSelectablePassFail\":true,\n"
418                 + "      \"auditCourse\":true,\n"
419                 + "      \"honorsCourse\":false\n"
420                 + "   },\n"
421                 + "   {\n"
422                 + "      \"courseOfferingId\":\"9218e1e8-8279-4ea2-9975-9decdf337eca\",\n"
423                 + "      \"courseOfferingCode\":\"CHEM601\",\n"
424                 + "      \"courseOfferingDesc\":\"Structure and Bonding of Molecules and Materials\",\n"
425                 + "      \"courseOfferingCreditOptionDisplay\":\"3.0\",\n"
426                 + "      \"courseOfferingGradingOptionDisplay\":\"Allow students to audit\",\n"
427                 + "      \"studentSelectablePassFail\":false,\n"
428                 + "      \"auditCourse\":true,\n"
429                 + "      \"honorsCourse\":false\n"
430                 + "   },\n"
431                 + "   {\n"
432                 + "      \"courseOfferingId\":\"eb942c03-0e7e-4bd7-a774-d26cb1c64f25\",\n"
433                 + "      \"courseOfferingCode\":\"CHEM608K\",\n"
434                 + "      \"courseOfferingDesc\":\"Selected Topics in Inorganic Chemistry; Chemistry Teaching and Learning in Higher Education\",\n"
435                 + "      \"courseOfferingCreditOptionDisplay\":\"1.0,1.5,2.0,2.5,3.0\",\n"
436                 + "      \"courseOfferingGradingOptionDisplay\":\"Letter\",\n"
437                 + "      \"studentSelectablePassFail\":false,\n"
438                 + "      \"auditCourse\":true,\n"
439                 + "      \"honorsCourse\":false\n"
440                 + "   },\n"
441                 + "   {\n"
442                 + "      \"courseOfferingId\":\"19bb06aa-a076-4937-8fc4-acccf85b9828\",\n"
443                 + "      \"courseOfferingCode\":\"CHEM611\",\n"
444                 + "      \"courseOfferingDesc\":\"Professional Skills for New Graduate Students\",\n"
445                 + "      \"courseOfferingCreditOptionDisplay\":\"1.0\",\n"
446                 + "      \"courseOfferingGradingOptionDisplay\":\"Allow students to audit\",\n"
447                 + "      \"studentSelectablePassFail\":false,\n"
448                 + "      \"auditCourse\":true,\n"
449                 + "      \"honorsCourse\":false\n"
450                 + "   },\n"
451                 + "   {\n"
452                 + "      \"courseOfferingId\":\"9dd9724e-efd6-4d31-9624-b46450b57027\",\n"
453                 + "      \"courseOfferingCode\":\"CHEM625\",\n"
454                 + "      \"courseOfferingDesc\":\"Separation Methods in Quantitative Analysis\",\n"
455                 + "      \"courseOfferingCreditOptionDisplay\":\"3.0\",\n"
456                 + "      \"courseOfferingGradingOptionDisplay\":\"Allow students to audit\",\n"
457                 + "      \"studentSelectablePassFail\":false,\n"
458                 + "      \"auditCourse\":true,\n"
459                 + "      \"honorsCourse\":false\n"
460                 + "   },\n"
461                 + "   {\n"
462                 + "      \"courseOfferingId\":\"8938913c-cbd0-4405-97ad-f7e179114b83\",\n"
463                 + "      \"courseOfferingCode\":\"CHEM626\",\n"
464                 + "      \"courseOfferingDesc\":\"Metrology for Chemistry and Biochemistry\",\n"
465                 + "      \"courseOfferingCreditOptionDisplay\":\"3.0\",\n"
466                 + "      \"courseOfferingGradingOptionDisplay\":\"Letter\",\n"
467                 + "      \"studentSelectablePassFail\":false,\n"
468                 + "      \"auditCourse\":true,\n"
469                 + "      \"honorsCourse\":false\n"
470                 + "   },\n"
471                 + "   {\n"
472                 + "      \"courseOfferingId\":\"39c50ead-18ef-4909-89dc-3341cf8f6fd5\",\n"
473                 + "      \"courseOfferingCode\":\"CHEM640\",\n"
474                 + "      \"courseOfferingDesc\":\"Problems in Organic Reaction Mechanisms\",\n"
475                 + "      \"courseOfferingCreditOptionDisplay\":\"1.0\",\n"
476                 + "      \"courseOfferingGradingOptionDisplay\":\"Allow students to audit\",\n"
477                 + "      \"studentSelectablePassFail\":false,\n"
478                 + "      \"auditCourse\":true,\n"
479                 + "      \"honorsCourse\":false\n"
480                 + "   },\n"
481                 + "   {\n"
482                 + "      \"courseOfferingId\":\"bc7d6a5e-b77c-400b-a79b-1e02164b2de8\",\n"
483                 + "      \"courseOfferingCode\":\"CHEM641\",\n"
484                 + "      \"courseOfferingDesc\":\"Organic Reaction Mechanisms\",\n"
485                 + "      \"courseOfferingCreditOptionDisplay\":\"3.0\",\n"
486                 + "      \"courseOfferingGradingOptionDisplay\":\"Allow students to audit\",\n"
487                 + "      \"studentSelectablePassFail\":false,\n"
488                 + "      \"auditCourse\":true,\n"
489                 + "      \"honorsCourse\":false\n"
490                 + "   },\n"
491                 + "   {\n"
492                 + "      \"courseOfferingId\":\"22f75db7-d9ac-4da7-ba0c-6def7b544718\",\n"
493                 + "      \"courseOfferingCode\":\"CHEM682\",\n"
494                 + "      \"courseOfferingDesc\":\"Chemical Kinetics and Dynamics\",\n"
495                 + "      \"courseOfferingCreditOptionDisplay\":\"3.0\",\n"
496                 + "      \"courseOfferingGradingOptionDisplay\":\"Allow students to audit\",\n"
497                 + "      \"studentSelectablePassFail\":false,\n"
498                 + "      \"auditCourse\":true,\n"
499                 + "      \"honorsCourse\":false\n"
500                 + "   },\n"
501                 + "   {\n"
502                 + "      \"courseOfferingId\":\"4a6f4368-2a17-4bef-b62c-872fa66f8211\",\n"
503                 + "      \"courseOfferingCode\":\"CHEM684\",\n"
504                 + "      \"courseOfferingDesc\":\"Chemical Thermodynamics\",\n"
505                 + "      \"courseOfferingCreditOptionDisplay\":\"3.0\",\n"
506                 + "      \"courseOfferingGradingOptionDisplay\":\"Allow students to audit\",\n"
507                 + "      \"studentSelectablePassFail\":false,\n"
508                 + "      \"auditCourse\":true,\n"
509                 + "      \"honorsCourse\":false\n"
510                 + "   },\n"
511                 + "   {\n"
512                 + "      \"courseOfferingId\":\"8ba3008b-cf09-4df3-99fe-403f44be4eed\",\n"
513                 + "      \"courseOfferingCode\":\"CHEM689\",\n"
514                 + "      \"courseOfferingDesc\":\"Special Topics in Physical Chemistry\",\n"
515                 + "      \"courseOfferingCreditOptionDisplay\":\"3.0\",\n"
516                 + "      \"courseOfferingGradingOptionDisplay\":\"Letter\",\n"
517                 + "      \"studentSelectablePassFail\":false,\n"
518                 + "      \"auditCourse\":true,\n"
519                 + "      \"honorsCourse\":false\n"
520                 + "   },\n"
521                 + "   {\n"
522                 + "      \"courseOfferingId\":\"73e0e856-d344-4946-a759-65209dfd6e3b\",\n"
523                 + "      \"courseOfferingCode\":\"CHEM690\",\n"
524                 + "      \"courseOfferingDesc\":\"Quantum Chemistry I\",\n"
525                 + "      \"courseOfferingCreditOptionDisplay\":\"3.0\",\n"
526                 + "      \"courseOfferingGradingOptionDisplay\":\"Allow students to audit\",\n"
527                 + "      \"studentSelectablePassFail\":false,\n"
528                 + "      \"auditCourse\":true,\n"
529                 + "      \"honorsCourse\":false\n"
530                 + "   },\n"
531                 + "   {\n"
532                 + "      \"courseOfferingId\":\"ce30b18d-5003-430c-9b8d-07d320785f4d\",\n"
533                 + "      \"courseOfferingCode\":\"CHEM699\",\n"
534                 + "      \"courseOfferingDesc\":\"Special Problems in Chemistry\",\n"
535                 + "      \"courseOfferingCreditOptionDisplay\":\"1 - 6\",\n"
536                 + "      \"courseOfferingGradingOptionDisplay\":\"Letter\",\n"
537                 + "      \"studentSelectablePassFail\":false,\n"
538                 + "      \"auditCourse\":true,\n"
539                 + "      \"honorsCourse\":false\n"
540                 + "   },\n"
541                 + "   {\n"
542                 + "      \"courseOfferingId\":\"af7586c2-92aa-4da7-81d0-82e757efae99\",\n"
543                 + "      \"courseOfferingCode\":\"CHEM799\",\n"
544                 + "      \"courseOfferingDesc\":\"Master's Thesis Research\",\n"
545                 + "      \"courseOfferingCreditOptionDisplay\":\"1 - 6\",\n"
546                 + "      \"courseOfferingGradingOptionDisplay\":\"Letter\",\n"
547                 + "      \"studentSelectablePassFail\":false,\n"
548                 + "      \"auditCourse\":false,\n"
549                 + "      \"honorsCourse\":false\n"
550                 + "   },\n"
551                 + "   {\n"
552                 + "      \"courseOfferingId\":\"47b27aeb-3506-4cef-9cab-ce82eb16b98a\",\n"
553                 + "      \"courseOfferingCode\":\"CHEM889A\",\n"
554                 + "      \"courseOfferingDesc\":\"Seminar; Analytical, Nuclear and Environmental Chemistry\",\n"
555                 + "      \"courseOfferingCreditOptionDisplay\":\"1.0\",\n"
556                 + "      \"courseOfferingGradingOptionDisplay\":\"Allow students to audit\",\n"
557                 + "      \"studentSelectablePassFail\":false,\n"
558                 + "      \"auditCourse\":true,\n"
559                 + "      \"honorsCourse\":false\n"
560                 + "   },\n"
561                 + "   {\n"
562                 + "      \"courseOfferingId\":\"81590cdf-e8bb-42b2-8192-9782ad9ca0e7\",\n"
563                 + "      \"courseOfferingCode\":\"CHEM889C\",\n"
564                 + "      \"courseOfferingDesc\":\"Seminar; Inorganic\",\n"
565                 + "      \"courseOfferingCreditOptionDisplay\":\"1.0\",\n"
566                 + "      \"courseOfferingGradingOptionDisplay\":\"Allow students to audit\",\n"
567                 + "      \"studentSelectablePassFail\":false,\n"
568                 + "      \"auditCourse\":true,\n"
569                 + "      \"honorsCourse\":false\n"
570                 + "   },\n"
571                 + "   {\n"
572                 + "      \"courseOfferingId\":\"2972d4f5-2670-4d69-8bc5-c3d0afb28a4a\",\n"
573                 + "      \"courseOfferingCode\":\"CHEM889D\",\n"
574                 + "      \"courseOfferingDesc\":\"Seminar; Organic\",\n"
575                 + "      \"courseOfferingCreditOptionDisplay\":\"1.0\",\n"
576                 + "      \"courseOfferingGradingOptionDisplay\":\"Allow students to audit\",\n"
577                 + "      \"studentSelectablePassFail\":false,\n"
578                 + "      \"auditCourse\":true,\n"
579                 + "      \"honorsCourse\":false\n"
580                 + "   },\n"
581                 + "   {\n"
582                 + "      \"courseOfferingId\":\"672d59b9-c2ae-4462-82f3-b0ebfc181c59\",\n"
583                 + "      \"courseOfferingCode\":\"CHEM889E\",\n"
584                 + "      \"courseOfferingDesc\":\"Seminar; Physical Chemistry\",\n"
585                 + "      \"courseOfferingCreditOptionDisplay\":\"1.0\",\n"
586                 + "      \"courseOfferingGradingOptionDisplay\":\"Allow students to audit\",\n"
587                 + "      \"studentSelectablePassFail\":false,\n"
588                 + "      \"auditCourse\":true,\n"
589                 + "      \"honorsCourse\":false\n"
590                 + "   },\n"
591                 + "   {\n"
592                 + "      \"courseOfferingId\":\"ee6838b4-40d8-419e-8838-a5286e269dc9\",\n"
593                 + "      \"courseOfferingCode\":\"CHEM889F\",\n"
594                 + "      \"courseOfferingDesc\":\"Seminar; Chemical Physics\",\n"
595                 + "      \"courseOfferingCreditOptionDisplay\":\"1.0\",\n"
596                 + "      \"courseOfferingGradingOptionDisplay\":\"Allow students to audit\",\n"
597                 + "      \"studentSelectablePassFail\":false,\n"
598                 + "      \"auditCourse\":true,\n"
599                 + "      \"honorsCourse\":false\n"
600                 + "   },\n"
601                 + "   {\n"
602                 + "      \"courseOfferingId\":\"fe0b4cbd-0796-4810-88ec-0dc22f570cc6\",\n"
603                 + "      \"courseOfferingCode\":\"CHEM889G\",\n"
604                 + "      \"courseOfferingDesc\":\"Seminar; Physical Organic\",\n"
605                 + "      \"courseOfferingCreditOptionDisplay\":\"1.0\",\n"
606                 + "      \"courseOfferingGradingOptionDisplay\":\"Allow students to audit\",\n"
607                 + "      \"studentSelectablePassFail\":false,\n"
608                 + "      \"auditCourse\":true,\n"
609                 + "      \"honorsCourse\":false\n"
610                 + "   },\n"
611                 + "   {\n"
612                 + "      \"courseOfferingId\":\"ac1a7153-1ceb-483e-bf3c-417494ac4522\",\n"
613                 + "      \"courseOfferingCode\":\"CHEM889M\",\n"
614                 + "      \"courseOfferingDesc\":\"Seminar; Materials Chemistry\",\n"
615                 + "      \"courseOfferingCreditOptionDisplay\":\"1.0\",\n"
616                 + "      \"courseOfferingGradingOptionDisplay\":\"Letter\",\n"
617                 + "      \"studentSelectablePassFail\":false,\n"
618                 + "      \"auditCourse\":true,\n"
619                 + "      \"honorsCourse\":false\n"
620                 + "   },\n"
621                 + "   {\n"
622                 + "      \"courseOfferingId\":\"019e01b1-695a-4513-92b6-4303af879b61\",\n"
623                 + "      \"courseOfferingCode\":\"CHEM889P\",\n"
624                 + "      \"courseOfferingDesc\":\"Seminar; Structure and Reactivity of Biopolymers\",\n"
625                 + "      \"courseOfferingCreditOptionDisplay\":\"1.0\",\n"
626                 + "      \"courseOfferingGradingOptionDisplay\":\"Letter\",\n"
627                 + "      \"studentSelectablePassFail\":false,\n"
628                 + "      \"auditCourse\":true,\n"
629                 + "      \"honorsCourse\":false\n"
630                 + "   },\n"
631                 + "   {\n"
632                 + "      \"courseOfferingId\":\"d0b9cf2f-879d-4bf4-8afd-05531b842219\",\n"
633                 + "      \"courseOfferingCode\":\"CHEM898\",\n"
634                 + "      \"courseOfferingDesc\":\"Pre-Candidacy Research\",\n"
635                 + "      \"courseOfferingCreditOptionDisplay\":\"1 - 8\",\n"
636                 + "      \"courseOfferingGradingOptionDisplay\":\"Administrative Grade of Satisfactory\",\n"
637                 + "      \"studentSelectablePassFail\":false,\n"
638                 + "      \"auditCourse\":false,\n"
639                 + "      \"honorsCourse\":false\n"
640                 + "   },\n"
641                 + "   {\n"
642                 + "      \"courseOfferingId\":\"a3c5e362-6343-4177-ae39-c2f55b32f56b\",\n"
643                 + "      \"courseOfferingCode\":\"CHEM899\",\n"
644                 + "      \"courseOfferingDesc\":\"Doctoral Dissertation Research\",\n"
645                 + "      \"courseOfferingCreditOptionDisplay\":\"1 - 8\",\n"
646                 + "      \"courseOfferingGradingOptionDisplay\":\"Letter\",\n"
647                 + "      \"studentSelectablePassFail\":false,\n"
648                 + "      \"auditCourse\":false,\n"
649                 + "      \"honorsCourse\":false\n"
650                 + "   }\n"
651                 + "]";
652 
653         JsonReader jsonReader = Json.createReader(new StringReader(temp));
654         JsonArray jsonArray = jsonReader.readArray();
655         List<CourseSearchResult> collectionList = new ArrayList<CourseSearchResult>();
656 
657         populateCourseSearchResults(jsonArray, collectionList);
658         form.setPerfCollection(collectionList); // add collection to form.
659 
660         return getModelAndView(form);
661     }
662 
663     public void populateCourseSearchResults(JsonArray jsonArray, List<CourseSearchResult> collectionList)throws JsonException {
664        int j = jsonArray.size();
665        int i;
666        for(i=0; i<j; i++) {
667            CourseSearchResult courseSearchResult = new CourseSearchResult();
668            JsonObject jsonObject = (JsonObject)jsonArray.get(i);
669            courseSearchResult.setCourseOfferingId(jsonObject.getString("courseOfferingId"));
670            courseSearchResult.setCourseOfferingCode(jsonObject.getString("courseOfferingCode"));
671            courseSearchResult.setHonorsCourse(jsonObject.getBoolean("honorsCourse"));
672            courseSearchResult.setAuditCourse(jsonObject.getBoolean("auditCourse"));
673            courseSearchResult.setStudentSelectablePassFail(jsonObject.getBoolean("studentSelectablePassFail"));
674            courseSearchResult.setCourseOfferingDesc(jsonObject.getString("courseOfferingDesc"));
675            courseSearchResult.setCourseOfferingCreditOptionDisplay(jsonObject.getString(
676                    "courseOfferingCreditOptionDisplay"));
677            courseSearchResult.setCourseOfferingGradingOptionDisplay(jsonObject.getString(
678                    "courseOfferingGradingOptionDisplay"));
679            collectionList.add(courseSearchResult);
680        }
681 
682 
683     }
684 
685 
686     public String getHTML(String urlToRead) {
687         URL url;
688         HttpURLConnection conn;
689         BufferedReader rd;
690         String line;
691         String result = "";
692         try {
693             url = new URL(urlToRead);
694             conn = (HttpURLConnection) url.openConnection();
695             conn.setRequestMethod("GET");
696             rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
697             while ((line = rd.readLine()) != null) {
698                 result += line;
699             }
700             rd.close();
701         } catch (IOException e) {
702             e.printStackTrace();
703         } catch (Exception e) {
704             e.printStackTrace();
705         }
706         return result;
707     }
708 
709 }