Coverage Report - org.kuali.student.lum.lu.ui.course.client.controllers.CourseProposalController
 
Classes in this File Line Coverage Branch Coverage Complexity
CourseProposalController
0%
0/192
0%
0/74
2.026
CourseProposalController$1
0%
0/6
0%
0/2
2.026
CourseProposalController$1$1
0%
0/6
0%
0/4
2.026
CourseProposalController$10
0%
0/16
N/A
2.026
CourseProposalController$11
0%
0/9
0%
0/2
2.026
CourseProposalController$11$1
0%
0/9
0%
0/4
2.026
CourseProposalController$12
0%
0/5
N/A
2.026
CourseProposalController$13
0%
0/35
0%
0/14
2.026
CourseProposalController$14
0%
0/10
0%
0/2
2.026
CourseProposalController$15
0%
0/11
0%
0/6
2.026
CourseProposalController$15$1
0%
0/13
0%
0/4
2.026
CourseProposalController$15$1$1
0%
0/5
0%
0/2
2.026
CourseProposalController$15$1$2
0%
0/10
0%
0/2
2.026
CourseProposalController$16
0%
0/3
N/A
2.026
CourseProposalController$17
0%
0/3
N/A
2.026
CourseProposalController$18
0%
0/5
0%
0/2
2.026
CourseProposalController$19
0%
0/1
N/A
2.026
CourseProposalController$2
0%
0/5
0%
0/4
2.026
CourseProposalController$3
0%
0/3
N/A
2.026
CourseProposalController$4
0%
0/4
N/A
2.026
CourseProposalController$5
0%
0/19
0%
0/10
2.026
CourseProposalController$5$1
0%
0/14
N/A
2.026
CourseProposalController$6
0%
0/15
0%
0/10
2.026
CourseProposalController$7
0%
0/8
N/A
2.026
CourseProposalController$8
0%
0/10
N/A
2.026
CourseProposalController$8$1
0%
0/4
0%
0/2
2.026
CourseProposalController$9
0%
0/11
0%
0/2
2.026
CourseProposalController$9$1
0%
0/4
0%
0/2
2.026
 
 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.lum.lu.ui.course.client.controllers;
 17  
 
 18  
 import java.text.DateFormat;
 19  
 import java.util.ArrayList;
 20  
 import java.util.Date;
 21  
 import java.util.HashMap;
 22  
 import java.util.List;
 23  
 import java.util.Map;
 24  
 
 25  
 import org.kuali.student.common.assembly.data.Data;
 26  
 import org.kuali.student.common.assembly.data.Metadata;
 27  
 import org.kuali.student.common.assembly.data.QueryPath;
 28  
 import org.kuali.student.common.rice.StudentIdentityConstants;
 29  
 import org.kuali.student.common.rice.authorization.PermissionType;
 30  
 import org.kuali.student.common.ui.client.application.Application;
 31  
 import org.kuali.student.common.ui.client.application.KSAsyncCallback;
 32  
 import org.kuali.student.common.ui.client.application.ViewContext;
 33  
 import org.kuali.student.common.ui.client.configurable.mvc.layouts.MenuEditableSectionController;
 34  
 import org.kuali.student.common.ui.client.configurable.mvc.sections.Section;
 35  
 import org.kuali.student.common.ui.client.configurable.mvc.views.SectionView;
 36  
 import org.kuali.student.common.ui.client.event.ActionEvent;
 37  
 import org.kuali.student.common.ui.client.event.ContentDirtyEvent;
 38  
 import org.kuali.student.common.ui.client.event.ContentDirtyEventHandler;
 39  
 import org.kuali.student.common.ui.client.event.SaveActionEvent;
 40  
 import org.kuali.student.common.ui.client.event.SaveActionHandler;
 41  
 import org.kuali.student.common.ui.client.mvc.ActionCompleteCallback;
 42  
 import org.kuali.student.common.ui.client.mvc.Callback;
 43  
 import org.kuali.student.common.ui.client.mvc.Controller;
 44  
 import org.kuali.student.common.ui.client.mvc.DataModel;
 45  
 import org.kuali.student.common.ui.client.mvc.DataModelDefinition;
 46  
 import org.kuali.student.common.ui.client.mvc.HasCrossConstraints;
 47  
 import org.kuali.student.common.ui.client.mvc.ModelProvider;
 48  
 import org.kuali.student.common.ui.client.mvc.ModelRequestCallback;
 49  
 import org.kuali.student.common.ui.client.mvc.View;
 50  
 import org.kuali.student.common.ui.client.mvc.WorkQueue;
 51  
 import org.kuali.student.common.ui.client.mvc.WorkQueue.WorkItem;
 52  
 import org.kuali.student.common.ui.client.mvc.dto.ReferenceModel;
 53  
 import org.kuali.student.common.ui.client.mvc.history.HistoryManager;
 54  
 import org.kuali.student.common.ui.client.security.AuthorizationCallback;
 55  
 import org.kuali.student.common.ui.client.security.RequiresAuthorization;
 56  
 import org.kuali.student.common.ui.client.service.DataSaveResult;
 57  
 import org.kuali.student.common.ui.client.util.ExportElement;
 58  
 import org.kuali.student.common.ui.client.util.ExportUtils;
 59  
 import org.kuali.student.common.ui.client.util.WindowTitleUtils;
 60  
 import org.kuali.student.common.ui.client.widgets.KSButton;
 61  
 import org.kuali.student.common.ui.client.widgets.KSButtonAbstract.ButtonStyle;
 62  
 import org.kuali.student.common.ui.client.widgets.buttongroups.ButtonEnumerations.YesNoCancelEnum;
 63  
 import org.kuali.student.common.ui.client.widgets.dialog.ButtonMessageDialog;
 64  
 import org.kuali.student.common.ui.client.widgets.field.layout.button.ButtonGroup;
 65  
 import org.kuali.student.common.ui.client.widgets.field.layout.button.YesNoCancelGroup;
 66  
 import org.kuali.student.common.ui.client.widgets.menus.KSListPanel;
 67  
 import org.kuali.student.common.ui.client.widgets.notification.KSNotification;
 68  
 import org.kuali.student.common.ui.client.widgets.notification.KSNotifier;
 69  
 import org.kuali.student.common.ui.client.widgets.progress.BlockingTask;
 70  
 import org.kuali.student.common.ui.client.widgets.progress.KSBlockingProgressIndicator;
 71  
 import org.kuali.student.common.ui.client.widgets.table.summary.SummaryTable;
 72  
 import org.kuali.student.common.ui.client.widgets.table.summary.SummaryTableBlock;
 73  
 import org.kuali.student.common.ui.client.widgets.table.summary.SummaryTableModel;
 74  
 import org.kuali.student.common.ui.client.widgets.table.summary.SummaryTableRow;
 75  
 import org.kuali.student.common.ui.client.widgets.table.summary.SummaryTableSection;
 76  
 import org.kuali.student.common.ui.shared.IdAttributes;
 77  
 import org.kuali.student.common.ui.shared.IdAttributes.IdType;
 78  
 import org.kuali.student.common.validation.dto.ValidationResultInfo;
 79  
 import org.kuali.student.core.statement.dto.StatementTypeInfo;
 80  
 import org.kuali.student.core.workflow.ui.client.widgets.WorkflowEnhancedNavController;
 81  
 import org.kuali.student.core.workflow.ui.client.widgets.WorkflowUtilities;
 82  
 import org.kuali.student.lum.common.client.helpers.RecentlyViewedHelper;
 83  
 import org.kuali.student.lum.common.client.widgets.AppLocations;
 84  
 import org.kuali.student.lum.lu.ui.course.client.configuration.CourseConfigurer;
 85  
 import org.kuali.student.lum.lu.ui.course.client.configuration.CourseConfigurer.CourseSections;
 86  
 import org.kuali.student.lum.lu.ui.course.client.requirements.CourseRequirementsDataModel;
 87  
 import org.kuali.student.lum.lu.ui.course.client.requirements.HasRequirements;
 88  
 import org.kuali.student.lum.lu.ui.course.client.service.CourseRpcService;
 89  
 import org.kuali.student.lum.lu.ui.course.client.service.CourseRpcServiceAsync;
 90  
 import org.kuali.student.lum.lu.ui.course.client.service.CreditCourseProposalRpcService;
 91  
 import org.kuali.student.lum.lu.ui.course.client.service.CreditCourseProposalRpcServiceAsync;
 92  
 
 93  
 import com.google.gwt.core.client.GWT;
 94  
 import com.google.gwt.event.dom.client.ClickEvent;
 95  
 import com.google.gwt.event.dom.client.ClickHandler;
 96  
 import com.google.gwt.user.client.Window;
 97  
 import com.google.gwt.user.client.rpc.AsyncCallback;
 98  
 import com.google.gwt.user.client.ui.Widget;
 99  
 
 100  
 /**
 101  
  * Controller for course proposal screens.  This controller controls all functions of the course proposal process
 102  
  * and contains the data model and is responsible for retrieving its data and metadata from the server. In
 103  
  * addition, this controller is responsible for course proposal save events and updating its ui accordingly.
 104  
  * 
 105  
  *
 106  
  * @author Kuali Student Team
 107  
  *
 108  
  */
 109  
 
 110  0
 public class CourseProposalController extends MenuEditableSectionController implements RequiresAuthorization, WorkflowEnhancedNavController, HasRequirements {
 111  
 
 112  
         //RPC Services
 113  0
         CreditCourseProposalRpcServiceAsync cluProposalRpcServiceAsync = GWT.create(CreditCourseProposalRpcService.class);
 114  0
         CourseRpcServiceAsync courseServiceAsync = GWT.create(CourseRpcService.class);
 115  
         //Models
 116  0
         private final DataModel cluProposalModel = new DataModel("Proposal");
 117  0
         private final DataModel comparisonModel = new DataModel("Original Course");
 118  
 
 119  0
         CourseConfigurer cfg = GWT.create(CourseConfigurer.class);
 120  
         
 121  
         private WorkQueue modelRequestQueue;
 122  
 
 123  
     private WorkflowUtilities workflowUtil;
 124  
 
 125  0
         private boolean initialized = false;
 126  0
         private boolean isNew = false;
 127  
 
 128  
         private static final String UPDATED_KEY = "metaInfo/updateTime";
 129  
         private static final String VERSION_KEY  = "versionInfo/versionedFromId";
 130  
         private static final String MODIFY_TYPE = "kuali.proposal.type.course.modify";
 131  
         public static final String CREATE_TYPE = "kuali.proposal.type.course.create";
 132  
         public static final String INITIAL_SAVE_VERSION = "1";
 133  0
         private String currentDocType = CREATE_TYPE;
 134  0
         private String proposalPath = "";
 135  
         private String currentTitle;
 136  
 
 137  0
         private final DateFormat df = DateFormat.getInstance();
 138  
 
 139  0
         private final BlockingTask initializingTask = new BlockingTask("Loading");
 140  0
         private final BlockingTask loadDataTask = new BlockingTask("Retrieving Data");
 141  0
         private final BlockingTask saving = new BlockingTask("Saving");
 142  
     final CourseRequirementsDataModel reqDataModel;
 143  
    
 144  
     public CourseProposalController(){
 145  0
         super();
 146  0
         reqDataModel = new CourseRequirementsDataModel(this);
 147  0
         initialize();
 148  0
         addStyleName("courseProposal");
 149  0
     }
 150  
 
 151  
     @Override
 152  
     public void setViewContext(ViewContext viewContext) {
 153  0
             super.setViewContext(viewContext);
 154  0
             if(viewContext.getId() != null && !viewContext.getId().isEmpty()){
 155  0
                     if(viewContext.getIdType() != IdType.COPY_OF_OBJECT_ID){
 156  0
                             viewContext.setPermissionType(PermissionType.OPEN);
 157  
                     }
 158  
                     else{
 159  
                             //they are trying to make a modification
 160  0
                             viewContext.setPermissionType(PermissionType.INITIATE);
 161  
                     }
 162  
             }
 163  
             else{
 164  0
                     viewContext.setPermissionType(PermissionType.INITIATE);
 165  
             }
 166  0
     }
 167  
 
 168  
     private void initialize() {
 169  
             //TODO get from messages
 170  0
                    proposalPath = cfg.getProposalPath();
 171  0
                    workflowUtil = new WorkflowUtilities(CourseProposalController.this ,proposalPath);
 172  
 
 173  0
                    super.setDefaultModelId(cfg.getModelId());
 174  0
         super.registerModel(cfg.getModelId(), new ModelProvider<DataModel>() {
 175  
 
 176  
             @Override
 177  
             public void requestModel(final ModelRequestCallback<DataModel> callback) {
 178  0
                 if (modelRequestQueue == null){
 179  0
                     modelRequestQueue = new WorkQueue();
 180  
                 }
 181  
 
 182  0
                 WorkItem workItem = new WorkItem(){
 183  
                     @Override
 184  
                     public void exec(Callback<Boolean> workCompleteCallback) {
 185  0
                         if (cluProposalModel.getRoot() == null || initialized == false){
 186  0
                             initModel(callback, workCompleteCallback);
 187  
                         } else {
 188  0
                             callback.onModelReady(cluProposalModel);
 189  0
                             workCompleteCallback.exec(true);
 190  
                         }
 191  0
                     }
 192  
                 };
 193  0
                 modelRequestQueue.submit(workItem);
 194  
 
 195  0
             }
 196  
 
 197  
         });
 198  0
         super.registerModel("ComparisonModel", new ModelProvider<DataModel>() {
 199  
             @Override
 200  
             public void requestModel(final ModelRequestCallback<DataModel> callback) {
 201  0
                     if(comparisonModel.getRoot() != null && comparisonModel.getRoot().size() != 0){
 202  0
                             callback.onModelReady(comparisonModel);
 203  
                             
 204  
                     }
 205  
                     else{
 206  0
                             callback.onModelReady(null);
 207  
                     }
 208  
                 
 209  0
             }
 210  
         });
 211  0
         super.addApplicationEventHandler(ContentDirtyEvent.TYPE, new ContentDirtyEventHandler(){
 212  
                         public void onContentDirty(ContentDirtyEvent event) {
 213  0
                         setContentWarning("You have unsaved changes");                                
 214  0
                         }                
 215  
         });
 216  
 
 217  0
         addApplicationEventHandler(SaveActionEvent.TYPE, new SaveActionHandler(){
 218  
             public void doSave(SaveActionEvent saveAction) {
 219  0
                 GWT.log("CluProposalController received save action request.", null);
 220  0
                 doSaveAction(saveAction);
 221  0
             }
 222  
         });
 223  0
     }
 224  
 
 225  
     private void initModel(final ModelRequestCallback<DataModel> callback, Callback<Boolean> workCompleteCallback){
 226  0
             if(getViewContext().getIdType() == IdType.DOCUMENT_ID){
 227  0
             getCluProposalFromWorkflowId(callback, workCompleteCallback);
 228  0
         } else if (getViewContext().getIdType() == IdType.KS_KEW_OBJECT_ID){
 229  0
             getCluProposalFromProposalId(getViewContext().getId(), callback, workCompleteCallback);
 230  0
         } else if (getViewContext().getIdType() == IdType.COPY_OF_OBJECT_ID){
 231  0
             createModifyCluProposalModel("versionComment", callback, workCompleteCallback);
 232  
         } else{
 233  0
             createNewCluProposalModel(callback, workCompleteCallback);
 234  
         }
 235  0
     }
 236  
 
 237  
     private void getCurrentModel(final ModelRequestCallback<DataModel> callback, Callback<Boolean> workCompleteCallback){
 238  0
             if (cluProposalModel.getRoot() != null && cluProposalModel.getRoot().size() > 0){
 239  0
                 String id = cluProposalModel.get(cfg.getProposalPath()+"/id");
 240  0
                 if(id != null){
 241  0
                         getCluProposalFromProposalId(id, callback, workCompleteCallback);
 242  
                 }
 243  
                 else{
 244  0
                         initModel(callback, workCompleteCallback);
 245  
                 }
 246  0
             }
 247  
             else{
 248  0
                     initModel(callback, workCompleteCallback);
 249  
             }
 250  0
     }
 251  
 
 252  
     private void init(final Callback<Boolean> onReadyCallback) {
 253  0
             if (initialized) {
 254  0
                     onReadyCallback.exec(true);
 255  
             } else {
 256  0
                     initialized = true;
 257  0
                     KSBlockingProgressIndicator.addTask(initializingTask);
 258  0
                     setContentWarning("");
 259  0
             this.requestModel(new ModelRequestCallback<DataModel>(){
 260  
 
 261  
                                 @Override
 262  
                                 public void onModelReady(DataModel model) {
 263  
                                         //Setup View Context
 264  0
                                         String idType = null;
 265  0
                                     String viewContextId = "";
 266  0
                                     if(getViewContext().getIdType() != null){
 267  0
                                 idType = getViewContext().getIdType().toString();
 268  0
                                 viewContextId = getViewContext().getId();
 269  0
                                 if(getViewContext().getIdType()==IdAttributes.IdType.COPY_OF_OBJECT_ID){
 270  0
                                         viewContextId = null;
 271  
                                 }
 272  
 
 273  
                                     }
 274  0
                                         HashMap<String, String> idAttributes = new HashMap<String, String>();
 275  0
                                     if(idType != null){
 276  0
                                             idAttributes.put(IdAttributes.ID_TYPE, idType);
 277  
                                     }
 278  0
                                     if(cluProposalModel.get(VERSION_KEY) != null && !((String)cluProposalModel.get(VERSION_KEY)).equals("")){
 279  0
                                             currentDocType = MODIFY_TYPE;
 280  
                                     }
 281  0
                                     idAttributes.put(StudentIdentityConstants.DOCUMENT_TYPE_NAME, currentDocType);
 282  
 
 283  
                                     //Get metadata and complete initializing the screen
 284  0
                                     cluProposalRpcServiceAsync.getMetadata(viewContextId, idAttributes, new KSAsyncCallback<Metadata>(){
 285  
                                                 @Override
 286  
                         public void handleTimeout(Throwable caught) {
 287  0
                                         initializeFailed(); 
 288  0
                                                 }
 289  
 
 290  
                                                 @Override
 291  
                         public void handleFailure(Throwable caught) {
 292  0
                                                         initializeFailed();
 293  0
                                     throw new RuntimeException("Failed to get model definition.", caught);
 294  
                                 }
 295  
 
 296  
                                                 public void initializeFailed(){
 297  0
                                                 initialized = false;
 298  0
                                         onReadyCallback.exec(false);
 299  0
                                         KSBlockingProgressIndicator.removeTask(initializingTask);                                                        
 300  0
                                                 }
 301  
                                                 
 302  
                                 public void onSuccess(Metadata result) {
 303  0
                                         DataModelDefinition def = new DataModelDefinition(result);
 304  0
                                     cluProposalModel.setDefinition(def);
 305  0
                                     comparisonModel.setDefinition(def);
 306  
 
 307  0
                                     configureScreens(def, onReadyCallback);
 308  
 
 309  0
                                 }
 310  
                                   });
 311  
                                         
 312  0
                                 }
 313  
 
 314  
                                 @Override
 315  
                                 public void onRequestFail(Throwable cause) {
 316  0
                                         GWT.log("Failed to get modeld for proposal controller init");
 317  0
                                         onReadyCallback.exec(false);
 318  0
                                 }
 319  
                         });
 320  
                                 
 321  
             }
 322  0
     }
 323  
 
 324  
     private void configureScreens(final DataModelDefinition modelDefinition, final Callback<Boolean> onReadyCallback){
 325  0
         workflowUtil.requestAndSetupModel();
 326  
 
 327  0
         CourseRequirementsDataModel.getStatementTypes(new Callback<List<StatementTypeInfo>>() {
 328  
 
 329  
             @Override
 330  
             public void exec(List<StatementTypeInfo> stmtTypes) {
 331  0
                 List<StatementTypeInfo> stmtTypesOut = new ArrayList<StatementTypeInfo>();
 332  0
                 if (stmtTypes != null) {
 333  0
                     for (StatementTypeInfo stmtType : stmtTypes) {
 334  0
                         if (stmtType.getId().contains("kuali.statement.type.course.enrollmentEligibility") ||
 335  
                             stmtType.getId().contains("kuali.statement.type.course.creditConstraints")) {
 336  0
                             continue;
 337  
                         }
 338  0
                         stmtTypesOut.add(stmtType);
 339  
                     }
 340  
                 }
 341  
 
 342  0
                 cfg.setStatementTypes(stmtTypesOut);
 343  0
                 cfg.setModelDefinition(modelDefinition);
 344  0
                 cfg.configure(CourseProposalController.this);
 345  
                 
 346  
                 //Update any cross fields
 347  0
                 for(HasCrossConstraints crossConstraint:Application.getApplicationContext().getCrossConstraints(null)){
 348  0
                         crossConstraint.reprocessWithUpdatedConstraints();
 349  
                 }
 350  
                 
 351  0
                 onReadyCallback.exec(true);
 352  0
                 KSBlockingProgressIndicator.removeTask(initializingTask);
 353  0
             }
 354  
         });
 355  0
     }
 356  
 
 357  
     @Override
 358  
     @SuppressWarnings("unchecked")
 359  
     public void requestModel(Class modelType, final ModelRequestCallback callback) {
 360  0
         if(modelType == ReferenceModel.class){
 361  0
                 if (cluProposalModel != null){
 362  0
                         ReferenceModel ref = new ReferenceModel();
 363  
 
 364  0
                         if(cluProposalModel.get(cfg.getProposalPath()) != null){
 365  0
                             ref.setReferenceId((String)cluProposalModel.get(cfg.getProposalPath()+"/id"));
 366  
                         } else {
 367  0
                                 ref.setReferenceId(null);
 368  
                         }
 369  
                         
 370  
                         //Use the referenceAttribute to store misc data from the parent model like reference name, etc
 371  0
                         if(cluProposalModel.get(cfg.getProposalPath()) != null){
 372  0
                                 Map<String, String> attributes = new HashMap<String, String>();
 373  0
                                 attributes.put("name", (String)cluProposalModel.get(cfg.getProposalPath()+"/name"));
 374  0
                                 ref.setReferenceAttributes(attributes);
 375  0
                         } else {
 376  0
                                 ref.setReferenceAttributes(null);
 377  
                         }
 378  
 
 379  0
                         ref.setReferenceTypeKey(cfg.getProposalReferenceTypeKey());
 380  0
                         ref.setReferenceType(cfg.getProposalReferenceObjectType());
 381  0
                         ref.setReferenceState(getViewContext().getState());
 382  
 
 383  0
                         callback.onModelReady(ref);
 384  0
                 }
 385  0
         } else if (modelType == Data.class){
 386  0
                 requestModel(cfg.getModelId(), callback);
 387  
         } else {
 388  0
             super.requestModel(modelType, callback);
 389  
         }
 390  
 
 391  0
     }
 392  
 
 393  
     @SuppressWarnings("unchecked")
 394  
     private void getCluProposalFromWorkflowId(final ModelRequestCallback callback, final Callback<Boolean> workCompleteCallback){
 395  0
         KSBlockingProgressIndicator.addTask(loadDataTask);
 396  0
         workflowUtil.getDataIdFromWorkflowId(getViewContext().getId(), new KSAsyncCallback<String>(){
 397  
                         @Override
 398  
                         public void handleFailure(Throwable caught) {
 399  0
                 Window.alert("Error loading Proposal from Workflow Document: "+caught.getMessage());
 400  0
                 createNewCluProposalModel(callback, workCompleteCallback);
 401  0
                 KSBlockingProgressIndicator.removeTask(loadDataTask);
 402  0
                         }
 403  
 
 404  
                         @Override
 405  
                         public void onSuccess(String proposalId) {
 406  0
                                 KSBlockingProgressIndicator.removeTask(loadDataTask);
 407  0
                                 getCluProposalFromProposalId(proposalId, callback, workCompleteCallback);
 408  0
                         }
 409  
         });
 410  0
     }
 411  
 
 412  
     @SuppressWarnings("unchecked")
 413  
     private void getCluProposalFromProposalId(String id, final ModelRequestCallback callback, final Callback<Boolean> workCompleteCallback){
 414  0
             KSBlockingProgressIndicator.addTask(loadDataTask);
 415  0
             cluProposalRpcServiceAsync.getData(id, new KSAsyncCallback<Data>(){
 416  
 
 417  
                         @Override
 418  
                         public void handleFailure(Throwable caught) {
 419  0
                 Window.alert("Error loading Proposal: "+caught.getMessage());
 420  0
                 createNewCluProposalModel(callback, workCompleteCallback);
 421  0
                 KSBlockingProgressIndicator.removeTask(loadDataTask);
 422  0
                         }
 423  
 
 424  
                         @Override
 425  
                         public void onSuccess(Data result) {
 426  0
                                 cluProposalModel.setRoot(result);
 427  0
                         setProposalHeaderTitle();
 428  0
                         setLastUpdated();
 429  0
                 reqDataModel.retrieveStatementTypes(cluProposalModel.<String>get("id"), new Callback<Boolean>() {
 430  
                     @Override
 431  
                     public void exec(Boolean result) {
 432  0
                        if(result){
 433  0
                           getCourseComparisonModel(callback, workCompleteCallback);
 434  
                        }
 435  0
                     }
 436  
                 });
 437  0
                         }
 438  
 
 439  
             });
 440  0
     }
 441  
 
 442  
     @SuppressWarnings("unchecked")
 443  
         private void getCourseComparisonModel(final ModelRequestCallback proposalModelRequestCallback, final Callback<Boolean> workCompleteCallback){
 444  0
                 if(cluProposalModel.get(VERSION_KEY) != null && !((String)cluProposalModel.get(VERSION_KEY)).equals("")){
 445  0
                         courseServiceAsync.getData((String)cluProposalModel.get(VERSION_KEY), new KSAsyncCallback<Data>(){
 446  
         
 447  
                             @Override
 448  
                     public void handleFailure(Throwable caught) {
 449  0
                         Window.alert("Error loading Proposal: "+caught.getMessage());
 450  0
                         createNewCluProposalModel(proposalModelRequestCallback, workCompleteCallback);
 451  0
                         KSBlockingProgressIndicator.removeTask(loadDataTask);
 452  0
                     }
 453  
 
 454  
                 @Override
 455  
                 public void onSuccess(Data result) {
 456  0
                     if (result != null) {
 457  0
                         comparisonModel.setRoot(result);
 458  
                     }
 459  0
                     proposalModelRequestCallback.onModelReady(cluProposalModel);
 460  0
                     workCompleteCallback.exec(true);
 461  0
                     reqDataModel.retrieveStatementTypes(cluProposalModel.<String>get("id"), new Callback<Boolean>() {
 462  
                         @Override
 463  
                         public void exec(Boolean result) {
 464  0
                             if (result) {
 465  
                                 //getCourseComparisonModel(proposalModelRequestCallback, workCompleteCallback);
 466  0
                                 KSBlockingProgressIndicator.removeTask(loadDataTask);
 467  
                             }
 468  0
                         }
 469  
                     });
 470  
 
 471  0
                 }
 472  
             });
 473  
         } else {
 474  0
             proposalModelRequestCallback.onModelReady(cluProposalModel);
 475  0
             workCompleteCallback.exec(true);
 476  0
             KSBlockingProgressIndicator.removeTask(loadDataTask);
 477  
         }
 478  0
     }
 479  
 
 480  
     @SuppressWarnings("unchecked")
 481  
     private void createNewCluProposalModel(final ModelRequestCallback callback, final Callback<Boolean> workCompleteCallback){
 482  0
         cluProposalModel.setRoot(new Data());
 483  0
         isNew = true;
 484  0
         setProposalHeaderTitle();
 485  0
         setLastUpdated();
 486  0
         callback.onModelReady(cluProposalModel);
 487  0
         workCompleteCallback.exec(true);
 488  0
     }
 489  
 
 490  
     @SuppressWarnings("unchecked")
 491  
     private void createModifyCluProposalModel(String versionComment, final ModelRequestCallback callback, final Callback<Boolean> workCompleteCallback){
 492  0
         Data data = new Data();
 493  
         
 494  0
         Data proposalData = new Data();
 495  0
         proposalData.set(new Data.StringKey("type"), MODIFY_TYPE);
 496  0
         data.set(new Data.StringKey("proposal"), proposalData);
 497  
         
 498  0
         Data versionData = new Data();
 499  0
         versionData.set(new Data.StringKey("versionIndId"), getViewContext().getId());
 500  0
         versionData.set(new Data.StringKey("versionComment"), versionComment);
 501  0
         data.set(new Data.StringKey("versionInfo"), versionData);
 502  
         
 503  0
         cluProposalModel.setRoot(data);
 504  0
         cluProposalRpcServiceAsync.saveData(cluProposalModel.getRoot(), new AsyncCallback<DataSaveResult>() {
 505  
                         public void onSuccess(DataSaveResult result) {
 506  0
                                 cluProposalModel.setRoot(result.getValue());
 507  0
                                 setProposalHeaderTitle();
 508  0
                         setLastUpdated();
 509  
                         //add to recently viewed now that we know the id of proposal
 510  0
                         ViewContext docContext = new ViewContext();
 511  0
                         docContext.setId((String) cluProposalModel.get(cfg.getProposalPath()+"/id"));
 512  0
                         docContext.setIdType(IdType.KS_KEW_OBJECT_ID);
 513  0
                         RecentlyViewedHelper.addDocument(getProposalTitle(), 
 514  
                                         HistoryManager.appendContext(AppLocations.Locations.COURSE_PROPOSAL.getLocation(), docContext)
 515  
                                         + "/SUMMARY");
 516  0
                         getCourseComparisonModel(callback, workCompleteCallback);
 517  
                         
 518  
                         // We need to update the current view context so that if the user clicks the back button it doesn't 
 519  
                         // create a duplicate course proposal. 
 520  0
                         getViewContext().setIdType(docContext.getIdType());
 521  0
                         getViewContext().setId(docContext.getId());
 522  
                         
 523  0
                         }
 524  
                         
 525  
                         public void onFailure(Throwable caught) {
 526  0
                 Window.alert("Error loading Proposal: "+caught.getMessage());
 527  0
                 createNewCluProposalModel(callback, workCompleteCallback);
 528  0
                 KSBlockingProgressIndicator.removeTask(loadDataTask);
 529  0
                         }
 530  
                 });
 531  0
     }
 532  
 
 533  
     public void doSaveAction(final SaveActionEvent saveActionEvent){
 534  0
         requestModel(new ModelRequestCallback<DataModel>() {
 535  
             @Override
 536  
             public void onModelReady(DataModel model) {
 537  0
                 CourseProposalController.this.updateModelFromCurrentView();
 538  
 
 539  0
                 if (isStartViewShowing()){
 540  
                         //This call required so fields in start section, which also appear in
 541  
                         //other sections don't get overridden from updateModel call above.
 542  0
                         getStartPopupView().updateModel();
 543  
                 }
 544  
 
 545  0
                     model.validate(new Callback<List<ValidationResultInfo>>() {
 546  
                     @Override
 547  
                     public void exec(List<ValidationResultInfo> result) {
 548  
 
 549  0
                             boolean isSectionValid = isValid(result, true);
 550  
 
 551  0
                             if(isSectionValid){
 552  0
                             if (startSectionRequired()){
 553  0
                                 showStartPopup(NO_OP_CALLBACK);
 554  0
                                 saveActionEvent.doActionComplete();
 555  
                             }
 556  
                             else{
 557  0
                                     saveProposalClu(saveActionEvent);
 558  
                             }
 559  
                             }
 560  
                             else{
 561  
                                     //saveActionEvent.doActionComplete();
 562  0
                                     KSNotifier.add(new KSNotification("Unable to save, please check fields for errors.", false, true, 5000));
 563  
                             }
 564  
 
 565  0
                     }
 566  
                 });
 567  0
             }
 568  
 
 569  
             @Override
 570  
             public void onRequestFail(Throwable cause) {
 571  0
                     saveActionEvent.doActionComplete();
 572  0
                 GWT.log("Unable to retrieve model for validation and save", cause);
 573  0
             }
 574  
 
 575  
         });
 576  
 
 577  0
     }
 578  
 
 579  
     public boolean startSectionRequired(){
 580  0
         String proposalId = cluProposalModel.get(cfg.getProposalPath()+"/id");
 581  
         
 582  
         //Defaulting the proposalTitle to courseTitle, this way course data gets set and assembler doesn't
 583  
         //complain. This may not be the correct approach.
 584  0
         String proposalTitle = cluProposalModel.get(cfg.getProposalTitlePath());
 585  0
         String courseTitle = cluProposalModel.get(cfg.getCourseTitlePath());
 586  0
         if (proposalTitle == null || proposalTitle.isEmpty()){
 587  0
             cluProposalModel.set(QueryPath.parse(cfg.getProposalTitlePath()), courseTitle);
 588  
         }
 589  
         
 590  0
             return proposalId==null && !CourseProposalController.this.isStartViewShowing() && !hasTitles(proposalTitle, courseTitle);
 591  
     }
 592  
 
 593  
     private boolean hasTitles(String proposalTitle, String courseTitle){
 594  0
             return (proposalTitle != null && !proposalTitle.isEmpty()) && (courseTitle != null && !courseTitle.isEmpty());
 595  
     }
 596  
     
 597  
     public void saveProposalClu(final SaveActionEvent saveActionEvent){
 598  0
             KSBlockingProgressIndicator.addTask(saving);
 599  0
         final Callback<Throwable> saveFailedCallback = new Callback<Throwable>() {
 600  
 
 601  
                         @Override
 602  
                         public void exec(Throwable caught) {
 603  0
                                  GWT.log("Save Failed.", caught);
 604  0
                                  KSBlockingProgressIndicator.removeTask(saving);
 605  0
                  KSNotifier.add(new KSNotification("Save Failed on server. Please try again.", false, true, 5000));
 606  0
                         }
 607  
 
 608  
         };
 609  
         try {
 610  0
             cluProposalRpcServiceAsync.saveData(cluProposalModel.getRoot(), new KSAsyncCallback<DataSaveResult>(){
 611  
                 @Override
 612  
                 public void handleFailure(Throwable caught) {
 613  0
                    saveFailedCallback.exec(caught);
 614  0
                 }
 615  
 
 616  
                 public void onSuccess(DataSaveResult result) {
 617  0
                         KSBlockingProgressIndicator.removeTask(saving);
 618  
 
 619  0
                         if(result.getValidationResults()!=null && !result.getValidationResults().isEmpty()){
 620  0
                                 isValid(result.getValidationResults(), false, true);
 621  0
                             saveActionEvent.setGotoNextView(false);
 622  0
                         saveActionEvent.doActionComplete();
 623  0
                         KSNotifier.add(new KSNotification("Save Failed. There were validation errors.", false, 5000));
 624  
                         }else{
 625  
                                 
 626  0
                                 saveActionEvent.setSaveSuccessful(true);
 627  0
                                 cluProposalModel.setRoot(result.getValue());
 628  0
                                 String title = getProposalTitle();
 629  
 
 630  0
                                 View currentView = getCurrentView();
 631  0
                                             if (currentView instanceof SectionView){
 632  0
                                                     ((SectionView)currentView).updateView(cluProposalModel);
 633  0
                                                     ((SectionView) currentView).resetDirtyFlags();
 634  
                                 }
 635  0
                             saveActionEvent.doActionComplete();
 636  
                             
 637  0
                                             ViewContext context = CourseProposalController.this.getViewContext();
 638  0
                                             context.setId((String)cluProposalModel.get(proposalPath+"/id"));
 639  0
                                             context.setIdType(IdType.KS_KEW_OBJECT_ID);
 640  
                                             
 641  
                                             //Ensure workflow doc status gets updated from draft, only done on intial save
 642  
                                             //to reduce workflow rpc calls.
 643  0
                                             String proposalVersion = cluProposalModel.get(proposalPath+"/metaInfo/versionInd");
 644  0
                                             if (INITIAL_SAVE_VERSION.equals(proposalVersion)){
 645  0
                                                     workflowUtil.refresh();
 646  
                                             }
 647  
                                             
 648  0
                                             setProposalHeaderTitle();
 649  0
                                             setLastUpdated();
 650  0
                                             HistoryManager.logHistoryChange();
 651  0
                                 if(isNew){
 652  0
                                         RecentlyViewedHelper.addCurrentDocument(title);
 653  
                                 }
 654  0
                                 else if(!currentTitle.equals(title)){
 655  0
                                         RecentlyViewedHelper.updateTitle(currentTitle, title, (String)cluProposalModel.get(proposalPath+"/id"));
 656  
                                 }
 657  0
                                 isNew = false;
 658  
                                             
 659  0
                                             if(saveActionEvent.gotoNextView()){
 660  0
                                                     CourseProposalController.this.showNextViewOnMenu();
 661  
                                             }
 662  0
                                             KSNotifier.add(new KSNotification("Save Successful", false, 4000));
 663  
                         }
 664  0
                 }
 665  
             });
 666  0
         } catch (Exception e) {
 667  0
                 saveFailedCallback.exec(e);
 668  0
         }
 669  
 
 670  0
     }
 671  
 
 672  
     public void setLastUpdated(){
 673  0
             Date lastUpdated = (Date)cluProposalModel.get(UPDATED_KEY);
 674  0
             if(lastUpdated != null){
 675  0
                     setContentInfo("Last Updated: " + df.format(lastUpdated));
 676  
             }
 677  
             else{
 678  0
                     setContentInfo("");
 679  
             }
 680  0
     }
 681  
 
 682  
     @Override
 683  
         public void beforeShow(final Callback<Boolean> onReadyCallback){
 684  0
             Application.getApplicationContext().clearCrossConstraintMap(null);
 685  0
             Application.getApplicationContext().clearPathToFieldMapping(null);
 686  0
             Application.getApplicationContext().setParentPath("");
 687  
             
 688  0
             init(onReadyCallback);
 689  0
         }
 690  
     
 691  
    @Override
 692  
    public void showDefaultView(Callback<Boolean> onReadyCallback) {
 693  0
            if(isNew){
 694  0
                    super.showFirstView(onReadyCallback);
 695  
            }
 696  
            else{
 697  0
                    super.showDefaultView(onReadyCallback);
 698  
            }
 699  0
    }
 700  
 
 701  
         @Override
 702  
     public void setParentController(Controller controller) {
 703  0
         super.setParentController(controller);
 704  0
     }
 705  
 
 706  
         @Override
 707  
         public void checkAuthorization(final PermissionType permissionType, final AuthorizationCallback authCallback) {
 708  0
                 Map<String,String> attributes = new HashMap<String,String>();
 709  
 //                if (StringUtils.isNotBlank(getViewContext().getId())) {
 710  0
                 GWT.log("Attempting Auth Check.", null);
 711  0
                 if ( (getViewContext().getId() != null) && (!"".equals(getViewContext().getId())) ) {
 712  0
                         attributes.put(getViewContext().getIdType().toString(), getViewContext().getId());
 713  
                 }
 714  
 
 715  0
                 cluProposalRpcServiceAsync.isAuthorized(permissionType, attributes, new KSAsyncCallback<Boolean>(){
 716  
 
 717  
                         @Override
 718  
                         public void handleFailure(Throwable caught) {
 719  0
                                 authCallback.isNotAuthorized("Error checking authorization.");
 720  0
                                 GWT.log("Error checking proposal authorization.", caught);
 721  0
                 Window.alert("Error Checking Proposal Authorization: "+caught.getMessage());
 722  0
                         }
 723  
 
 724  
                         @Override
 725  
                         public void onSuccess(Boolean result) {
 726  0
                                 GWT.log("Succeeded checking auth for permission type '" + permissionType + "' with result: " + result, null);
 727  0
                                 if (Boolean.TRUE.equals(result)) {
 728  0
                                         authCallback.isAuthorized();
 729  
                                 }
 730  
                                 else {
 731  0
                                         authCallback.isNotAuthorized("User is not authorized: " + permissionType);
 732  
                                 }
 733  0
                         }
 734  
             });
 735  0
         }
 736  
 
 737  
         @Override
 738  
         public boolean isAuthorizationRequired() {
 739  0
                 return true;
 740  
         }
 741  
 
 742  
         @Override
 743  
         public void setAuthorizationRequired(boolean required) {
 744  0
                 throw new UnsupportedOperationException();
 745  
         }
 746  
 
 747  
     protected void setProposalHeaderTitle(){
 748  
             String title;
 749  0
             if (cluProposalModel.get(cfg.getProposalTitlePath()) != null){
 750  0
                     title = getProposalTitle();
 751  
             }
 752  
             else{
 753  0
                     title = "New Course (Proposal)";
 754  
             }
 755  0
             this.setContentTitle(title);
 756  0
             this.setName(title);
 757  0
             WindowTitleUtils.setContextTitle(title);
 758  0
                 currentTitle = title;
 759  0
     }
 760  
 
 761  
         @Override
 762  
         public WorkflowUtilities getWfUtilities() {
 763  0
                 return workflowUtil;
 764  
         }
 765  
 
 766  
         @Override
 767  
         public void beforeViewChange(Enum<?> viewChangingTo, final Callback<Boolean> okToChange) {
 768  
                 //We do this check here because theoretically the subcontroller views
 769  
                 //will display their own messages to the user to give them a reason why the view
 770  
                 //change has been cancelled, otherwise continue to check for reasons not to change
 771  
                 //with this controller
 772  0
                 super.beforeViewChange(viewChangingTo, new Callback<Boolean>(){
 773  
 
 774  
                         @Override
 775  
                         public void exec(Boolean result) {
 776  0
                                 if(result){
 777  0
                                         if(getCurrentView() instanceof SectionView && ((SectionView)getCurrentView()).isDirty()){
 778  0
                                                 ButtonGroup<YesNoCancelEnum> buttonGroup = new YesNoCancelGroup();
 779  0
                                                 final ButtonMessageDialog<YesNoCancelEnum> dialog = new ButtonMessageDialog<YesNoCancelEnum>("Warning", "You may have unsaved changes.  Save changes?", buttonGroup);
 780  0
                                                 buttonGroup.addCallback(new Callback<YesNoCancelEnum>(){
 781  
 
 782  
                                                         @Override
 783  
                                                         public void exec(YesNoCancelEnum result) {
 784  0
                                                                 switch(result){
 785  
                                                                         case YES:
 786  0
                                                                                 dialog.hide();
 787  0
                                                                                 final SaveActionEvent e = new SaveActionEvent();
 788  0
                                                                                 e.setActionCompleteCallback(new ActionCompleteCallback(){
 789  
 
 790  
                                                                                         @Override
 791  
                                                                                         public void onActionComplete(ActionEvent action) {
 792  0
                                                                                                 if(e.isSaveSuccessful()){
 793  0
                                                                                                         okToChange.exec(true);
 794  
                                                                                                 }
 795  
                                                                                                 else{
 796  0
                                                                                                         okToChange.exec(false);
 797  
                                                                                                 }
 798  0
                                                                                         }
 799  
                                                                                         
 800  
                                                                                 });
 801  0
                                                                                 fireApplicationEvent(e);
 802  0
                                                                                 break;
 803  
                                                                         case NO:
 804  
                                                                                 //Force a model request from server
 805  0
                                                                                 getCurrentModel(new ModelRequestCallback<DataModel>(){
 806  
 
 807  
                                                                                         @Override
 808  
                                                                                         public void onModelReady(DataModel model) {
 809  0
                                                                                                 if (getCurrentView()instanceof Section){
 810  0
                                                                                                     ((Section) getCurrentView()).resetFieldInteractionFlags();
 811  
                                                                                                 }
 812  0
                                                                                                 okToChange.exec(true);
 813  0
                                                                                                 dialog.hide();
 814  0
                                                                                         }
 815  
 
 816  
                                                                                         @Override
 817  
                                                                                         public void onRequestFail(Throwable cause) {
 818  
                                                                                                 //TODO Is this correct... do we want to stop view change if we can't restore the data?  Possibly traps the user
 819  
                                                                                                 //if we don't it messes up saves, possibly warn the user that it failed and continue?
 820  0
                                                                                                 okToChange.exec(false);
 821  0
                                                                                                 dialog.hide();
 822  0
                                                                                                 GWT.log("Unable to retrieve model for data restore on view change with no save", cause);
 823  0
                                                                                         }},
 824  
                                                                                         NO_OP_CALLBACK);
 825  
 
 826  0
                                                                                 break;
 827  
                                                                         case CANCEL:
 828  0
                                                                                 okToChange.exec(false);
 829  0
                                                                                 dialog.hide();
 830  
                                                                                 // Because this event fires after the history change event we need to "undo" the history events. 
 831  0
                                                                                 HistoryManager.logHistoryChange();  
 832  
                                                                                 break;
 833  
                                                                 }
 834  0
                                                         }
 835  
                                                 });
 836  0
                                                 dialog.show();
 837  0
                                         }
 838  
                                         else{
 839  0
                                                 okToChange.exec(true);
 840  
                                         }
 841  
                                 }
 842  
                                 else{
 843  0
                                         okToChange.exec(false);
 844  
                                 }
 845  0
                         }
 846  
                 });
 847  0
         }
 848  
         
 849  
     public KSButton getSaveButton(){
 850  0
             if(currentDocType != MODIFY_TYPE){
 851  0
                 return new KSButton("Save and Continue", new ClickHandler(){
 852  
                             public void onClick(ClickEvent event) {
 853  0
                                     CourseProposalController.this.fireApplicationEvent(new SaveActionEvent(true));
 854  0
                             }
 855  
                         });
 856  
             }
 857  
             else{
 858  0
                     return new KSButton("Save", new ClickHandler(){
 859  
                 public void onClick(ClickEvent event) {
 860  0
                     CourseProposalController.this.fireApplicationEvent(new SaveActionEvent(false));
 861  0
                 }
 862  
             });
 863  
             }
 864  
     }
 865  
     
 866  
     public KSButton getCancelButton(final Enum<?> summaryView){
 867  
             
 868  0
         return new KSButton("Cancel", ButtonStyle.ANCHOR_LARGE_CENTERED, new ClickHandler(){
 869  
                     public void onClick(ClickEvent event) {
 870  0
                             if(!isNew){
 871  0
                                     CourseProposalController.this.showView(summaryView);
 872  
                             }
 873  
                             else{
 874  0
                                     Application.navigate(AppLocations.Locations.CURRICULUM_MANAGEMENT.getLocation());
 875  
                             }
 876  0
                     }
 877  
                 });
 878  
 
 879  
     }
 880  
         
 881  
         @Override
 882  
         public void onHistoryEvent(String historyStack) {
 883  0
                 super.onHistoryEvent(historyStack);
 884  
                 //we dont want to add proposals that are brand new before saving, or copy addresses (as they will initiate
 885  
                 //the modify/copy logic again if called)
 886  0
                 if(cluProposalModel.get(cfg.getProposalTitlePath()) != null && 
 887  
                                 this.getViewContext().getIdType() != IdType.COPY_OF_OBJECT_ID){
 888  0
                         RecentlyViewedHelper.addCurrentDocument(getProposalTitle());
 889  
                 }
 890  0
         }
 891  
         
 892  
         private String getProposalTitle(){
 893  0
                 StringBuffer sb = new StringBuffer();
 894  0
                 sb.append(cluProposalModel.get(cfg.getProposalTitlePath()));
 895  0
                 sb.append(" (Proposal)");
 896  0
                 return sb.toString();
 897  
         }
 898  
 
 899  
     public String getCourseId(){
 900  0
         return cluProposalModel.<String>get("id");
 901  
     }
 902  
 
 903  
     public boolean isNew() {
 904  0
         return isNew;
 905  
     }
 906  
 
 907  
     public CourseRequirementsDataModel getReqDataModel() {
 908  0
         return reqDataModel;
 909  
     }
 910  
       
 911  
     @Override
 912  
     public DataModel getExportDataModel() {
 913  0
         return cluProposalModel;
 914  
     }
 915  
     
 916  
     /**
 917  
      * 
 918  
      * @see org.kuali.student.common.ui.client.reporting.ReportExport#getExportTemplateName()
 919  
      */
 920  
     @Override
 921  
     public String getExportTemplateName() {
 922  0
         return "proposal.template";
 923  
     }
 924  
     
 925  
     @Override
 926  
     public ArrayList<ExportElement> getExportElementsFromView() {
 927  0
         ArrayList<ExportElement> exportElements = new ArrayList<ExportElement>();
 928  0
         if (this.getCurrentViewEnum().equals(CourseSections.SUMMARY)) {      
 929  0
             SummaryTableSection tableSection = this.cfg.getSummaryConfigurer().getTableSection();
 930  0
             ExportElement heading = new ExportElement();
 931  0
             heading.setFieldLabel("");
 932  0
             heading.setFieldValue(cluProposalModel.getModelName());
 933  0
             heading.setFieldValue2(comparisonModel.getModelName());
 934  0
             exportElements.add(heading);
 935  0
             exportElements = ExportUtils.getDetailsForWidget(tableSection, exportElements);
 936  
         }
 937  0
         return exportElements;
 938  
     }
 939  
     
 940  
     @Override
 941  
     public boolean isExportButtonActive() {
 942  0
         if (this.getCurrentViewEnum() != null && this.getCurrentViewEnum().equals(CourseSections.SUMMARY)) {   
 943  0
             return true;
 944  
         } else {
 945  0
             return false;
 946  
         }
 947  
             
 948  
     }  
 949  
 }