Clover Coverage Report - Kuali Student 1.2-M6-SNAPSHOT (Aggregated)
Coverage timestamp: Mon Sep 12 2011 05:03:53 EDT
../../../../../../../../../img/srcFileCovDistChart0.png 42% of files have more coverage
147   434   57   7.74
22   253   0.39   9.5
19     3  
2    
 
  CurriculumHomeController       Line # 62 146 0% 56 186 0% 0.0
  CurriculumHomeController.RunAsyncGetView       Line # 80 1 0% 1 2 0% 0.0
 
No Tests
 
1    package org.kuali.student.lum.lu.ui.main.client.controllers;
2   
3    import java.util.Map;
4   
5    import org.kuali.student.common.ui.client.application.Application;
6    import org.kuali.student.common.ui.client.application.ViewContext;
7    import org.kuali.student.common.ui.client.configurable.mvc.LayoutController;
8    import org.kuali.student.common.ui.client.mvc.Callback;
9    import org.kuali.student.common.ui.client.mvc.Controller;
10    import org.kuali.student.common.ui.client.mvc.View;
11    import org.kuali.student.common.ui.client.util.WindowTitleUtils;
12    import org.kuali.student.common.ui.client.widgets.field.layout.element.SpanPanel;
13    import org.kuali.student.common.ui.shared.IdAttributes.IdType;
14    import org.kuali.student.lum.common.client.configuration.LUMViews;
15    import org.kuali.student.lum.common.client.widgets.AppLocations;
16    import org.kuali.student.lum.lu.ui.browseprogram.client.controllers.BrowseProgramController;
17    import org.kuali.student.lum.lu.ui.course.client.controllers.CourseAdminController;
18    import org.kuali.student.lum.lu.ui.course.client.controllers.CourseAdminRetireController;
19    import org.kuali.student.lum.lu.ui.course.client.controllers.CourseAdminWithoutVersionController;
20    import org.kuali.student.lum.lu.ui.course.client.controllers.CourseProposalController;
21    import org.kuali.student.lum.lu.ui.course.client.controllers.ViewCourseParentController;
22    import org.kuali.student.lum.lu.ui.course.client.views.CategoryManagementView;
23    import org.kuali.student.lum.lu.ui.course.client.views.CurriculumHomeView;
24    import org.kuali.student.lum.lu.ui.dependency.client.controllers.DependencyAnalysisController;
25    import org.kuali.student.lum.lu.ui.tools.client.configuration.CatalogBrowserController;
26    import org.kuali.student.lum.lu.ui.tools.client.configuration.CluSetsManagementController;
27    import org.kuali.student.lum.program.client.ProgramConstants;
28    import org.kuali.student.lum.program.client.ProgramRegistry;
29    import org.kuali.student.lum.program.client.core.CoreManager;
30    import org.kuali.student.lum.program.client.credential.CredentialManager;
31    import org.kuali.student.lum.program.client.major.MajorManager;
32   
33    import com.google.gwt.core.client.RunAsyncCallback;
34    import com.google.gwt.user.client.Window;
35   
36    /**
37    * Curriculum home controller which controls the main LayoutController views of the lum application. The
38    * default view of this controller is the Curriculum Home Landing page. The following views are views within
39    * this controller's scope:<br>
40    * COURSE_PROPOSAL<br>
41    VIEW_COURSE<br>
42    PROGRAM_VIEW<br>
43    PROGRAM_EDIT<br>
44    PROGRAM_CREATE<br>
45    PROGRAM_VERSIONS<br>
46    CLU_SETS<br>
47    VARIATION_VIEW<br>
48    VARIATION_EDIT<br>
49    COURSE_CATALOG<br>
50    LO_CATEGORIES<br>
51    BACC_PROGRAM_VIEW<br>
52    BACC_PROGRAM_EDIT<br>
53    BACC_PROGRAM_VERSIONS<br>
54    CORE_PROGRAM_VIEW<br>
55    CORE_PROGRAM_EDIT<br>
56    CORE_PROGRAM_VERSIONS<br>
57    * These views can be accessed through links and searches provided by the CurriculumHomeView (the default view).
58    *
59    * @author Kuali Student Team
60    * @see CurriculumHomeView
61    */
 
