| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 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.dto.DtoConstants; |
| 29 | |
import org.kuali.student.common.rice.StudentIdentityConstants; |
| 30 | |
import org.kuali.student.common.rice.authorization.PermissionType; |
| 31 | |
import org.kuali.student.common.ui.client.application.Application; |
| 32 | |
import org.kuali.student.common.ui.client.application.KSAsyncCallback; |
| 33 | |
import org.kuali.student.common.ui.client.application.ViewContext; |
| 34 | |
import org.kuali.student.common.ui.client.configurable.mvc.FieldDescriptor; |
| 35 | |
import org.kuali.student.common.ui.client.configurable.mvc.layouts.MenuEditableSectionController; |
| 36 | |
import org.kuali.student.common.ui.client.configurable.mvc.sections.BaseSection; |
| 37 | |
import org.kuali.student.common.ui.client.configurable.mvc.sections.Section; |
| 38 | |
import org.kuali.student.common.ui.client.configurable.mvc.views.SectionView; |
| 39 | |
import org.kuali.student.common.ui.client.event.ActionEvent; |
| 40 | |
import org.kuali.student.common.ui.client.event.ContentDirtyEvent; |
| 41 | |
import org.kuali.student.common.ui.client.event.ContentDirtyEventHandler; |
| 42 | |
import org.kuali.student.common.ui.client.event.SaveActionEvent; |
| 43 | |
import org.kuali.student.common.ui.client.event.SaveActionHandler; |
| 44 | |
import org.kuali.student.common.ui.client.mvc.ActionCompleteCallback; |
| 45 | |
import org.kuali.student.common.ui.client.mvc.Callback; |
| 46 | |
import org.kuali.student.common.ui.client.mvc.Controller; |
| 47 | |
import org.kuali.student.common.ui.client.mvc.DataModel; |
| 48 | |
import org.kuali.student.common.ui.client.mvc.DataModelDefinition; |
| 49 | |
import org.kuali.student.common.ui.client.mvc.HasCrossConstraints; |
| 50 | |
import org.kuali.student.common.ui.client.mvc.ModelProvider; |
| 51 | |
import org.kuali.student.common.ui.client.mvc.ModelRequestCallback; |
| 52 | |
import org.kuali.student.common.ui.client.mvc.View; |
| 53 | |
import org.kuali.student.common.ui.client.mvc.WorkQueue; |
| 54 | |
import org.kuali.student.common.ui.client.mvc.WorkQueue.WorkItem; |
| 55 | |
import org.kuali.student.common.ui.client.mvc.dto.ReferenceModel; |
| 56 | |
import org.kuali.student.common.ui.client.mvc.history.HistoryManager; |
| 57 | |
import org.kuali.student.common.ui.client.security.AuthorizationCallback; |
| 58 | |
import org.kuali.student.common.ui.client.security.RequiresAuthorization; |
| 59 | |
import org.kuali.student.common.ui.client.service.BaseDataOrchestrationRpcServiceAsync; |
| 60 | |
import org.kuali.student.common.ui.client.service.DataSaveResult; |
| 61 | |
import org.kuali.student.common.ui.client.util.ExportElement; |
| 62 | |
import org.kuali.student.common.ui.client.util.ExportUtils; |
| 63 | |
import org.kuali.student.common.ui.client.util.WindowTitleUtils; |
| 64 | |
import org.kuali.student.common.ui.client.validator.ValidatorClientUtils; |
| 65 | |
import org.kuali.student.common.ui.client.widgets.KSButton; |
| 66 | |
import org.kuali.student.common.ui.client.widgets.KSCheckBox; |
| 67 | |
import org.kuali.student.common.ui.client.widgets.KSDropDown; |
| 68 | |
import org.kuali.student.common.ui.client.widgets.KSLabel; |
| 69 | |
import org.kuali.student.common.ui.client.widgets.KSButtonAbstract.ButtonStyle; |
| 70 | |
import org.kuali.student.common.ui.client.widgets.buttongroups.ButtonEnumerations.YesNoCancelEnum; |
| 71 | |
import org.kuali.student.common.ui.client.widgets.dialog.ButtonMessageDialog; |
| 72 | |
import org.kuali.student.common.ui.client.widgets.field.layout.button.ButtonGroup; |
| 73 | |
import org.kuali.student.common.ui.client.widgets.field.layout.button.YesNoCancelGroup; |
| 74 | |
import org.kuali.student.common.ui.client.widgets.menus.KSMenuItemData; |
| 75 | |
import org.kuali.student.common.ui.client.widgets.notification.KSNotification; |
| 76 | |
import org.kuali.student.common.ui.client.widgets.notification.KSNotifier; |
| 77 | |
import org.kuali.student.common.ui.client.widgets.progress.BlockingTask; |
| 78 | |
import org.kuali.student.common.ui.client.widgets.progress.KSBlockingProgressIndicator; |
| 79 | |
import org.kuali.student.common.ui.client.widgets.search.KSPicker; |
| 80 | |
import org.kuali.student.common.ui.client.widgets.table.summary.SummaryTableSection; |
| 81 | |
import org.kuali.student.common.ui.shared.IdAttributes; |
| 82 | |
import org.kuali.student.common.ui.shared.IdAttributes.IdType; |
| 83 | |
import org.kuali.student.common.validation.dto.ValidationResultInfo; |
| 84 | |
import org.kuali.student.core.statement.dto.StatementTypeInfo; |
| 85 | |
import org.kuali.student.core.workflow.ui.client.widgets.WorkflowEnhancedNavController; |
| 86 | |
import org.kuali.student.core.workflow.ui.client.widgets.WorkflowUtilities; |
| 87 | |
import org.kuali.student.lum.common.client.helpers.RecentlyViewedHelper; |
| 88 | |
import org.kuali.student.lum.common.client.lu.LUUIConstants; |
| 89 | |
import org.kuali.student.lum.common.client.widgets.AppLocations; |
| 90 | |
import org.kuali.student.lum.lu.LUConstants; |
| 91 | |
import org.kuali.student.lum.lu.assembly.data.client.constants.orch.CreditCourseConstants; |
| 92 | |
import org.kuali.student.lum.lu.ui.course.client.configuration.CourseProposalConfigurer; |
| 93 | |
import org.kuali.student.lum.lu.ui.course.client.configuration.CourseProposalConfigurer.CourseSections; |
| 94 | |
import org.kuali.student.lum.lu.ui.course.client.requirements.CourseRequirementsDataModel; |
| 95 | |
import org.kuali.student.lum.lu.ui.course.client.requirements.HasRequirements; |
| 96 | |
import org.kuali.student.lum.lu.ui.course.client.service.CourseRpcService; |
| 97 | |
import org.kuali.student.lum.lu.ui.course.client.service.CourseRpcServiceAsync; |
| 98 | |
import org.kuali.student.lum.lu.ui.course.client.service.CreditCourseProposalRpcService; |
| 99 | |
import org.kuali.student.lum.lu.ui.course.client.service.CreditCourseProposalRpcServiceAsync; |
| 100 | |
|
| 101 | |
import com.google.gwt.core.client.GWT; |
| 102 | |
import com.google.gwt.event.dom.client.ClickEvent; |
| 103 | |
import com.google.gwt.event.dom.client.ClickHandler; |
| 104 | |
import com.google.gwt.event.logical.shared.ValueChangeEvent; |
| 105 | |
import com.google.gwt.event.logical.shared.ValueChangeHandler; |
| 106 | |
import com.google.gwt.user.client.Window; |
| 107 | |
import com.google.gwt.user.client.rpc.AsyncCallback; |
| 108 | |
|
| 109 | |
|
| 110 | |
|
| 111 | |
|
| 112 | |
|
| 113 | |
|
| 114 | |
|
| 115 | |
|
| 116 | |
|
| 117 | |
|
| 118 | |
|
| 119 | 0 | public class CourseProposalController extends MenuEditableSectionController implements RequiresAuthorization, WorkflowEnhancedNavController, HasRequirements { |
| 120 | |
|
| 121 | |
|
| 122 | 0 | protected CreditCourseProposalRpcServiceAsync cluProposalRpcServiceAsync = GWT.create(CreditCourseProposalRpcService.class); |
| 123 | 0 | protected CourseRpcServiceAsync courseServiceAsync = GWT.create(CourseRpcService.class); |
| 124 | |
|
| 125 | 0 | protected final DataModel cluProposalModel = new DataModel("Proposal"); |
| 126 | 0 | protected final DataModel comparisonModel = new DataModel("Original Course"); |
| 127 | |
|
| 128 | |
protected CourseProposalConfigurer cfg; |
| 129 | |
|
| 130 | |
private WorkQueue modelRequestQueue; |
| 131 | |
|
| 132 | |
protected WorkflowUtilities workflowUtil; |
| 133 | |
|
| 134 | 0 | private boolean initialized = false; |
| 135 | 0 | protected boolean isNew = false; |
| 136 | |
|
| 137 | |
private static final String UPDATED_KEY = "metaInfo/updateTime"; |
| 138 | |
private static final String VERSION_KEY = "versionInfo/versionedFromId"; |
| 139 | |
private static final String MSG_GROUP = "course"; |
| 140 | |
|
| 141 | 0 | protected String currentDocType = LUConstants.PROPOSAL_TYPE_COURSE_CREATE; |
| 142 | 0 | protected String proposalPath = ""; |
| 143 | |
protected String currentTitle; |
| 144 | |
|
| 145 | 0 | private final DateFormat df = DateFormat.getInstance(); |
| 146 | |
|
| 147 | 0 | private final BlockingTask initializingTask = new BlockingTask("Loading"); |
| 148 | 0 | protected final BlockingTask loadDataTask = new BlockingTask("Retrieving Data"); |
| 149 | 0 | private final BlockingTask saving = new BlockingTask("Saving"); |
| 150 | |
|
| 151 | |
protected CourseRequirementsDataModel reqDataModel; |
| 152 | |
protected CourseRequirementsDataModel reqDataModelComp; |
| 153 | |
|
| 154 | |
public CourseProposalController(){ |
| 155 | 0 | super(); |
| 156 | 0 | initializeController(); |
| 157 | 0 | } |
| 158 | |
|
| 159 | |
protected void initializeController() { |
| 160 | 0 | cfg = GWT.create(CourseProposalConfigurer.class); |
| 161 | 0 | proposalPath = cfg.getProposalPath(); |
| 162 | 0 | workflowUtil = new WorkflowUtilities(CourseProposalController.this, proposalPath, "Proposal Actions", |
| 163 | |
CourseProposalConfigurer.CourseSections.WF_APPROVE_DIALOG,"", cfg.getModelId()); |
| 164 | 0 | cfg.setState(DtoConstants.STATE_DRAFT); |
| 165 | |
|
| 166 | |
|
| 167 | 0 | workflowUtil.getAdditionalItems().add(new KSMenuItemData(this.getMessage("cluCopyItem"), new ClickHandler(){ |
| 168 | |
@Override |
| 169 | |
public void onClick(ClickEvent event) { |
| 170 | 0 | if(getViewContext() != null && getViewContext().getId() != null && !getViewContext().getId().isEmpty()){ |
| 171 | 0 | getViewContext().setId((String)cluProposalModel.get(cfg.getProposalPath()+"/id")); |
| 172 | 0 | getViewContext().setIdType(IdType.COPY_OF_KS_KEW_OBJECT_ID); |
| 173 | 0 | getViewContext().getAttributes().remove(StudentIdentityConstants.DOCUMENT_TYPE_NAME); |
| 174 | 0 | cluProposalModel.resetRoot(); |
| 175 | |
} |
| 176 | 0 | HistoryManager.navigate("/HOME/CURRICULUM_HOME/COURSE_PROPOSAL", getViewContext()); |
| 177 | 0 | } |
| 178 | |
})); |
| 179 | |
|
| 180 | 0 | super.setDefaultModelId(cfg.getModelId()); |
| 181 | 0 | registerModelsAndHandlers(); |
| 182 | |
|
| 183 | 0 | addStyleName("courseProposal"); |
| 184 | |
|
| 185 | 0 | setViewContext(getViewContext()); |
| 186 | 0 | } |
| 187 | |
|
| 188 | |
protected void registerModelsAndHandlers(){ |
| 189 | 0 | reqDataModel = new CourseRequirementsDataModel(this); |
| 190 | 0 | reqDataModelComp = new CourseRequirementsDataModel(this); |
| 191 | |
|
| 192 | 0 | super.registerModel(super.getDefaultModelId(), new ModelProvider<DataModel>() { |
| 193 | |
|
| 194 | |
@Override |
| 195 | |
public void requestModel(final ModelRequestCallback<DataModel> callback) { |
| 196 | 0 | if (modelRequestQueue == null){ |
| 197 | 0 | modelRequestQueue = new WorkQueue(); |
| 198 | |
} |
| 199 | |
|
| 200 | 0 | WorkItem workItem = new WorkItem(){ |
| 201 | |
@Override |
| 202 | |
public void exec(Callback<Boolean> workCompleteCallback) { |
| 203 | 0 | if (cluProposalModel.getRoot() == null || initialized == false){ |
| 204 | 0 | populateModel(callback, workCompleteCallback); |
| 205 | |
} else { |
| 206 | 0 | callback.onModelReady(cluProposalModel); |
| 207 | 0 | workCompleteCallback.exec(true); |
| 208 | |
} |
| 209 | 0 | } |
| 210 | |
}; |
| 211 | 0 | modelRequestQueue.submit(workItem); |
| 212 | |
|
| 213 | 0 | } |
| 214 | |
|
| 215 | |
}); |
| 216 | 0 | super.registerModel("ComparisonModel", new ModelProvider<DataModel>() { |
| 217 | |
@Override |
| 218 | |
public void requestModel(final ModelRequestCallback<DataModel> callback) { |
| 219 | 0 | if(comparisonModel.getRoot() != null && comparisonModel.getRoot().size() != 0){ |
| 220 | 0 | callback.onModelReady(comparisonModel); |
| 221 | |
|
| 222 | |
} |
| 223 | |
else{ |
| 224 | 0 | callback.onModelReady(null); |
| 225 | |
} |
| 226 | |
|
| 227 | 0 | } |
| 228 | |
}); |
| 229 | 0 | super.addApplicationEventHandler(ContentDirtyEvent.TYPE, new ContentDirtyEventHandler(){ |
| 230 | |
public void onContentDirty(ContentDirtyEvent event) { |
| 231 | 0 | setContentWarning("You have unsaved changes"); |
| 232 | 0 | } |
| 233 | |
}); |
| 234 | |
|
| 235 | 0 | super.addApplicationEventHandler(SaveActionEvent.TYPE, new SaveActionHandler(){ |
| 236 | |
public void doSave(SaveActionEvent saveAction) { |
| 237 | 0 | GWT.log("CluProposalController received save action request.", null); |
| 238 | 0 | doSaveAction(saveAction); |
| 239 | 0 | } |
| 240 | |
}); |
| 241 | 0 | } |
| 242 | |
|
| 243 | |
|
| 244 | |
|
| 245 | |
|
| 246 | |
|
| 247 | |
|
| 248 | |
|
| 249 | |
private void populateModel(final ModelRequestCallback<DataModel> callback, Callback<Boolean> workCompleteCallback){ |
| 250 | 0 | if(getViewContext().getIdType() == IdType.DOCUMENT_ID){ |
| 251 | 0 | getCluProposalFromWorkflowId(callback, workCompleteCallback); |
| 252 | 0 | } else if (getViewContext().getIdType() == IdType.KS_KEW_OBJECT_ID || getViewContext().getIdType() == IdType.OBJECT_ID){ |
| 253 | 0 | getCluProposalFromProposalId(getViewContext().getId(), callback, workCompleteCallback); |
| 254 | 0 | } else if (getViewContext().getIdType() == IdType.COPY_OF_OBJECT_ID){ |
| 255 | 0 | if(LUConstants.PROPOSAL_TYPE_COURSE_MODIFY.equals(getViewContext().getAttribute(StudentIdentityConstants.DOCUMENT_TYPE_NAME))|| |
| 256 | |
LUConstants.PROPOSAL_TYPE_COURSE_MODIFY_ADMIN.equals(getViewContext().getAttribute(StudentIdentityConstants.DOCUMENT_TYPE_NAME))){ |
| 257 | 0 | createModifyCluProposalModel("versionComment", callback, workCompleteCallback); |
| 258 | |
}else{ |
| 259 | 0 | createCopyCourseModel(getViewContext().getId(), callback, workCompleteCallback); |
| 260 | |
} |
| 261 | 0 | } else if (getViewContext().getIdType() == IdType.COPY_OF_KS_KEW_OBJECT_ID){ |
| 262 | 0 | createCopyCourseProposalModel(getViewContext().getId(), callback, workCompleteCallback); |
| 263 | |
} else{ |
| 264 | 0 | createNewCluProposalModel(callback, workCompleteCallback); |
| 265 | |
} |
| 266 | 0 | } |
| 267 | |
|
| 268 | |
protected void getCurrentModel(final ModelRequestCallback<DataModel> callback, Callback<Boolean> workCompleteCallback){ |
| 269 | 0 | if (cluProposalModel.getRoot() != null && cluProposalModel.getRoot().size() > 0){ |
| 270 | 0 | String id = cluProposalModel.get(cfg.getProposalPath()+"/id"); |
| 271 | 0 | if(id != null){ |
| 272 | 0 | getCluProposalFromProposalId(id, callback, workCompleteCallback); |
| 273 | |
} |
| 274 | |
else{ |
| 275 | 0 | populateModel(callback, workCompleteCallback); |
| 276 | |
} |
| 277 | 0 | } |
| 278 | |
else{ |
| 279 | 0 | populateModel(callback, workCompleteCallback); |
| 280 | |
} |
| 281 | 0 | } |
| 282 | |
|
| 283 | |
private void intializeView(final Callback<Boolean> onReadyCallback) { |
| 284 | 0 | if (initialized) { |
| 285 | 0 | onReadyCallback.exec(true); |
| 286 | |
} else { |
| 287 | 0 | initialized = true; |
| 288 | 0 | KSBlockingProgressIndicator.addTask(initializingTask); |
| 289 | 0 | setContentWarning(""); |
| 290 | 0 | this.requestModel(new ModelRequestCallback<DataModel>(){ |
| 291 | |
|
| 292 | |
@Override |
| 293 | |
public void onModelReady(DataModel model) { |
| 294 | |
|
| 295 | |
|
| 296 | 0 | String idType = null; |
| 297 | 0 | String viewContextId = ""; |
| 298 | 0 | if(getViewContext().getIdType() != null){ |
| 299 | 0 | idType = getViewContext().getIdType().toString(); |
| 300 | 0 | viewContextId = getViewContext().getId(); |
| 301 | 0 | if(getViewContext().getIdType()==IdAttributes.IdType.COPY_OF_OBJECT_ID){ |
| 302 | 0 | viewContextId = null; |
| 303 | |
} |
| 304 | |
|
| 305 | |
} |
| 306 | |
|
| 307 | |
|
| 308 | 0 | if(cluProposalModel.get(VERSION_KEY) != null && !((String)cluProposalModel.get(VERSION_KEY)).equals("") && !LUConstants.PROPOSAL_TYPE_COURSE_MODIFY_ADMIN.equals(currentDocType)){ |
| 309 | 0 | currentDocType = LUConstants.PROPOSAL_TYPE_COURSE_MODIFY; |
| 310 | |
} |
| 311 | |
|
| 312 | 0 | if(LUConstants.PROPOSAL_TYPE_COURSE_MODIFY_ADMIN.equals(cluProposalModel.get(cfg.getProposalPath()+"/type"))){ |
| 313 | 0 | currentDocType = LUConstants.PROPOSAL_TYPE_COURSE_MODIFY_ADMIN; |
| 314 | |
} |
| 315 | |
|
| 316 | |
|
| 317 | 0 | String dtoState = getStateforSaveAction(cluProposalModel); |
| 318 | |
|
| 319 | |
|
| 320 | 0 | String workflowNode = cluProposalModel.get(cfg.getProposalPath()+"/workflowNode"); |
| 321 | |
|
| 322 | |
|
| 323 | 0 | HashMap<String, String> idAttributes = new HashMap<String, String>(); |
| 324 | 0 | if(idType != null){ |
| 325 | 0 | idAttributes.put(IdAttributes.ID_TYPE, idType); |
| 326 | |
} |
| 327 | 0 | idAttributes.put(StudentIdentityConstants.DOCUMENT_TYPE_NAME, currentDocType); |
| 328 | 0 | idAttributes.put(DtoConstants.DTO_STATE, dtoState); |
| 329 | 0 | idAttributes.put(DtoConstants.DTO_NEXT_STATE, cfg.getNextState()); |
| 330 | 0 | if (LUConstants.PROPOSAL_TYPE_COURSE_MODIFY.equalsIgnoreCase(currentDocType) || |
| 331 | |
LUConstants.PROPOSAL_TYPE_COURSE_CREATE.equals(currentDocType)){ |
| 332 | 0 | idAttributes.put(DtoConstants.DTO_WORKFLOW_NODE, workflowNode); |
| 333 | |
} |
| 334 | |
|
| 335 | |
|
| 336 | |
|
| 337 | 0 | getCourseProposalRpcService().getMetadata(viewContextId, idAttributes, new KSAsyncCallback<Metadata>(){ |
| 338 | |
@Override |
| 339 | |
public void handleTimeout(Throwable caught) { |
| 340 | 0 | initializeFailed(); |
| 341 | 0 | } |
| 342 | |
|
| 343 | |
@Override |
| 344 | |
public void handleFailure(Throwable caught) { |
| 345 | 0 | initializeFailed(); |
| 346 | 0 | throw new RuntimeException("Failed to get model definition.", caught); |
| 347 | |
} |
| 348 | |
|
| 349 | |
public void initializeFailed(){ |
| 350 | 0 | initialized = false; |
| 351 | 0 | onReadyCallback.exec(false); |
| 352 | 0 | KSBlockingProgressIndicator.removeTask(initializingTask); |
| 353 | 0 | } |
| 354 | |
|
| 355 | |
public void onSuccess(Metadata result) { |
| 356 | 0 | DataModelDefinition def = new DataModelDefinition(result); |
| 357 | 0 | cluProposalModel.setDefinition(def); |
| 358 | 0 | comparisonModel.setDefinition(def); |
| 359 | |
|
| 360 | 0 | configureScreens(def, onReadyCallback); |
| 361 | |
|
| 362 | 0 | } |
| 363 | |
}); |
| 364 | |
|
| 365 | 0 | } |
| 366 | |
|
| 367 | |
@Override |
| 368 | |
public void onRequestFail(Throwable cause) { |
| 369 | 0 | GWT.log("Failed to get modeld for proposal controller init"); |
| 370 | 0 | onReadyCallback.exec(false); |
| 371 | 0 | } |
| 372 | |
}); |
| 373 | |
|
| 374 | |
} |
| 375 | 0 | } |
| 376 | |
|
| 377 | |
@Override |
| 378 | |
public void getMetadataForFinalState(final KSAsyncCallback<Metadata> callback){ |
| 379 | |
|
| 380 | 0 | String idType = null; |
| 381 | 0 | String viewContextId = ""; |
| 382 | 0 | if(getViewContext().getIdType() != null){ |
| 383 | 0 | idType = getViewContext().getIdType().toString(); |
| 384 | 0 | viewContextId = getViewContext().getId(); |
| 385 | 0 | if(getViewContext().getIdType()==IdAttributes.IdType.COPY_OF_OBJECT_ID){ |
| 386 | 0 | viewContextId = null; |
| 387 | |
} |
| 388 | |
} |
| 389 | 0 | HashMap<String, String> idAttributes = new HashMap<String, String>(); |
| 390 | 0 | if(idType != null){ |
| 391 | 0 | idAttributes.put(IdAttributes.ID_TYPE, idType); |
| 392 | |
} |
| 393 | |
|
| 394 | 0 | idAttributes.put(StudentIdentityConstants.DOCUMENT_TYPE_NAME, currentDocType); |
| 395 | 0 | idAttributes.put(DtoConstants.DTO_STATE, cfg.getState()); |
| 396 | 0 | idAttributes.put(DtoConstants.DTO_NEXT_STATE, cfg.getNextState()); |
| 397 | 0 | idAttributes.put(DtoConstants.DTO_WORKFLOW_NODE, "Publication Review"); |
| 398 | |
|
| 399 | |
|
| 400 | 0 | getCourseProposalRpcService().getMetadata(viewContextId, idAttributes, new KSAsyncCallback<Metadata>(){ |
| 401 | |
@Override |
| 402 | |
public void onSuccess(Metadata result) { |
| 403 | 0 | callback.onSuccess(result); |
| 404 | 0 | } |
| 405 | |
}); |
| 406 | 0 | } |
| 407 | |
|
| 408 | |
protected void configureScreens(final DataModelDefinition modelDefinition, final Callback<Boolean> onReadyCallback){ |
| 409 | 0 | if (workflowUtil != null){ |
| 410 | 0 | workflowUtil.requestAndSetupModel(NO_OP_CALLBACK); |
| 411 | |
} |
| 412 | |
|
| 413 | 0 | CourseRequirementsDataModel.getStatementTypes(new Callback<List<StatementTypeInfo>>() { |
| 414 | |
|
| 415 | |
@Override |
| 416 | |
public void exec(List<StatementTypeInfo> stmtTypes) { |
| 417 | 0 | List<StatementTypeInfo> stmtTypesOut = new ArrayList<StatementTypeInfo>(); |
| 418 | 0 | if (stmtTypes != null) { |
| 419 | 0 | for (StatementTypeInfo stmtType : stmtTypes) { |
| 420 | 0 | if (stmtType.getId().contains("kuali.statement.type.course.enrollmentEligibility") || |
| 421 | |
stmtType.getId().contains("kuali.statement.type.course.creditConstraints")) { |
| 422 | 0 | continue; |
| 423 | |
} |
| 424 | 0 | stmtTypesOut.add(stmtType); |
| 425 | |
} |
| 426 | |
} |
| 427 | |
|
| 428 | 0 | cfg.setStatementTypes(stmtTypesOut); |
| 429 | 0 | cfg.setModelDefinition(modelDefinition); |
| 430 | 0 | cfg.configure(CourseProposalController.this); |
| 431 | |
|
| 432 | |
|
| 433 | 0 | if(workflowUtil!=null){ |
| 434 | 0 | requestModel(new ModelRequestCallback<DataModel>(){ |
| 435 | |
public void onModelReady(DataModel model) { |
| 436 | |
|
| 437 | 0 | String versionedFromId = model.get("versionInfo/versionedFromId"); |
| 438 | 0 | if(versionedFromId!=null && !versionedFromId.isEmpty()){ |
| 439 | 0 | KSLabel descLabel = new KSLabel(); |
| 440 | 0 | descLabel.setText(Application.getApplicationContext().getUILabel("course", LUUIConstants.FINAL_APPROVAL_DIALOG)); |
| 441 | 0 | if (workflowUtil.getApproveDialogue() != null) { |
| 442 | 0 | workflowUtil.getApproveDialogue().addWidget(descLabel); |
| 443 | |
} |
| 444 | 0 | workflowUtil.addApproveDialogField("", "startTerm", cfg.generateMessageInfo(LUUIConstants.PROPOSAL_START_TERM), modelDefinition, true, true); |
| 445 | 0 | workflowUtil.addApproveDialogField("proposal", "prevEndTerm", cfg.generateMessageInfo(LUUIConstants.PROPOSAL_PREV_END_TERM), modelDefinition, false); |
| 446 | |
|
| 447 | 0 | workflowUtil.updateApproveFields(); |
| 448 | 0 | workflowUtil.progressiveEnableFields(); |
| 449 | 0 | }else{ |
| 450 | |
|
| 451 | 0 | workflowUtil.addIgnoreDialogField("proposal/prevEndTerm"); |
| 452 | |
} |
| 453 | 0 | } |
| 454 | |
public void onRequestFail(Throwable cause) { |
| 455 | 0 | } |
| 456 | |
}); |
| 457 | |
} |
| 458 | |
|
| 459 | 0 | progressiveEnableFields(); |
| 460 | |
|
| 461 | 0 | onReadyCallback.exec(true); |
| 462 | 0 | KSBlockingProgressIndicator.removeTask(initializingTask); |
| 463 | 0 | } |
| 464 | |
}); |
| 465 | 0 | } |
| 466 | |
|
| 467 | |
|
| 468 | |
|
| 469 | |
|
| 470 | |
|
| 471 | |
|
| 472 | |
protected void progressiveEnableFields(){ |
| 473 | 0 | final FieldDescriptor endTerm = Application.getApplicationContext().getPathToFieldMapping(null,CreditCourseConstants.END_TERM); |
| 474 | 0 | final FieldDescriptor pilotCourse = Application.getApplicationContext().getPathToFieldMapping(null,CreditCourseConstants.PILOT_COURSE); |
| 475 | |
|
| 476 | 0 | if (pilotCourse != null && endTerm != null){ |
| 477 | |
|
| 478 | 0 | Boolean enableEndTerm = Boolean.TRUE.equals(cluProposalModel.get(CreditCourseConstants.PILOT_COURSE)) |
| 479 | |
|| DtoConstants.STATE_RETIRED.equalsIgnoreCase((String)cluProposalModel.get(CreditCourseConstants.STATE)); |
| 480 | |
|
| 481 | 0 | BaseSection.progressiveEnableAndRequireFields(enableEndTerm, endTerm); |
| 482 | |
|
| 483 | |
|
| 484 | 0 | KSCheckBox pilotCheckbox = ((KSCheckBox)pilotCourse.getFieldWidget()); |
| 485 | 0 | pilotCheckbox.addValueChangeHandler(new ValueChangeHandler<Boolean>() { |
| 486 | |
@Override |
| 487 | |
public void onValueChange(ValueChangeEvent<Boolean> event) { |
| 488 | |
|
| 489 | 0 | BaseSection.progressiveEnableAndRequireFields(event.getValue(), endTerm); |
| 490 | |
|
| 491 | |
|
| 492 | 0 | if (!event.getValue()){ |
| 493 | 0 | ((KSDropDown)((KSPicker)endTerm.getFieldWidget()).getInputWidget()).clear(); |
| 494 | |
} |
| 495 | 0 | } |
| 496 | |
}); |
| 497 | |
} |
| 498 | 0 | } |
| 499 | |
|
| 500 | |
@Override |
| 501 | |
@SuppressWarnings("unchecked") |
| 502 | |
public void requestModel(Class modelType, final ModelRequestCallback callback) { |
| 503 | 0 | if(modelType == ReferenceModel.class){ |
| 504 | 0 | if (cluProposalModel != null){ |
| 505 | 0 | ReferenceModel ref = new ReferenceModel(); |
| 506 | |
|
| 507 | 0 | if(cluProposalModel.get(cfg.getProposalPath()) != null){ |
| 508 | 0 | ref.setReferenceId((String)cluProposalModel.get(cfg.getProposalPath()+"/id")); |
| 509 | |
} else { |
| 510 | 0 | ref.setReferenceId(null); |
| 511 | |
} |
| 512 | |
|
| 513 | |
|
| 514 | 0 | if(cluProposalModel.get(cfg.getProposalPath()) != null){ |
| 515 | 0 | Map<String, String> attributes = new HashMap<String, String>(); |
| 516 | 0 | attributes.put("name", (String)cluProposalModel.get(cfg.getProposalPath()+"/name")); |
| 517 | 0 | ref.setReferenceAttributes(attributes); |
| 518 | 0 | } else { |
| 519 | 0 | ref.setReferenceAttributes(null); |
| 520 | |
} |
| 521 | |
|
| 522 | 0 | ref.setReferenceTypeKey(cfg.getProposalReferenceTypeKey()); |
| 523 | 0 | ref.setReferenceType(cfg.getProposalReferenceObjectType()); |
| 524 | 0 | ref.setReferenceState(getViewContext().getState()); |
| 525 | |
|
| 526 | 0 | callback.onModelReady(ref); |
| 527 | 0 | } |
| 528 | 0 | } else if (modelType == Data.class){ |
| 529 | 0 | requestModel(cfg.getModelId(), callback); |
| 530 | |
} else { |
| 531 | 0 | super.requestModel(modelType, callback); |
| 532 | |
} |
| 533 | |
|
| 534 | 0 | } |
| 535 | |
|
| 536 | |
private void getCluProposalFromWorkflowId(@SuppressWarnings("rawtypes") final ModelRequestCallback callback, final Callback<Boolean> workCompleteCallback){ |
| 537 | 0 | KSBlockingProgressIndicator.addTask(loadDataTask); |
| 538 | 0 | workflowUtil.getDataIdFromWorkflowId(getViewContext().getId(), new KSAsyncCallback<String>(){ |
| 539 | |
@Override |
| 540 | |
public void handleFailure(Throwable caught) { |
| 541 | 0 | Window.alert("Error loading Proposal from Workflow Document: "+caught.getMessage()); |
| 542 | 0 | createNewCluProposalModel(callback, workCompleteCallback); |
| 543 | 0 | KSBlockingProgressIndicator.removeTask(loadDataTask); |
| 544 | 0 | } |
| 545 | |
|
| 546 | |
@Override |
| 547 | |
public void onSuccess(String proposalId) { |
| 548 | 0 | KSBlockingProgressIndicator.removeTask(loadDataTask); |
| 549 | 0 | getCluProposalFromProposalId(proposalId, callback, workCompleteCallback); |
| 550 | 0 | } |
| 551 | |
}); |
| 552 | 0 | } |
| 553 | |
|
| 554 | |
protected void getCluProposalFromProposalId(String id, @SuppressWarnings("rawtypes") final ModelRequestCallback callback, final Callback<Boolean> workCompleteCallback){ |
| 555 | 0 | KSBlockingProgressIndicator.addTask(loadDataTask); |
| 556 | 0 | getCourseProposalRpcService().getData(id, new KSAsyncCallback<Data>(){ |
| 557 | |
|
| 558 | |
@Override |
| 559 | |
public void handleFailure(Throwable caught) { |
| 560 | 0 | Window.alert("Error loading Proposal: "+caught.getMessage()); |
| 561 | 0 | createNewCluProposalModel(callback, workCompleteCallback); |
| 562 | 0 | KSBlockingProgressIndicator.removeTask(loadDataTask); |
| 563 | 0 | } |
| 564 | |
|
| 565 | |
@Override |
| 566 | |
public void onSuccess(Data result) { |
| 567 | 0 | cluProposalModel.setRoot(result); |
| 568 | 0 | setHeaderTitle(); |
| 569 | 0 | setLastUpdated(); |
| 570 | 0 | reqDataModel.retrieveStatementTypes(cluProposalModel.<String>get("id"), new Callback<Boolean>() { |
| 571 | |
@Override |
| 572 | |
public void exec(Boolean result) { |
| 573 | 0 | if(result){ |
| 574 | 0 | getCourseComparisonModelAndReqs(callback, workCompleteCallback); |
| 575 | |
} |
| 576 | 0 | } |
| 577 | |
}); |
| 578 | 0 | } |
| 579 | |
|
| 580 | |
}); |
| 581 | 0 | } |
| 582 | |
|
| 583 | |
@SuppressWarnings("unchecked") |
| 584 | |
protected void getCourseComparisonModelAndReqs(final ModelRequestCallback proposalModelRequestCallback, final Callback<Boolean> workCompleteCallback){ |
| 585 | 0 | if(cluProposalModel.get(VERSION_KEY) != null && !((String)cluProposalModel.get(VERSION_KEY)).equals("")){ |
| 586 | 0 | courseServiceAsync.getData((String)cluProposalModel.get(VERSION_KEY), new KSAsyncCallback<Data>(){ |
| 587 | |
|
| 588 | |
@Override |
| 589 | |
public void handleFailure(Throwable caught) { |
| 590 | 0 | Window.alert("Error loading Proposal: "+caught.getMessage()); |
| 591 | 0 | createNewCluProposalModel(proposalModelRequestCallback, workCompleteCallback); |
| 592 | 0 | KSBlockingProgressIndicator.removeTask(loadDataTask); |
| 593 | 0 | } |
| 594 | |
|
| 595 | |
@Override |
| 596 | |
public void onSuccess(Data result) { |
| 597 | |
|
| 598 | 0 | if (result != null) |
| 599 | 0 | comparisonModel.setRoot(result); |
| 600 | |
|
| 601 | 0 | reqDataModel.retrieveStatementTypes(cluProposalModel.<String>get("id"), new Callback<Boolean>() { |
| 602 | |
@Override |
| 603 | |
public void exec(Boolean result) { |
| 604 | 0 | if (result) { |
| 605 | 0 | KSBlockingProgressIndicator.removeTask(loadDataTask); |
| 606 | 0 | reqDataModelComp.retrieveStatementTypes(comparisonModel.<String>get("id"), new Callback<Boolean>() { |
| 607 | |
@Override |
| 608 | |
public void exec(Boolean result) { |
| 609 | 0 | if (result) { |
| 610 | 0 | KSBlockingProgressIndicator.removeTask(loadDataTask); |
| 611 | |
} |
| 612 | 0 | } |
| 613 | |
}); |
| 614 | 0 | proposalModelRequestCallback.onModelReady(cluProposalModel); |
| 615 | 0 | workCompleteCallback.exec(true); |
| 616 | |
} |
| 617 | 0 | } |
| 618 | |
}); |
| 619 | 0 | } |
| 620 | |
}); |
| 621 | |
} else { |
| 622 | 0 | proposalModelRequestCallback.onModelReady(cluProposalModel); |
| 623 | 0 | workCompleteCallback.exec(true); |
| 624 | 0 | KSBlockingProgressIndicator.removeTask(loadDataTask); |
| 625 | |
} |
| 626 | 0 | } |
| 627 | |
|
| 628 | |
@SuppressWarnings("unchecked") |
| 629 | |
protected void createNewCluProposalModel(final ModelRequestCallback callback, final Callback<Boolean> workCompleteCallback){ |
| 630 | 0 | Data data = new Data(); |
| 631 | 0 | cluProposalModel.setRoot(data); |
| 632 | |
|
| 633 | 0 | Data proposalData = new Data(); |
| 634 | 0 | proposalData.set(new Data.StringKey("type"), currentDocType); |
| 635 | 0 | data.set(new Data.StringKey("proposal"), proposalData); |
| 636 | 0 | if (cfg.getNextState() == null || cfg.getNextState().isEmpty()){ |
| 637 | 0 | proposalData.set(new Data.StringKey("workflowNode"), "PreRoute"); |
| 638 | |
} |
| 639 | |
|
| 640 | 0 | isNew = true; |
| 641 | 0 | setHeaderTitle(); |
| 642 | 0 | setLastUpdated(); |
| 643 | 0 | callback.onModelReady(cluProposalModel); |
| 644 | 0 | workCompleteCallback.exec(true); |
| 645 | 0 | } |
| 646 | |
|
| 647 | |
private void createModifyCluProposalModel(String versionComment, final ModelRequestCallback callback, final Callback<Boolean> workCompleteCallback){ |
| 648 | 0 | Data data = new Data(); |
| 649 | 0 | cluProposalModel.setRoot(data); |
| 650 | |
|
| 651 | 0 | this.currentDocType = getViewContext().getAttribute(StudentIdentityConstants.DOCUMENT_TYPE_NAME); |
| 652 | 0 | Data proposalData = new Data(); |
| 653 | 0 | proposalData.set(new Data.StringKey("type"), currentDocType); |
| 654 | 0 | data.set(new Data.StringKey("proposal"), proposalData); |
| 655 | 0 | if (cfg.getNextState() == null && cfg.getNextState().isEmpty()){ |
| 656 | 0 | proposalData.set(new Data.StringKey("workflowNode"), "PreRoute"); |
| 657 | |
} |
| 658 | |
|
| 659 | 0 | Data versionData = new Data(); |
| 660 | 0 | versionData.set(new Data.StringKey("versionIndId"), getViewContext().getId()); |
| 661 | 0 | versionData.set(new Data.StringKey("versionComment"), versionComment); |
| 662 | 0 | data.set(new Data.StringKey("versionInfo"), versionData); |
| 663 | |
|
| 664 | 0 | cluProposalRpcServiceAsync.saveData(cluProposalModel.getRoot(), new AsyncCallback<DataSaveResult>() { |
| 665 | |
public void onSuccess(DataSaveResult result) { |
| 666 | 0 | cluProposalModel.setRoot(result.getValue()); |
| 667 | 0 | setHeaderTitle(); |
| 668 | 0 | setLastUpdated(); |
| 669 | |
|
| 670 | 0 | ViewContext docContext = new ViewContext(); |
| 671 | 0 | docContext.setId((String) cluProposalModel.get(cfg.getProposalPath()+"/id")); |
| 672 | 0 | docContext.setIdType(IdType.KS_KEW_OBJECT_ID); |
| 673 | |
|
| 674 | |
|
| 675 | |
|
| 676 | 0 | getCourseComparisonModelAndReqs(callback, workCompleteCallback); |
| 677 | |
|
| 678 | |
|
| 679 | |
|
| 680 | 0 | getViewContext().setIdType(docContext.getIdType()); |
| 681 | 0 | getViewContext().setId(docContext.getId()); |
| 682 | |
|
| 683 | 0 | } |
| 684 | |
|
| 685 | |
public void onFailure(Throwable caught) { |
| 686 | 0 | Window.alert("Error loading Proposal: "+caught.getMessage()); |
| 687 | 0 | createNewCluProposalModel(callback, workCompleteCallback); |
| 688 | 0 | KSBlockingProgressIndicator.removeTask(loadDataTask); |
| 689 | 0 | } |
| 690 | |
}); |
| 691 | 0 | } |
| 692 | |
|
| 693 | |
@SuppressWarnings("unchecked") |
| 694 | |
private void createCopyCourseModel(String originalCluId, final ModelRequestCallback callback, final Callback<Boolean> workCompleteCallback){ |
| 695 | |
|
| 696 | 0 | cluProposalRpcServiceAsync.createCopyCourse(originalCluId, new AsyncCallback<DataSaveResult>() { |
| 697 | |
public void onSuccess(DataSaveResult result) { |
| 698 | 0 | cluProposalModel.setRoot(result.getValue()); |
| 699 | |
|
| 700 | |
|
| 701 | 0 | Data proposalData = new Data(); |
| 702 | 0 | cluProposalModel.getRoot().set(new Data.StringKey("proposal"), proposalData); |
| 703 | 0 | if (cfg.getNextState() == null || cfg.getNextState().isEmpty()){ |
| 704 | 0 | proposalData.set(new Data.StringKey("workflowNode"), "PreRoute"); |
| 705 | |
} |
| 706 | |
|
| 707 | 0 | isNew = true; |
| 708 | 0 | setHeaderTitle(); |
| 709 | 0 | setLastUpdated(); |
| 710 | |
|
| 711 | 0 | callback.onModelReady(cluProposalModel); |
| 712 | 0 | workCompleteCallback.exec(true); |
| 713 | 0 | } |
| 714 | |
|
| 715 | |
public void onFailure(Throwable caught) { |
| 716 | 0 | Window.alert("Error loading Proposal: "+caught.getMessage()); |
| 717 | 0 | createNewCluProposalModel(callback, workCompleteCallback); |
| 718 | 0 | KSBlockingProgressIndicator.removeTask(loadDataTask); |
| 719 | 0 | } |
| 720 | |
}); |
| 721 | 0 | } |
| 722 | |
|
| 723 | |
@SuppressWarnings("unchecked") |
| 724 | |
private void createCopyCourseProposalModel(String originalProposalId, final ModelRequestCallback callback, final Callback<Boolean> workCompleteCallback){ |
| 725 | |
|
| 726 | 0 | cluProposalRpcServiceAsync.createCopyCourseProposal(originalProposalId, new AsyncCallback<DataSaveResult>() { |
| 727 | |
public void onSuccess(DataSaveResult result) { |
| 728 | 0 | cluProposalModel.setRoot(result.getValue()); |
| 729 | 0 | setHeaderTitle(); |
| 730 | 0 | setLastUpdated(); |
| 731 | |
|
| 732 | 0 | ViewContext docContext = new ViewContext(); |
| 733 | 0 | docContext.setId((String) cluProposalModel.get(cfg.getProposalPath()+"/id")); |
| 734 | 0 | docContext.setIdType(IdType.KS_KEW_OBJECT_ID); |
| 735 | 0 | RecentlyViewedHelper.addDocument(getProposalTitle(), |
| 736 | |
HistoryManager.appendContext(AppLocations.Locations.COURSE_PROPOSAL.getLocation(), docContext) |
| 737 | |
+ "/COURSE_INFO"); |
| 738 | |
|
| 739 | |
|
| 740 | |
|
| 741 | 0 | getViewContext().setIdType(docContext.getIdType()); |
| 742 | 0 | getViewContext().setId(docContext.getId()); |
| 743 | |
|
| 744 | 0 | callback.onModelReady(cluProposalModel); |
| 745 | 0 | workCompleteCallback.exec(true); |
| 746 | 0 | } |
| 747 | |
|
| 748 | |
public void onFailure(Throwable caught) { |
| 749 | 0 | Window.alert("Error loading Proposal: "+caught.getMessage()); |
| 750 | 0 | createNewCluProposalModel(callback, workCompleteCallback); |
| 751 | 0 | KSBlockingProgressIndicator.removeTask(loadDataTask); |
| 752 | 0 | } |
| 753 | |
}); |
| 754 | 0 | } |
| 755 | |
|
| 756 | |
public void doSaveAction(final SaveActionEvent saveActionEvent){ |
| 757 | 0 | requestModel(new ModelRequestCallback<DataModel>() { |
| 758 | |
@Override |
| 759 | |
public void onModelReady(DataModel model) { |
| 760 | 0 | CourseProposalController.this.updateModelFromCurrentView(); |
| 761 | |
|
| 762 | 0 | if (isStartViewShowing()){ |
| 763 | |
|
| 764 | |
|
| 765 | 0 | getStartPopupView().updateModel(); |
| 766 | |
} |
| 767 | |
|
| 768 | 0 | model.validate(new Callback<List<ValidationResultInfo>>() { |
| 769 | |
@Override |
| 770 | |
public void exec(List<ValidationResultInfo> result) { |
| 771 | |
|
| 772 | 0 | boolean isSectionValid = isValid(result, true); |
| 773 | |
|
| 774 | 0 | if(isSectionValid){ |
| 775 | 0 | if (startSectionRequired()){ |
| 776 | 0 | showStartPopup(NO_OP_CALLBACK); |
| 777 | 0 | saveActionEvent.doActionComplete(); |
| 778 | |
} |
| 779 | |
else{ |
| 780 | 0 | saveProposalClu(saveActionEvent); |
| 781 | |
} |
| 782 | |
} |
| 783 | |
else{ |
| 784 | |
|
| 785 | 0 | KSNotifier.add(new KSNotification("Unable to save, please check fields for errors.", false, true, 5000)); |
| 786 | |
} |
| 787 | |
|
| 788 | 0 | } |
| 789 | |
}); |
| 790 | 0 | } |
| 791 | |
|
| 792 | |
@Override |
| 793 | |
public void onRequestFail(Throwable cause) { |
| 794 | 0 | saveActionEvent.doActionComplete(); |
| 795 | 0 | GWT.log("Unable to retrieve model for validation and save", cause); |
| 796 | 0 | } |
| 797 | |
|
| 798 | |
}); |
| 799 | |
|
| 800 | 0 | } |
| 801 | |
|
| 802 | |
public boolean startSectionRequired(){ |
| 803 | 0 | String proposalId = cluProposalModel.get(cfg.getProposalPath()+"/id"); |
| 804 | |
|
| 805 | |
|
| 806 | |
|
| 807 | 0 | String proposalTitle = cluProposalModel.get(cfg.getProposalTitlePath()); |
| 808 | 0 | String courseTitle = cluProposalModel.get(cfg.getCourseTitlePath()); |
| 809 | 0 | if (proposalTitle == null || proposalTitle.isEmpty()){ |
| 810 | 0 | cluProposalModel.set(QueryPath.parse(cfg.getProposalTitlePath()), courseTitle); |
| 811 | |
} |
| 812 | |
|
| 813 | 0 | return proposalId==null && !CourseProposalController.this.isStartViewShowing() && !hasTitles(proposalTitle, courseTitle); |
| 814 | |
} |
| 815 | |
|
| 816 | |
private boolean hasTitles(String proposalTitle, String courseTitle){ |
| 817 | 0 | return (proposalTitle != null && !proposalTitle.isEmpty()) && (courseTitle != null && !courseTitle.isEmpty()); |
| 818 | |
} |
| 819 | |
|
| 820 | |
public void saveProposalClu(final SaveActionEvent saveActionEvent){ |
| 821 | 0 | KSBlockingProgressIndicator.addTask(saving); |
| 822 | 0 | getCourseProposalRpcService().saveData(cluProposalModel.getRoot(), new KSAsyncCallback<DataSaveResult>(){ |
| 823 | |
|
| 824 | |
@Override |
| 825 | |
public void handleFailure(Throwable caught) { |
| 826 | 0 | GWT.log("Save Failed.", caught); |
| 827 | 0 | KSBlockingProgressIndicator.removeTask(saving); |
| 828 | 0 | KSNotifier.add(new KSNotification("Save Failed on server. Please try again.", false, true, 5000)); |
| 829 | 0 | } |
| 830 | |
|
| 831 | |
@Override |
| 832 | |
public void handleVersionMismatch(Throwable caught) { |
| 833 | 0 | super.handleVersionMismatch(caught); |
| 834 | 0 | KSBlockingProgressIndicator.removeTask(saving); |
| 835 | 0 | } |
| 836 | |
|
| 837 | |
public void onSuccess(DataSaveResult result) { |
| 838 | 0 | KSBlockingProgressIndicator.removeTask(saving); |
| 839 | |
|
| 840 | 0 | Application.getApplicationContext().clearValidationWarnings(); |
| 841 | 0 | Application.getApplicationContext().addValidationWarnings(result.getValidationResults()); |
| 842 | |
|
| 843 | 0 | if(ValidatorClientUtils.hasErrors(result.getValidationResults())){ |
| 844 | 0 | isValid(result.getValidationResults(), false, true); |
| 845 | 0 | saveActionEvent.setGotoNextView(false); |
| 846 | 0 | saveActionEvent.doActionComplete(); |
| 847 | 0 | KSNotifier.add(new KSNotification("Save Failed. There were validation errors.", false, true, 5000)); |
| 848 | |
}else{ |
| 849 | |
|
| 850 | 0 | saveActionEvent.setSaveSuccessful(true); |
| 851 | 0 | cluProposalModel.setRoot(result.getValue()); |
| 852 | 0 | String title = getProposalTitle(); |
| 853 | 0 | View currentView = getCurrentView(); |
| 854 | 0 | if (currentView instanceof SectionView){ |
| 855 | 0 | ((SectionView)currentView).updateView(cluProposalModel); |
| 856 | 0 | ((SectionView) currentView).resetDirtyFlags(); |
| 857 | |
} |
| 858 | 0 | saveActionEvent.doActionComplete(); |
| 859 | |
|
| 860 | 0 | ViewContext context = CourseProposalController.this.getViewContext(); |
| 861 | 0 | context.setId((String)cluProposalModel.get(proposalPath+"/id")); |
| 862 | 0 | context.setIdType(IdType.KS_KEW_OBJECT_ID); |
| 863 | |
|
| 864 | |
|
| 865 | 0 | if(workflowUtil != null){ |
| 866 | 0 | workflowUtil.refresh(); |
| 867 | |
} |
| 868 | |
|
| 869 | 0 | setHeaderTitle(); |
| 870 | 0 | setLastUpdated(); |
| 871 | 0 | HistoryManager.logHistoryChange(); |
| 872 | 0 | if(isNew){ |
| 873 | 0 | RecentlyViewedHelper.addDocument(getProposalTitle(), |
| 874 | |
HistoryManager.appendContext(AppLocations.Locations.COURSE_PROPOSAL.getLocation(), context) |
| 875 | |
+ "/SUMMARY"); |
| 876 | |
} |
| 877 | 0 | else if(!currentTitle.equals(title)){ |
| 878 | 0 | RecentlyViewedHelper.updateTitle(currentTitle, title, (String)cluProposalModel.get(proposalPath+"/id")); |
| 879 | |
} |
| 880 | 0 | isNew = false; |
| 881 | |
|
| 882 | 0 | if(saveActionEvent.gotoNextView()){ |
| 883 | 0 | CourseProposalController.this.showNextViewOnMenu(); |
| 884 | |
} |
| 885 | |
|
| 886 | 0 | if (ValidatorClientUtils.hasWarnings(result.getValidationResults())){ |
| 887 | 0 | if (!saveActionEvent.gotoNextView()){ |
| 888 | |
|
| 889 | 0 | isValid(result.getValidationResults(), false, true); |
| 890 | |
} |
| 891 | 0 | KSNotifier.show("Saved with Warnings"); |
| 892 | |
} else { |
| 893 | 0 | KSNotifier.show("Save Successful"); |
| 894 | |
} |
| 895 | |
} |
| 896 | 0 | } |
| 897 | |
}); |
| 898 | |
|
| 899 | 0 | } |
| 900 | |
|
| 901 | |
public void setLastUpdated(){ |
| 902 | 0 | Date lastUpdated = (Date)cluProposalModel.get(UPDATED_KEY); |
| 903 | 0 | if(lastUpdated != null){ |
| 904 | 0 | setContentInfo("Last Updated: " + df.format(lastUpdated)); |
| 905 | |
} |
| 906 | |
else{ |
| 907 | 0 | setContentInfo(""); |
| 908 | |
} |
| 909 | 0 | } |
| 910 | |
|
| 911 | |
@Override |
| 912 | |
public void beforeShow(final Callback<Boolean> onReadyCallback){ |
| 913 | 0 | Application.getApplicationContext().clearCrossConstraintMap(null); |
| 914 | 0 | Application.getApplicationContext().clearPathToFieldMapping(null); |
| 915 | 0 | Application.getApplicationContext().clearValidationWarnings(); |
| 916 | 0 | Application.getApplicationContext().setParentPath(""); |
| 917 | |
|
| 918 | 0 | intializeView(onReadyCallback); |
| 919 | 0 | } |
| 920 | |
|
| 921 | |
|
| 922 | |
|
| 923 | |
|
| 924 | |
@Override |
| 925 | |
public <V extends Enum<?>> void showView(final V viewType, final Callback<Boolean> onReadyCallback) { |
| 926 | 0 | Callback<Boolean> finalizeView = new Callback<Boolean>(){ |
| 927 | |
|
| 928 | |
public void exec(Boolean result) { |
| 929 | |
|
| 930 | |
|
| 931 | 0 | for(HasCrossConstraints crossConstraint:Application.getApplicationContext().getCrossConstraints(null)){ |
| 932 | 0 | crossConstraint.reprocessWithUpdatedConstraints(); |
| 933 | |
} |
| 934 | |
|
| 935 | |
|
| 936 | |
|
| 937 | 0 | if (viewType == CourseSections.SUMMARY){ |
| 938 | |
|
| 939 | 0 | KSBlockingProgressIndicator.addTask(initializingTask); |
| 940 | |
|
| 941 | 0 | courseServiceAsync.validate(cluProposalModel.getRoot(), new KSAsyncCallback<List<ValidationResultInfo>>(){ |
| 942 | |
|
| 943 | |
@Override |
| 944 | |
public void onSuccess(List<ValidationResultInfo> result) { |
| 945 | |
|
| 946 | 0 | Application.getApplicationContext().clearValidationWarnings(); |
| 947 | 0 | Application.getApplicationContext().addValidationWarnings(result); |
| 948 | |
|
| 949 | 0 | showWarnings(); |
| 950 | |
|
| 951 | 0 | KSBlockingProgressIndicator.removeTask(initializingTask); |
| 952 | 0 | } |
| 953 | |
}); |
| 954 | |
} else { |
| 955 | |
|
| 956 | 0 | showWarnings(); |
| 957 | |
} |
| 958 | |
|
| 959 | 0 | onReadyCallback.exec(result); |
| 960 | 0 | } |
| 961 | |
}; |
| 962 | |
|
| 963 | 0 | super.showView(viewType, finalizeView); |
| 964 | 0 | } |
| 965 | |
|
| 966 | |
|
| 967 | |
@Override |
| 968 | |
public void showDefaultView(Callback<Boolean> onReadyCallback) { |
| 969 | 0 | if(isNew){ |
| 970 | 0 | super.showFirstView(onReadyCallback); |
| 971 | |
} |
| 972 | |
else{ |
| 973 | 0 | super.showDefaultView(onReadyCallback); |
| 974 | |
} |
| 975 | 0 | } |
| 976 | |
|
| 977 | |
@Override |
| 978 | |
public void setParentController(Controller controller) { |
| 979 | 0 | super.setParentController(controller); |
| 980 | 0 | } |
| 981 | |
|
| 982 | |
@Override |
| 983 | |
|
| 984 | |
|
| 985 | |
|
| 986 | |
|
| 987 | |
|
| 988 | |
public void checkAuthorization(final AuthorizationCallback authCallback) { |
| 989 | 0 | GWT.log("Attempting Auth Check.", null); |
| 990 | |
|
| 991 | |
|
| 992 | 0 | Map<String,String> attributes = new HashMap<String,String>(); |
| 993 | 0 | addPermissionAttributes(attributes); |
| 994 | |
|
| 995 | |
|
| 996 | |
|
| 997 | |
|
| 998 | 0 | cluProposalRpcServiceAsync.isAuthorized(getViewContext().getPermissionType(), attributes, new KSAsyncCallback<Boolean>(){ |
| 999 | |
|
| 1000 | |
@Override |
| 1001 | |
public void handleFailure(Throwable caught) { |
| 1002 | 0 | authCallback.isNotAuthorized("Error checking authorization."); |
| 1003 | 0 | GWT.log("Error checking proposal authorization.", caught); |
| 1004 | 0 | Window.alert("Error Checking Proposal Authorization: "+caught.getMessage()); |
| 1005 | 0 | } |
| 1006 | |
|
| 1007 | |
@Override |
| 1008 | |
public void onSuccess(Boolean result) { |
| 1009 | 0 | GWT.log("Succeeded checking auth for permission type '" + getViewContext().getPermissionType().toString() + "' with result: " + result, null); |
| 1010 | 0 | if (Boolean.TRUE.equals(result)) { |
| 1011 | 0 | authCallback.isAuthorized(); |
| 1012 | |
} |
| 1013 | |
else { |
| 1014 | 0 | authCallback.isNotAuthorized("User is not authorized: " + getViewContext().getPermissionType().toString()); |
| 1015 | |
} |
| 1016 | 0 | } |
| 1017 | |
}); |
| 1018 | 0 | } |
| 1019 | |
|
| 1020 | |
@Override |
| 1021 | |
public void setViewContext(ViewContext viewContext) { |
| 1022 | |
|
| 1023 | |
|
| 1024 | |
|
| 1025 | |
|
| 1026 | |
|
| 1027 | |
|
| 1028 | 0 | if (viewContext.getId() != null && !viewContext.getId().isEmpty()) { |
| 1029 | 0 | if (viewContext.getIdType() != IdType.COPY_OF_OBJECT_ID |
| 1030 | |
&& viewContext.getIdType() != IdType.COPY_OF_KS_KEW_OBJECT_ID) { |
| 1031 | |
|
| 1032 | 0 | viewContext.setPermissionType(PermissionType.OPEN); |
| 1033 | |
} else { |
| 1034 | |
|
| 1035 | 0 | viewContext.setPermissionType(PermissionType.INITIATE); |
| 1036 | |
} |
| 1037 | |
} else { |
| 1038 | |
|
| 1039 | 0 | viewContext.setPermissionType(PermissionType.INITIATE); |
| 1040 | |
} |
| 1041 | |
|
| 1042 | 0 | context = viewContext; |
| 1043 | 0 | } |
| 1044 | |
|
| 1045 | |
|
| 1046 | |
|
| 1047 | |
|
| 1048 | |
public void addPermissionAttributes(Map<String, String> attributes){ |
| 1049 | 0 | ViewContext viewContext = getViewContext(); |
| 1050 | |
|
| 1051 | |
|
| 1052 | |
|
| 1053 | 0 | if ( (viewContext.getId() != null) && (!"".equals(viewContext.getId())) ) { |
| 1054 | 0 | attributes.put(viewContext.getIdType().toString(), viewContext.getId()); |
| 1055 | |
} |
| 1056 | |
|
| 1057 | |
|
| 1058 | 0 | if(viewContext.getId() != null && !viewContext.getId().isEmpty()){ |
| 1059 | 0 | if(viewContext.getIdType() != IdType.COPY_OF_OBJECT_ID && viewContext.getIdType() != IdType.COPY_OF_KS_KEW_OBJECT_ID){ |
| 1060 | |
|
| 1061 | 0 | attributes.put(StudentIdentityConstants.DOCUMENT_TYPE_NAME, LUConstants.PROPOSAL_TYPE_COURSE_CREATE); |
| 1062 | |
} else{ |
| 1063 | |
|
| 1064 | 0 | attributes.put(StudentIdentityConstants.DOCUMENT_TYPE_NAME, LUConstants.PROPOSAL_TYPE_COURSE_MODIFY); |
| 1065 | |
} |
| 1066 | |
} else{ |
| 1067 | |
|
| 1068 | 0 | attributes.put(StudentIdentityConstants.DOCUMENT_TYPE_NAME, LUConstants.PROPOSAL_TYPE_COURSE_CREATE); |
| 1069 | |
} |
| 1070 | 0 | } |
| 1071 | |
|
| 1072 | |
@Override |
| 1073 | |
public boolean isAuthorizationRequired() { |
| 1074 | 0 | return true; |
| 1075 | |
} |
| 1076 | |
|
| 1077 | |
@Override |
| 1078 | |
public void setAuthorizationRequired(boolean required) { |
| 1079 | 0 | throw new UnsupportedOperationException(); |
| 1080 | |
} |
| 1081 | |
|
| 1082 | |
protected void setHeaderTitle(){ |
| 1083 | |
String title; |
| 1084 | 0 | if (cluProposalModel.get(cfg.getProposalTitlePath()) != null){ |
| 1085 | 0 | title = getProposalTitle(); |
| 1086 | |
} |
| 1087 | |
else{ |
| 1088 | 0 | title = "New Course (Proposal)"; |
| 1089 | |
} |
| 1090 | 0 | this.setContentTitle(title); |
| 1091 | 0 | this.setName(title); |
| 1092 | 0 | WindowTitleUtils.setContextTitle(title); |
| 1093 | 0 | currentTitle = title; |
| 1094 | 0 | } |
| 1095 | |
|
| 1096 | |
@Override |
| 1097 | |
public WorkflowUtilities getWfUtilities() { |
| 1098 | 0 | return workflowUtil; |
| 1099 | |
} |
| 1100 | |
|
| 1101 | |
@Override |
| 1102 | |
public void beforeViewChange(final Enum<?> viewChangingTo, final Callback<Boolean> okToChange) { |
| 1103 | |
|
| 1104 | 0 | final Callback<Boolean> reallyOkToChange = new Callback<Boolean>(){ |
| 1105 | |
@Override |
| 1106 | |
public void exec(Boolean result) { |
| 1107 | 0 | if(result){ |
| 1108 | 0 | if(CourseSections.GOVERNANCE.equals(viewChangingTo)){ |
| 1109 | 0 | getView(CourseSections.COURSE_INFO, new Callback<View>(){ |
| 1110 | |
@Override |
| 1111 | |
public void exec(final View view) { |
| 1112 | 0 | if(view!=null && view instanceof SectionView){ |
| 1113 | 0 | requestModel(new ModelRequestCallback<DataModel>(){ |
| 1114 | |
public void onModelReady(DataModel model) { |
| 1115 | 0 | ((SectionView)view).updateWidgetData(model); |
| 1116 | 0 | okToChange.exec(true); |
| 1117 | 0 | } |
| 1118 | |
public void onRequestFail(Throwable cause) { |
| 1119 | 0 | okToChange.exec(false); |
| 1120 | 0 | } |
| 1121 | |
}); |
| 1122 | |
}else{ |
| 1123 | 0 | okToChange.exec(true); |
| 1124 | |
} |
| 1125 | 0 | }}); |
| 1126 | |
} else |
| 1127 | 0 | okToChange.exec(true); |
| 1128 | |
} else |
| 1129 | 0 | okToChange.exec(false); |
| 1130 | 0 | } |
| 1131 | |
}; |
| 1132 | |
|
| 1133 | |
|
| 1134 | |
|
| 1135 | |
|
| 1136 | |
|
| 1137 | 0 | super.beforeViewChange(viewChangingTo, new Callback<Boolean>(){ |
| 1138 | |
|
| 1139 | |
@Override |
| 1140 | |
public void exec(Boolean result) { |
| 1141 | 0 | if(result){ |
| 1142 | 0 | if(getCurrentView() instanceof SectionView && ((SectionView)getCurrentView()).isDirty()){ |
| 1143 | 0 | ButtonGroup<YesNoCancelEnum> buttonGroup = new YesNoCancelGroup(); |
| 1144 | 0 | final ButtonMessageDialog<YesNoCancelEnum> dialog = new ButtonMessageDialog<YesNoCancelEnum>("Warning", "You may have unsaved changes. Save changes?", buttonGroup); |
| 1145 | 0 | buttonGroup.addCallback(new Callback<YesNoCancelEnum>(){ |
| 1146 | |
|
| 1147 | |
@Override |
| 1148 | |
public void exec(YesNoCancelEnum result) { |
| 1149 | 0 | switch(result){ |
| 1150 | |
case YES: |
| 1151 | 0 | dialog.hide(); |
| 1152 | 0 | final SaveActionEvent e = new SaveActionEvent(); |
| 1153 | 0 | e.setActionCompleteCallback(new ActionCompleteCallback(){ |
| 1154 | |
|
| 1155 | |
@Override |
| 1156 | |
public void onActionComplete(ActionEvent action) { |
| 1157 | 0 | if(e.isSaveSuccessful()){ |
| 1158 | 0 | reallyOkToChange.exec(true); |
| 1159 | |
} |
| 1160 | |
else{ |
| 1161 | 0 | reallyOkToChange.exec(false); |
| 1162 | |
} |
| 1163 | 0 | } |
| 1164 | |
|
| 1165 | |
}); |
| 1166 | 0 | fireApplicationEvent(e); |
| 1167 | 0 | break; |
| 1168 | |
case NO: |
| 1169 | |
|
| 1170 | 0 | getCurrentModel(new ModelRequestCallback<DataModel>(){ |
| 1171 | |
|
| 1172 | |
@Override |
| 1173 | |
public void onModelReady(DataModel model) { |
| 1174 | 0 | if (getCurrentView()instanceof Section){ |
| 1175 | 0 | ((Section) getCurrentView()).resetFieldInteractionFlags(); |
| 1176 | |
} |
| 1177 | 0 | reallyOkToChange.exec(true); |
| 1178 | 0 | dialog.hide(); |
| 1179 | 0 | } |
| 1180 | |
|
| 1181 | |
@Override |
| 1182 | |
public void onRequestFail(Throwable cause) { |
| 1183 | |
|
| 1184 | |
|
| 1185 | 0 | reallyOkToChange.exec(false); |
| 1186 | 0 | dialog.hide(); |
| 1187 | 0 | GWT.log("Unable to retrieve model for data restore on view change with no save", cause); |
| 1188 | 0 | }}, |
| 1189 | |
NO_OP_CALLBACK); |
| 1190 | |
|
| 1191 | 0 | break; |
| 1192 | |
case CANCEL: |
| 1193 | 0 | reallyOkToChange.exec(false); |
| 1194 | 0 | dialog.hide(); |
| 1195 | |
|
| 1196 | 0 | HistoryManager.logHistoryChange(); |
| 1197 | |
break; |
| 1198 | |
} |
| 1199 | 0 | } |
| 1200 | |
}); |
| 1201 | 0 | dialog.addCloseLinkClickHandler(new ClickHandler() { |
| 1202 | |
|
| 1203 | |
@Override |
| 1204 | |
public void onClick(ClickEvent event) { |
| 1205 | 0 | okToChange.exec(false); |
| 1206 | 0 | dialog.hide(); |
| 1207 | |
|
| 1208 | 0 | HistoryManager.logHistoryChange(); |
| 1209 | 0 | } |
| 1210 | |
}); |
| 1211 | 0 | dialog.show(); |
| 1212 | 0 | } |
| 1213 | |
else{ |
| 1214 | 0 | reallyOkToChange.exec(true); |
| 1215 | |
} |
| 1216 | |
} |
| 1217 | |
else{ |
| 1218 | 0 | reallyOkToChange.exec(false); |
| 1219 | |
} |
| 1220 | 0 | } |
| 1221 | |
}); |
| 1222 | 0 | } |
| 1223 | |
|
| 1224 | |
public KSButton getSaveButton(){ |
| 1225 | 0 | if(currentDocType != LUConstants.PROPOSAL_TYPE_COURSE_MODIFY && currentDocType != LUConstants.PROPOSAL_TYPE_COURSE_MODIFY_ADMIN){ |
| 1226 | 0 | return new KSButton("Save and Continue", new ClickHandler(){ |
| 1227 | |
public void onClick(ClickEvent event) { |
| 1228 | 0 | CourseProposalController.this.fireApplicationEvent(new SaveActionEvent(true)); |
| 1229 | 0 | } |
| 1230 | |
}); |
| 1231 | |
} |
| 1232 | |
else{ |
| 1233 | 0 | return new KSButton("Save", new ClickHandler(){ |
| 1234 | |
public void onClick(ClickEvent event) { |
| 1235 | 0 | CourseProposalController.this.fireApplicationEvent(new SaveActionEvent(false)); |
| 1236 | 0 | } |
| 1237 | |
}); |
| 1238 | |
} |
| 1239 | |
} |
| 1240 | |
|
| 1241 | |
public KSButton getCancelButton(final Enum<?> summaryView){ |
| 1242 | |
|
| 1243 | 0 | return new KSButton("Cancel", ButtonStyle.ANCHOR_LARGE_CENTERED, new ClickHandler(){ |
| 1244 | |
public void onClick(ClickEvent event) { |
| 1245 | 0 | if(!isNew){ |
| 1246 | 0 | CourseProposalController.this.showView(summaryView); |
| 1247 | |
} |
| 1248 | |
else{ |
| 1249 | 0 | Application.navigate(AppLocations.Locations.CURRICULUM_MANAGEMENT.getLocation()); |
| 1250 | |
} |
| 1251 | 0 | } |
| 1252 | |
}); |
| 1253 | |
|
| 1254 | |
} |
| 1255 | |
|
| 1256 | |
@Override |
| 1257 | |
public void onHistoryEvent(String historyStack) { |
| 1258 | 0 | super.onHistoryEvent(historyStack); |
| 1259 | |
|
| 1260 | |
|
| 1261 | 0 | if(cluProposalModel.get(cfg.getProposalTitlePath()) != null && |
| 1262 | |
this.getViewContext().getIdType() != IdType.COPY_OF_OBJECT_ID){ |
| 1263 | 0 | RecentlyViewedHelper.addCurrentDocument(getProposalTitle()); |
| 1264 | |
} |
| 1265 | 0 | } |
| 1266 | |
|
| 1267 | |
private String getProposalTitle(){ |
| 1268 | 0 | StringBuffer sb = new StringBuffer(); |
| 1269 | 0 | sb.append(cluProposalModel.get(cfg.getProposalTitlePath())); |
| 1270 | 0 | sb.append(" (Proposal)"); |
| 1271 | 0 | return sb.toString(); |
| 1272 | |
} |
| 1273 | |
|
| 1274 | |
public String getCourseId(){ |
| 1275 | 0 | return cluProposalModel.<String>get("id"); |
| 1276 | |
} |
| 1277 | |
|
| 1278 | |
public String getCourseState(){ |
| 1279 | 0 | return cluProposalModel.<String>get("state"); |
| 1280 | |
} |
| 1281 | |
|
| 1282 | |
public boolean isNew() { |
| 1283 | 0 | return isNew; |
| 1284 | |
} |
| 1285 | |
|
| 1286 | |
public CourseRequirementsDataModel getReqDataModel() { |
| 1287 | 0 | return reqDataModel; |
| 1288 | |
} |
| 1289 | |
|
| 1290 | |
public CourseRequirementsDataModel getReqDataModelComp() { |
| 1291 | 0 | return reqDataModelComp; |
| 1292 | |
} |
| 1293 | |
|
| 1294 | |
@Override |
| 1295 | |
public DataModel getExportDataModel() { |
| 1296 | 0 | return cluProposalModel; |
| 1297 | |
} |
| 1298 | |
|
| 1299 | |
|
| 1300 | |
|
| 1301 | |
|
| 1302 | |
|
| 1303 | |
@Override |
| 1304 | |
public String getExportTemplateName() { |
| 1305 | 0 | if (LUConstants.PROPOSAL_TYPE_COURSE_CREATE.equals(currentDocType)){ |
| 1306 | 0 | return "base.template"; |
| 1307 | |
} |
| 1308 | 0 | return "proposal.template"; |
| 1309 | |
} |
| 1310 | |
|
| 1311 | |
@Override |
| 1312 | |
public List<ExportElement> getExportElementsFromView() { |
| 1313 | 0 | List<ExportElement> exportElements = new ArrayList<ExportElement>(); |
| 1314 | 0 | if (this.getCurrentViewEnum().equals(CourseSections.SUMMARY)) { |
| 1315 | 0 | SummaryTableSection tableSection = this.cfg.getSummaryConfigurer().getTableSection(); |
| 1316 | 0 | ExportElement heading = new ExportElement(); |
| 1317 | 0 | heading.setFieldLabel(""); |
| 1318 | 0 | heading.setFieldValue(cluProposalModel.getModelName()); |
| 1319 | 0 | heading.setFieldValue2(comparisonModel.getModelName()); |
| 1320 | 0 | exportElements.add(heading); |
| 1321 | 0 | exportElements.addAll(ExportUtils.getDetailsForWidget(tableSection.getSummaryTable())); |
| 1322 | |
} |
| 1323 | 0 | return exportElements; |
| 1324 | |
} |
| 1325 | |
|
| 1326 | |
@Override |
| 1327 | |
public boolean isExportButtonActive() { |
| 1328 | 0 | if (this.getCurrentViewEnum() != null && this.getCurrentViewEnum().equals(CourseSections.SUMMARY)) { |
| 1329 | 0 | return true; |
| 1330 | |
} else { |
| 1331 | 0 | return false; |
| 1332 | |
} |
| 1333 | |
|
| 1334 | |
} |
| 1335 | |
|
| 1336 | |
|
| 1337 | |
|
| 1338 | |
|
| 1339 | |
|
| 1340 | |
|
| 1341 | |
protected String getStateforSaveAction(DataModel model){ |
| 1342 | |
|
| 1343 | 0 | String state = (String)model.get(CreditCourseConstants.STATE); |
| 1344 | |
|
| 1345 | |
|
| 1346 | |
|
| 1347 | 0 | if (state == null){ |
| 1348 | 0 | state = cfg.getState(); |
| 1349 | |
} |
| 1350 | |
|
| 1351 | 0 | return state; |
| 1352 | |
} |
| 1353 | |
|
| 1354 | |
public String getMessage(String courseMessageKey) { |
| 1355 | 0 | String msg = Application.getApplicationContext().getMessage(MSG_GROUP, courseMessageKey); |
| 1356 | 0 | if (msg == null) { |
| 1357 | 0 | msg = courseMessageKey; |
| 1358 | |
} |
| 1359 | 0 | return msg; |
| 1360 | |
} |
| 1361 | |
|
| 1362 | |
|
| 1363 | |
|
| 1364 | |
|
| 1365 | |
|
| 1366 | |
|
| 1367 | |
|
| 1368 | |
|
| 1369 | |
|
| 1370 | |
|
| 1371 | |
protected BaseDataOrchestrationRpcServiceAsync getCourseProposalRpcService(){ |
| 1372 | 0 | return cluProposalRpcServiceAsync; |
| 1373 | |
} |
| 1374 | |
|
| 1375 | |
public CourseProposalConfigurer getCourseProposalConfigurer() { |
| 1376 | 0 | return cfg; |
| 1377 | |
} |
| 1378 | |
} |