62    public class CurriculumHomeController extends LayoutController {
63   
64    private CurriculumHomeView home;
65    private final SpanPanel panel = new SpanPanel();
66   
67    private CourseProposalController courseProposalController;
68    private CourseAdminController courseAdminController;
69    private CourseAdminWithoutVersionController courseAdminWithoutVersionController;
70    private CourseAdminRetireController courseAdminRetireController;
71    private LayoutController viewCourseController;
72    private LayoutController manageCluSetsController;
73    private LayoutController browseCatalogController;
74    private LayoutController dependencyAnalysisController;
75    private LayoutController browseProgramController;
76    private MajorManager majorManager = new MajorManager();
77    private CredentialManager credentialManager = new CredentialManager();
78    private CoreManager coreManager = new CoreManager();
79   
 
80    private abstract class RunAsyncGetView implements RunAsyncCallback {
 
81  0 toggle public void onFailure(Throwable reason) {
82  0 Window.alert("Download failed. Please try again.");
83    }
84    }
85   
 
86  0 toggle public CurriculumHomeController(Controller controller, String name, Enum<?> viewType) {
87  0 super();
88  0 super.setController(controller);
89  0 super.setName(name);
90  0 super.setViewEnum(viewType);
91  0 this.setDefaultView(LUMViews.DEFAULT);
92  0 this.initWidget(panel);
93  0 setupDefaultView();
94    }
95   
 
96  0 toggle private void setupDefaultView() {
97  0 home = new CurriculumHomeView(this, LUMViews.DEFAULT);
98    }
99   
 
100  0 toggle @Override
101    public <V extends Enum<?>> void getView(V viewType, final Callback<View> callback, Map<String, String> tokenMap) {
102    //this is done so the views can have delayed loading
103   
104  0 switch ((LUMViews) viewType) {
105  0 case DEFAULT:
106  0 callback.exec(home);
107  0 break;
108  0 case COURSE_PROPOSAL:
109    // GWT.runAsync(new RunAsyncGetView() {
110    // @Override
111    // public void onSuccess() {
112  0 callback.exec(getCourseProposalController());
113    // }
114    // });
115  0 break;
116  0 case COURSE_ADMIN:
117    // GWT.runAsync(new RunAsyncGetView() {
118    // @Override
119    // public void onSuccess() {
120  0 callback.exec(getCourseAdminController());
121    // }
122    // });
123  0 break;
124  0 case COURSE_ADMIN_NO_VERSION:
125    // GWT.runAsync(new RunAsyncGetView() {
126    // @Override
127    // public void onSuccess() {
128  0 callback.exec(getCourseAdminWithoutVersionController());
129    // }
130    // });
131  0 break;
132  0 case COURSE_ADMIN_RETIRE:
133    // GWT.runAsync(new RunAsyncGetView() {
134    // @Override
135    // public void onSuccess() {
136  0 callback.exec(getCourseAdminRetireController());
137    // }
138    // });
139  0 break;
140   
141  0 case VIEW_COURSE:
142    // GWT.runAsync(new RunAsyncGetView() {
143    // @Override
144    // public void onSuccess() {
145  0 callback.exec(getViewCourseController());
146    // }
147    // });
148  0 break;
149  0 case PROGRAM_PROPOSAL:
150    // GWT.runAsync(new RunAsyncGetView() {
151    // @Override
152    // public void onSuccess() {
153  0 if (ProgramRegistry.isCreateNew()) {
154  0 ProgramRegistry.setCreateNew(false);
155  0 majorManager = new MajorManager();
156    }
157  0 callback.exec(majorManager.getMajorProposalController());
158    // }
159    // });
160  0 break;
161  0 case PROGRAM_VIEW:
162    // GWT.runAsync(new RunAsyncGetView() {
163    // @Override
164    // public void onSuccess() {
165  0 if (ProgramRegistry.isCreateNew()) {
166  0 ProgramRegistry.setCreateNew(false);
167  0 majorManager = new MajorManager();
168    }
169  0 callback.exec(majorManager.getProgramViewController());
170    // }
171    // });
172  0 break;
173  0 case PROGRAM_EDIT:
174    // GWT.runAsync(new RunAsyncGetView() {
175    // @Override
176    // public void onSuccess() {
177  0 Application.getApplicationContext().setParentPath("");//Reset the parent path when navigating back
178  0 if (ProgramRegistry.isCreateNew()) {
179  0 ProgramRegistry.setCreateNew(false);
180  0 majorManager = new MajorManager();
181    }
182  0 callback.exec(majorManager.getProgramEditController());
183    // }
184    // });
185  0 break;
186  0 case PROGRAM_SPEC_EDIT:
187    // GWT.runAsync(new RunAsyncGetView() {
188    // @Override
189    // public void onSuccess() {
190  0 if (ProgramRegistry.isCreateNew()) {
191  0 ProgramRegistry.setCreateNew(false);
192  0 majorManager = new MajorManager();
193    }
194  0 callback.exec(majorManager.getProgramSpecEditController());
195    // }
196    // });
197  0 break;
198  0 case PROGRAM_CREATE:
199    // GWT.runAsync(new RunAsyncGetView() {
200    // @Override
201    // public void onSuccess() {
202  0 majorManager = new MajorManager();
203  0 callback.exec(majorManager.getProgramEditController());
204    // }
205    // });
206  0 break;
207  0 case PROGRAM_VERSIONS:
208    // GWT.runAsync(new RunAsyncGetView() {
209    // @Override
210    // public void onSuccess() {
211  0 callback.exec(majorManager.getProgramVersionsController());
212    // }
213    // });
214  0 break;
215  0 case CLU_SETS:
216    // GWT.runAsync(new RunAsyncGetView() {
217    // @Override
218    // public void onSuccess() {
219  0 callback.exec(getCluSetsController());
220    // }
221    // });
222  0 break;
223  0 case COURSE_CATALOG:
224    // GWT.runAsync(new RunAsyncGetView() {
225    // @Override
226    // public void onSuccess() {
227  0 callback.exec(getBrowseCatalogController());
228    // }
229    // });
230  0 break;
231  0 case VARIATION_VIEW:
232    // GWT.runAsync(new RunAsyncGetView() {
233    // @Override
234    // public void onSuccess() {
235    //Check if key data has been initialized (the program was loaded before the variation)
236  0 if(majorManager.getProgramModel()!=null && majorManager.getProgramModel().getDefinition()!=null){
237  0 callback.exec(majorManager.getVariationViewController());
238    }else{
239    //If it has not yet been initialized, we need to pull some context information and
240    //navigate to the program view which will initialize program information and then load the variation view.
241    //This is similar to the getFindMajorsWidget() in the CurriculumHomeConfigurer
242  0 ViewContext viewContext = new ViewContext();
243  0 viewContext.setId(tokenMap.get("docId"));
244  0 viewContext.setAttribute(ProgramConstants.VARIATION_ID, tokenMap.get(ProgramConstants.VARIATION_ID));
245  0 viewContext.setAttribute(ProgramConstants.TYPE, ProgramConstants.VARIATION_TYPE_KEY);
246  0 viewContext.setIdType(IdType.OBJECT_ID);
247  0 ProgramRegistry.setCreateNew(true);
248  0 Application.navigate(AppLocations.Locations.VIEW_PROGRAM.getLocation(), viewContext);
249    }
250    // }
251    // });
252  0 break;
253  0 case VARIATION_EDIT:
254    // GWT.runAsync(new RunAsyncGetView() {
255    // @Override
256    // public void onSuccess() {
257  0 if(majorManager.getProgramModel()!=null && majorManager.getProgramModel().getDefinition()!=null){
258  0 callback.exec(majorManager.getVariationEditController());
259    }else{
260    //If the variation edit is refreshed, bring the user to the program screen first
261  0 Application.getApplicationContext().setParentPath("");//Reset the parent path when navigating back
262  0 if (ProgramRegistry.isCreateNew()) {
263  0 ProgramRegistry.setCreateNew(false);
264  0 majorManager = new MajorManager();
265    }
266  0 callback.exec(majorManager.getProgramEditController());
267    }
268    // }
269    // });
270  0 break;
271  0 case CORE_PROGRAM_VIEW:
272    // GWT.runAsync(new RunAsyncGetView() {
273    // @Override
274    // public void onSuccess() {
275  0 if (ProgramRegistry.isCreateNew()) {
276  0 ProgramRegistry.setCreateNew(false);
277  0 coreManager = new CoreManager();
278    }
279  0 callback.exec(coreManager.getViewController());
280    // }
281    // });
282  0 break;
283  0 case CORE_PROGRAM_EDIT:
284    // GWT.runAsync(new RunAsyncGetView() {
285    // @Override
286    // public void onSuccess() {
287  0 callback.exec(coreManager.getEditController());
288    // }
289    // });
290  0 break;
291  0 case CORE_PROGRAM_VERSIONS:
292    // GWT.runAsync(new RunAsyncGetView() {
293    // @Override
294    // public void onSuccess() {
295  0 callback.exec(coreManager.getProgramVersionsController());
296    // }
297    // });
298  0 break;
299  0 case BACC_PROGRAM_VIEW:
300    // GWT.runAsync(new RunAsyncGetView() {
301    // @Override
302    // public void onSuccess() {
303  0 if (ProgramRegistry.isCreateNew()) {
304  0 ProgramRegistry.setCreateNew(false);
305  0 credentialManager = new CredentialManager();
306    }
307  0 callback.exec(credentialManager.getBaccViewController());
308    // }
309    // });
310  0 break;
311  0 case BACC_PROGRAM_EDIT:
312    // GWT.runAsync(new RunAsyncGetView() {
313    // @Override
314    // public void onSuccess() {
315  0 callback.exec(credentialManager.getBaccEditController());
316    // }
317    // });
318  0 break;
319  0 case BACC_PROGRAM_VERSIONS:
320    // GWT.runAsync(new RunAsyncGetView() {
321    // @Override
322    // public void onSuccess() {
323  0 callback.exec(credentialManager.getProgramVersionsController());
324    // }
325    // });
326  0 break;
327  0 case LO_CATEGORIES:
328    // GWT.runAsync(new RunAsyncGetView() {
329    // @Override
330    // public void onSuccess() {
331  0 callback.exec(getCategoryManagementController());
332    // }
333    // });
334  0 break;
335  0 case DEPENDENCY_ANALYSIS:
336    // GWT.runAsync(new RunAsyncGetView() {
337    // @Override
338    // public void onSuccess() {
339  0 callback.exec(getDependencyAnalysisController());
340    // }
341    // });
342  0 break;
343  0 case BROWSE_PROGRAM:
344    // GWT.runAsync(new RunAsyncGetView() {
345    // @Override
346    // public void onSuccess() {
347  0 callback.exec(getBrowseProgramController());
348    // }
349    // });
350  0 break;
351  0 default:
352  0 callback.exec(home);
353    }
354    }
355   
356   
 
357  0 toggle private View getCategoryManagementController() {
358  0 return new CategoryManagementView(this, "Learning Objective Categories", LUMViews.LO_CATEGORIES);
359    }
360   
 
361  0 toggle private CourseProposalController getCourseProposalController() {
362  0 courseProposalController = new CourseProposalController();
363  0 return courseProposalController;
364    }
365   
 
366  0 toggle private CourseAdminController getCourseAdminController() {
367  0 courseAdminController = new CourseAdminController();
368  0 return courseAdminController;
369    }
370   
 
371  0 toggle private CourseAdminWithoutVersionController getCourseAdminRetireController(){
372  0 courseAdminRetireController = new CourseAdminRetireController();
373  0 return courseAdminRetireController;
374    }
375   
 
376  0 toggle private CourseAdminWithoutVersionController getCourseAdminWithoutVersionController(){
377  0 courseAdminWithoutVersionController = new CourseAdminWithoutVersionController();
378  0 return courseAdminWithoutVersionController;
379    }
380   
 
381  0 toggle private LayoutController getViewCourseController() {
382  0 if (viewCourseController == null) {
383  0 viewCourseController = new ViewCourseParentController();
384    }
385  0 return this.viewCourseController;
386    }
387   
 
388  0 toggle private LayoutController getCluSetsController() {
389  0 manageCluSetsController = new CluSetsManagementController();
390  0 return manageCluSetsController;
391    }
392   
 
393  0 toggle private LayoutController getBrowseCatalogController() {
394  0 browseCatalogController = new CatalogBrowserController(this);
395  0 return browseCatalogController;
396    }
397   
 
398  0 toggle private LayoutController getDependencyAnalysisController() {
399  0 dependencyAnalysisController = new DependencyAnalysisController("DependencyAnalaysis");
400  0 return dependencyAnalysisController;
401    }
402   
 
403  0 toggle private LayoutController getBrowseProgramController() {
404  0 browseProgramController = new BrowseProgramController("BrowseProgram");
405  0 return browseProgramController;
406    }
407   
 
408  0 toggle @Override
409    protected void hideView(View view) {
410  0 ApplicationController.getApplicationViewContainer().clear();
411    }
412   
 
413  0 toggle @Override
414    protected void renderView(View view) {
415  0 ApplicationController.getApplicationViewContainer().add(view.asWidget());
416    }
417   
 
418  0 toggle @Override
419    public Enum<?> getViewEnumValue(String enumValue) {
420  0 return LUMViews.valueOf(enumValue);
421    }
422   
 
423  0 toggle @Override
424    public void updateModel() {
425    // No model needed here
426    }
427   
 
428  0 toggle public <V extends Enum<?>> void showView(V viewType, Callback<Boolean> onReadyCallback) {
429  0 if (viewType == LUMViews.DEFAULT) {
430  0 WindowTitleUtils.setContextTitle(name);
431    }
432  0 super.showView(viewType, onReadyCallback);
433    }
434    }