| 1 | |
package org.kuali.student.lum.program.client.major.proposal; |
| 2 | |
|
| 3 | |
import java.util.ArrayList; |
| 4 | |
import java.util.HashMap; |
| 5 | |
import java.util.Iterator; |
| 6 | |
import java.util.List; |
| 7 | |
import java.util.Map; |
| 8 | |
import java.util.Set; |
| 9 | |
import java.util.TreeSet; |
| 10 | |
|
| 11 | |
import org.kuali.student.common.assembly.data.Data; |
| 12 | |
import org.kuali.student.common.assembly.data.Data.Property; |
| 13 | |
import org.kuali.student.common.assembly.data.Metadata; |
| 14 | |
import org.kuali.student.common.assembly.data.QueryPath; |
| 15 | |
import org.kuali.student.common.dto.DtoConstants; |
| 16 | |
import org.kuali.student.common.rice.StudentIdentityConstants; |
| 17 | |
import org.kuali.student.common.rice.authorization.PermissionType; |
| 18 | |
import org.kuali.student.common.ui.client.application.Application; |
| 19 | |
import org.kuali.student.common.ui.client.application.KSAsyncCallback; |
| 20 | |
import org.kuali.student.common.ui.client.application.ViewContext; |
| 21 | |
import org.kuali.student.common.ui.client.configurable.mvc.views.SectionView; |
| 22 | |
import org.kuali.student.common.ui.client.event.SaveActionEvent; |
| 23 | |
import org.kuali.student.common.ui.client.event.SaveActionHandler; |
| 24 | |
import org.kuali.student.common.ui.client.mvc.ApplicationEvent; |
| 25 | |
import org.kuali.student.common.ui.client.mvc.Callback; |
| 26 | |
import org.kuali.student.common.ui.client.mvc.DataModel; |
| 27 | |
import org.kuali.student.common.ui.client.mvc.DataModelDefinition; |
| 28 | |
import org.kuali.student.common.ui.client.mvc.HasCrossConstraints; |
| 29 | |
import org.kuali.student.common.ui.client.mvc.ModelProvider; |
| 30 | |
import org.kuali.student.common.ui.client.mvc.ModelRequestCallback; |
| 31 | |
import org.kuali.student.common.ui.client.mvc.View; |
| 32 | |
import org.kuali.student.common.ui.client.mvc.dto.ReferenceModel; |
| 33 | |
import org.kuali.student.common.ui.client.mvc.history.HistoryManager; |
| 34 | |
import org.kuali.student.common.ui.client.service.DataSaveResult; |
| 35 | |
import org.kuali.student.common.ui.client.validator.ValidatorClientUtils; |
| 36 | |
import org.kuali.student.common.ui.client.widgets.KSButton; |
| 37 | |
import org.kuali.student.common.ui.client.widgets.KSButtonAbstract; |
| 38 | |
import org.kuali.student.common.ui.client.widgets.notification.KSNotification; |
| 39 | |
import org.kuali.student.common.ui.client.widgets.notification.KSNotifier; |
| 40 | |
import org.kuali.student.common.ui.shared.IdAttributes; |
| 41 | |
import org.kuali.student.common.ui.shared.IdAttributes.IdType; |
| 42 | |
import org.kuali.student.common.validation.dto.ValidationResultInfo; |
| 43 | |
import org.kuali.student.core.proposal.dto.ProposalInfo; |
| 44 | |
import org.kuali.student.core.proposal.ui.client.service.ProposalRpcService; |
| 45 | |
import org.kuali.student.core.proposal.ui.client.service.ProposalRpcServiceAsync; |
| 46 | |
import org.kuali.student.core.workflow.ui.client.widgets.WorkflowEnhancedNavController; |
| 47 | |
import org.kuali.student.core.workflow.ui.client.widgets.WorkflowUtilities; |
| 48 | |
import org.kuali.student.lum.common.client.configuration.LUMViews; |
| 49 | |
import org.kuali.student.lum.common.client.helpers.RecentlyViewedHelper; |
| 50 | |
import org.kuali.student.lum.common.client.widgets.AppLocations; |
| 51 | |
import org.kuali.student.lum.program.client.ProgramConstants; |
| 52 | |
import org.kuali.student.lum.program.client.ProgramRegistry; |
| 53 | |
import org.kuali.student.lum.program.client.ProgramSections; |
| 54 | |
import org.kuali.student.lum.program.client.ProgramStatus; |
| 55 | |
import org.kuali.student.lum.program.client.ProgramUtils; |
| 56 | |
import org.kuali.student.lum.program.client.events.AddSpecializationEvent; |
| 57 | |
import org.kuali.student.lum.program.client.events.AfterSaveEvent; |
| 58 | |
import org.kuali.student.lum.program.client.events.ChangeViewEvent; |
| 59 | |
import org.kuali.student.lum.program.client.events.MetadataLoadedEvent; |
| 60 | |
import org.kuali.student.lum.program.client.events.ModelLoadedEvent; |
| 61 | |
import org.kuali.student.lum.program.client.events.SpecializationCreatedEvent; |
| 62 | |
import org.kuali.student.lum.program.client.events.SpecializationSaveEvent; |
| 63 | |
import org.kuali.student.lum.program.client.events.SpecializationUpdateEvent; |
| 64 | |
import org.kuali.student.lum.program.client.events.StateChangeEvent; |
| 65 | |
import org.kuali.student.lum.program.client.events.StoreRequirementIDsEvent; |
| 66 | |
import org.kuali.student.lum.program.client.events.UpdateEvent; |
| 67 | |
import org.kuali.student.lum.program.client.major.MajorController; |
| 68 | |
import org.kuali.student.lum.program.client.properties.ProgramProperties; |
| 69 | |
import org.kuali.student.lum.program.client.requirements.ProgramRequirementsDataModel; |
| 70 | |
import org.kuali.student.lum.program.client.rpc.AbstractCallback; |
| 71 | |
import org.kuali.student.lum.program.client.rpc.MajorDisciplineProposalRpcService; |
| 72 | |
import org.kuali.student.lum.program.client.rpc.MajorDisciplineRpcService; |
| 73 | |
import org.kuali.student.lum.program.client.rpc.MajorDisciplineRpcServiceAsync; |
| 74 | |
import org.kuali.student.lum.program.client.widgets.ProgramSideBar; |
| 75 | |
|
| 76 | |
import com.google.gwt.core.client.GWT; |
| 77 | |
import com.google.gwt.event.dom.client.ClickEvent; |
| 78 | |
import com.google.gwt.event.dom.client.ClickHandler; |
| 79 | |
import com.google.gwt.event.shared.HandlerManager; |
| 80 | |
import com.google.gwt.user.client.Window; |
| 81 | |
|
| 82 | |
|
| 83 | |
|
| 84 | |
|
| 85 | 0 | public class MajorProposalController extends MajorController implements WorkflowEnhancedNavController { |
| 86 | |
|
| 87 | 0 | private final KSButton saveButton = new KSButton(ProgramProperties.get().common_save()); |
| 88 | 0 | private final KSButton cancelButton = new KSButton(ProgramProperties.get().common_cancel(), KSButtonAbstract.ButtonStyle.ANCHOR_LARGE_CENTERED); |
| 89 | 0 | private final Set<String> existingVariationIds = new TreeSet<String>(); |
| 90 | 0 | protected String proposalPath = ""; |
| 91 | |
protected WorkflowUtilities workflowUtil; |
| 92 | 0 | private final ProposalRpcServiceAsync proposalServiceAsync = GWT.create(ProposalRpcService.class); |
| 93 | |
|
| 94 | 0 | protected final DataModel comparisonModel = new DataModel("Original Program"); |
| 95 | 0 | private String comparisonModelId = "ComparisonModel"; |
| 96 | |
|
| 97 | |
private ProgramRequirementsDataModel reqDataModel; |
| 98 | |
private ProgramRequirementsDataModel reqDataModelComp; |
| 99 | |
|
| 100 | |
protected MajorDisciplineRpcServiceAsync majorDisciplineService; |
| 101 | |
|
| 102 | |
|
| 103 | |
|
| 104 | |
|
| 105 | |
|
| 106 | |
|
| 107 | |
public MajorProposalController(DataModel programModel, ViewContext viewContext, HandlerManager eventBus) { |
| 108 | 0 | super(programModel, viewContext, eventBus); |
| 109 | 0 | majorDisciplineService = createMajorDisciplineService(); |
| 110 | 0 | programModel.setModelName("Proposal"); |
| 111 | 0 | initializeComparisonModel(); |
| 112 | 0 | configurer = GWT.create(MajorProposalConfigurer.class); |
| 113 | 0 | proposalPath = configurer.getProposalPath(); |
| 114 | 0 | workflowUtil = new WorkflowUtilities(MajorProposalController.this, proposalPath, "Proposal Actions", |
| 115 | |
ProgramSections.WF_APPROVE_DIALOG,"Required Fields", ProgramConstants.PROGRAM_MODEL_ID); |
| 116 | |
|
| 117 | 0 | sideBar.setState(ProgramSideBar.State.EDIT); |
| 118 | 0 | initHandlers(); |
| 119 | |
|
| 120 | 0 | reqDataModel = new ProgramRequirementsDataModel(eventBus); |
| 121 | 0 | reqDataModelComp = new ProgramRequirementsDataModel(eventBus); |
| 122 | 0 | } |
| 123 | |
|
| 124 | |
|
| 125 | |
|
| 126 | |
|
| 127 | |
|
| 128 | |
|
| 129 | |
|
| 130 | |
|
| 131 | |
@Override |
| 132 | |
public void requestModel(Class modelType, ModelRequestCallback callback) { |
| 133 | 0 | if (modelType == ReferenceModel.class) { |
| 134 | 0 | ReferenceModel referenceModel = new ReferenceModel(); |
| 135 | |
|
| 136 | |
|
| 137 | |
|
| 138 | |
|
| 139 | 0 | referenceModel.setReferenceId(ProgramUtils.getProposalId(programModel)); |
| 140 | |
|
| 141 | |
|
| 142 | |
|
| 143 | 0 | referenceModel.setReferenceTypeKey(ProgramConstants.PROPOSAL_REFERENCE_TYPE_ID); |
| 144 | |
|
| 145 | |
|
| 146 | |
|
| 147 | |
|
| 148 | 0 | referenceModel.setReferenceType(ProgramConstants.MAJOR_LU_TYPE_ID); |
| 149 | |
|
| 150 | 0 | Map<String, String> attributes = new HashMap<String, String>(); |
| 151 | 0 | attributes.put("name", getStringProperty("name")); |
| 152 | 0 | referenceModel.setReferenceAttributes(attributes); |
| 153 | 0 | callback.onModelReady(referenceModel); |
| 154 | 0 | } else { |
| 155 | 0 | super.requestModel(modelType, callback); |
| 156 | |
} |
| 157 | 0 | } |
| 158 | |
|
| 159 | |
|
| 160 | |
|
| 161 | |
|
| 162 | |
|
| 163 | |
|
| 164 | |
@Override |
| 165 | |
protected MajorDisciplineRpcServiceAsync createProgramRemoteService() { |
| 166 | 0 | return GWT.create(MajorDisciplineProposalRpcService.class); |
| 167 | |
} |
| 168 | |
|
| 169 | |
|
| 170 | |
|
| 171 | |
|
| 172 | |
protected MajorDisciplineRpcServiceAsync createMajorDisciplineService() { |
| 173 | 0 | return GWT.create(MajorDisciplineRpcService.class); |
| 174 | |
} |
| 175 | |
|
| 176 | |
@Override |
| 177 | |
protected void configureView() { |
| 178 | 0 | super.configureView(); |
| 179 | 0 | if (!initialized) { |
| 180 | 0 | eventBus.fireEvent(new MetadataLoadedEvent(programModel.getDefinition(), this)); |
| 181 | 0 | List<Enum<?>> excludedViews = new ArrayList<Enum<?>>(); |
| 182 | 0 | excludedViews.add(ProgramSections.PROGRAM_REQUIREMENTS_EDIT); |
| 183 | 0 | excludedViews.add(ProgramSections.SUPPORTING_DOCUMENTS_EDIT); |
| 184 | 0 | excludedViews.add(ProgramSections.SUMMARY); |
| 185 | 0 | addCommonButton(ProgramProperties.get().program_menu_sections(), saveButton, excludedViews); |
| 186 | 0 | addCommonButton(ProgramProperties.get().program_menu_sections(), cancelButton, excludedViews); |
| 187 | 0 | initialized = true; |
| 188 | |
} |
| 189 | 0 | } |
| 190 | |
|
| 191 | |
|
| 192 | |
|
| 193 | |
|
| 194 | |
|
| 195 | |
|
| 196 | |
|
| 197 | |
|
| 198 | |
|
| 199 | |
|
| 200 | |
@Override |
| 201 | |
public void setViewContext(ViewContext viewContext) { |
| 202 | 0 | super.setViewContext(viewContext); |
| 203 | 0 | if(viewContext.getId() != null && !viewContext.getId().isEmpty()){ |
| 204 | 0 | if(viewContext.getIdType() != IdType.COPY_OF_OBJECT_ID && viewContext.getIdType() != IdType.COPY_OF_KS_KEW_OBJECT_ID){ |
| 205 | |
|
| 206 | 0 | viewContext.setPermissionType(PermissionType.OPEN); |
| 207 | |
} else{ |
| 208 | |
|
| 209 | |
|
| 210 | |
|
| 211 | |
|
| 212 | 0 | resetModel(); |
| 213 | |
|
| 214 | 0 | viewContext.setPermissionType(PermissionType.INITIATE); |
| 215 | |
} |
| 216 | |
} |
| 217 | |
else{ |
| 218 | 0 | viewContext.setPermissionType(PermissionType.INITIATE); |
| 219 | |
} |
| 220 | 0 | } |
| 221 | |
|
| 222 | |
|
| 223 | |
|
| 224 | |
|
| 225 | |
|
| 226 | |
|
| 227 | |
|
| 228 | |
public WorkflowUtilities getWfUtilities(){ |
| 229 | 0 | return workflowUtil; |
| 230 | |
} |
| 231 | |
|
| 232 | |
private void initHandlers() { |
| 233 | 0 | saveButton.addClickHandler(new ClickHandler() { |
| 234 | |
|
| 235 | |
@Override |
| 236 | |
public void onClick(ClickEvent event) { |
| 237 | 0 | doSave(); |
| 238 | 0 | } |
| 239 | |
}); |
| 240 | 0 | cancelButton.addClickHandler(new ClickHandler() { |
| 241 | |
|
| 242 | |
@Override |
| 243 | |
public void onClick(ClickEvent event) { |
| 244 | 0 | doCancel(); |
| 245 | 0 | } |
| 246 | |
}); |
| 247 | 0 | eventBus.addHandler(UpdateEvent.TYPE, new UpdateEvent.Handler() { |
| 248 | |
@Override |
| 249 | |
public void onEvent(UpdateEvent event) { |
| 250 | 0 | Enum<?> view = event.getCurrentView(); |
| 251 | 0 | if (view != null) { |
| 252 | 0 | setCurrentViewEnum(view); |
| 253 | |
} |
| 254 | 0 | doSave(event.getOkCallback()); |
| 255 | |
|
| 256 | 0 | } |
| 257 | |
}); |
| 258 | 0 | eventBus.addHandler(StateChangeEvent.TYPE, new StateChangeEvent.Handler() { |
| 259 | |
@Override |
| 260 | |
public void onEvent(final StateChangeEvent event) { |
| 261 | |
|
| 262 | |
|
| 263 | |
|
| 264 | 0 | programRemoteService.validate(programModel.getRoot(), new KSAsyncCallback<List<ValidationResultInfo>>(){ |
| 265 | |
@Override |
| 266 | |
public void onSuccess(final List<ValidationResultInfo> currentStateResults) { |
| 267 | 0 | programModel.validateNextState(new Callback<List<ValidationResultInfo>>() { |
| 268 | |
@Override |
| 269 | |
public void exec(List<ValidationResultInfo> nextStateResults) { |
| 270 | |
|
| 271 | 0 | Application.getApplicationContext().clearValidationWarnings(); |
| 272 | 0 | Application.getApplicationContext().addValidationWarnings(currentStateResults); |
| 273 | 0 | isValid(Application.getApplicationContext().getValidationWarnings(), false); |
| 274 | |
|
| 275 | 0 | boolean isSectionValid = isValid(nextStateResults, true) |
| 276 | |
&& Application.getApplicationContext().getValidationWarnings().isEmpty(); |
| 277 | 0 | if (isSectionValid) { |
| 278 | 0 | Callback<Boolean> callback = new Callback<Boolean>() { |
| 279 | |
@Override |
| 280 | |
public void exec(Boolean result) { |
| 281 | 0 | if (result) { |
| 282 | 0 | reloadMetadata = true; |
| 283 | 0 | loadMetadata(new Callback<Boolean>() { |
| 284 | |
@Override |
| 285 | |
public void exec(Boolean result) { |
| 286 | 0 | if (result) { |
| 287 | 0 | ProgramUtils.syncMetadata(configurer, programModel.getDefinition()); |
| 288 | 0 | HistoryManager.navigate(AppLocations.Locations.VIEW_PROGRAM.getLocation(), context); |
| 289 | |
} |
| 290 | 0 | } |
| 291 | |
}); |
| 292 | |
} |
| 293 | 0 | } |
| 294 | |
}; |
| 295 | 0 | updateState(event.getProgramStatus().getValue(), callback); |
| 296 | 0 | } else { |
| 297 | 0 | KSNotifier.add(new KSNotification("Unable to save, please check fields for errors.", false, true, 5000)); |
| 298 | |
} |
| 299 | 0 | } |
| 300 | |
}); |
| 301 | 0 | } |
| 302 | |
}); |
| 303 | 0 | } |
| 304 | |
}); |
| 305 | |
|
| 306 | 0 | eventBus.addHandler(SpecializationSaveEvent.TYPE, new SpecializationSaveEvent.Handler() { |
| 307 | |
@Override |
| 308 | |
public void onEvent(SpecializationSaveEvent event) { |
| 309 | |
|
| 310 | 0 | Data currentVariations = getDataProperty(ProgramConstants.VARIATIONS); |
| 311 | |
|
| 312 | 0 | existingVariationIds.clear(); |
| 313 | |
|
| 314 | 0 | for (Data.Property prop : currentVariations) { |
| 315 | 0 | String existingId = (String) ((Data) prop.getValue()).get(ProgramConstants.ID); |
| 316 | 0 | existingVariationIds.add(existingId); |
| 317 | 0 | } |
| 318 | 0 | String updatedId = event.getData().get(ProgramConstants.ID); |
| 319 | 0 | Integer updatedKey = null; |
| 320 | |
|
| 321 | |
|
| 322 | |
|
| 323 | |
|
| 324 | |
|
| 325 | 0 | if (updatedId != null) { |
| 326 | 0 | for (Data.Property prop : currentVariations) { |
| 327 | 0 | String id = (String) ((Data) prop.getValue()).get(ProgramConstants.ID); |
| 328 | 0 | if (updatedId.equals(id)) { |
| 329 | 0 | updatedKey = prop.getKey(); |
| 330 | 0 | Data currentMetaInfo = ((Data) prop.getValue()).get("metaInfo"); |
| 331 | 0 | String latestVersionInd = currentMetaInfo.get("versionInd"); |
| 332 | 0 | Data newMetaInfo = event.getData().get("metaInfo"); |
| 333 | 0 | if (newMetaInfo == null) { |
| 334 | 0 | newMetaInfo = new Data(); |
| 335 | 0 | event.getData().set("metaInfo", newMetaInfo); |
| 336 | |
} |
| 337 | 0 | newMetaInfo.set("versionInd", latestVersionInd); |
| 338 | 0 | break; |
| 339 | |
} |
| 340 | 0 | } |
| 341 | |
|
| 342 | 0 | currentVariations.set(updatedKey, event.getData()); |
| 343 | |
} else { |
| 344 | 0 | currentVariations.add(event.getData()); |
| 345 | |
|
| 346 | |
} |
| 347 | 0 | doSave(); |
| 348 | 0 | } |
| 349 | |
}); |
| 350 | 0 | eventBus.addHandler(AddSpecializationEvent.TYPE, new AddSpecializationEvent.Handler() { |
| 351 | |
@Override |
| 352 | |
public void onEvent(AddSpecializationEvent event) { |
| 353 | 0 | String id = getStringProperty(ProgramConstants.ID); |
| 354 | 0 | ProgramRegistry.setRow((getDataProperty(ProgramConstants.VARIATIONS)).size()); |
| 355 | 0 | Data variationData = ProgramUtils.createNewSpecializationBasedOnMajor(programModel); |
| 356 | 0 | ProgramRegistry.setData(variationData); |
| 357 | 0 | ViewContext viewContext = new ViewContext(); |
| 358 | 0 | viewContext.setId(id); |
| 359 | 0 | viewContext.setIdType(IdAttributes.IdType.OBJECT_ID); |
| 360 | 0 | if(programModel.get("proposal/id") != null){ |
| 361 | |
|
| 362 | 0 | variationData.set("isProposal", true); |
| 363 | |
} |
| 364 | 0 | HistoryManager.navigate(AppLocations.Locations.EDIT_VARIATION.getLocation(), viewContext); |
| 365 | |
|
| 366 | 0 | } |
| 367 | |
}); |
| 368 | |
|
| 369 | 0 | eventBus.addHandler(StoreRequirementIDsEvent.TYPE, new StoreRequirementIDsEvent.Handler() { |
| 370 | |
@Override |
| 371 | |
public void onEvent(StoreRequirementIDsEvent event) { |
| 372 | 0 | List<String> ids = event.getProgramRequirementIds(); |
| 373 | |
|
| 374 | 0 | programModel.set(QueryPath.parse(ProgramConstants.PROGRAM_REQUIREMENTS), new Data()); |
| 375 | 0 | Data programRequirements = programModel.get(ProgramConstants.PROGRAM_REQUIREMENTS); |
| 376 | |
|
| 377 | 0 | if (programRequirements == null) { |
| 378 | 0 | Window.alert("Cannot find program requirements in data model."); |
| 379 | 0 | GWT.log("Cannot find program requirements in data model", null); |
| 380 | 0 | return; |
| 381 | |
} |
| 382 | |
|
| 383 | 0 | for (String id : ids) { |
| 384 | 0 | programRequirements.add(id); |
| 385 | |
} |
| 386 | 0 | doSave(); |
| 387 | 0 | } |
| 388 | |
}); |
| 389 | 0 | eventBus.addHandler(ChangeViewEvent.TYPE, new ChangeViewEvent.Handler() { |
| 390 | |
@Override |
| 391 | |
public void onEvent(ChangeViewEvent event) { |
| 392 | 0 | showView(event.getViewToken()); |
| 393 | 0 | } |
| 394 | |
}); |
| 395 | 0 | eventBus.addHandler(ModelLoadedEvent.TYPE, new ModelLoadedEvent.Handler(){ |
| 396 | |
@Override |
| 397 | |
public void onEvent(ModelLoadedEvent event) { |
| 398 | 0 | if (workflowUtil != null){ |
| 399 | 0 | workflowUtil.requestAndSetupModel(); |
| 400 | |
|
| 401 | |
} |
| 402 | 0 | } |
| 403 | |
}); |
| 404 | |
|
| 405 | 0 | addApplicationEventHandler(SaveActionEvent.TYPE, new SaveActionHandler(){ |
| 406 | |
@Override |
| 407 | |
public void doSave(final SaveActionEvent saveAction) { |
| 408 | 0 | MajorProposalController.this.doSave(new Callback<Boolean>(){ |
| 409 | |
@Override |
| 410 | |
public void exec(Boolean result) { |
| 411 | 0 | saveAction.doActionComplete(); |
| 412 | 0 | } |
| 413 | |
}); |
| 414 | 0 | } |
| 415 | |
}); |
| 416 | 0 | } |
| 417 | |
|
| 418 | |
|
| 419 | |
|
| 420 | |
|
| 421 | |
@Override |
| 422 | |
public void fireApplicationEvent(ApplicationEvent event) { |
| 423 | |
|
| 424 | 0 | if(event instanceof SaveActionEvent){ |
| 425 | 0 | eventBus.fireEvent(event); |
| 426 | |
} |
| 427 | 0 | super.fireApplicationEvent(event); |
| 428 | 0 | } |
| 429 | |
|
| 430 | |
|
| 431 | |
|
| 432 | |
|
| 433 | |
|
| 434 | |
private void initializeComparisonModel() { |
| 435 | 0 | super.registerModel(comparisonModelId, new ModelProvider<DataModel>() { |
| 436 | |
@Override |
| 437 | |
public void requestModel(final ModelRequestCallback<DataModel> callback) { |
| 438 | 0 | if(comparisonModel.getRoot() != null && comparisonModel.getRoot().size() != 0){ |
| 439 | 0 | callback.onModelReady(comparisonModel); |
| 440 | |
} |
| 441 | |
else{ |
| 442 | 0 | callback.onModelReady(null); |
| 443 | |
} |
| 444 | 0 | } |
| 445 | |
}); |
| 446 | 0 | } |
| 447 | |
|
| 448 | |
@Override |
| 449 | |
protected void loadMetadata(final Callback<Boolean> onReadyCallback) { |
| 450 | 0 | Map<String, String> idAttributes = new HashMap<String, String>(); |
| 451 | 0 | ViewContext viewContext = getViewContext(); |
| 452 | 0 | IdType idType = viewContext.getIdType(); |
| 453 | 0 | String viewContextId = null; |
| 454 | 0 | if (idType != null) { |
| 455 | 0 | idAttributes.put(IdAttributes.ID_TYPE, idType.toString()); |
| 456 | 0 | viewContextId = viewContext.getId(); |
| 457 | 0 | if (idType == IdType.COPY_OF_OBJECT_ID) { |
| 458 | 0 | viewContextId = null; |
| 459 | |
} |
| 460 | |
} |
| 461 | 0 | if (programModel.getRoot() != null) { |
| 462 | 0 | ProgramStatus programStatus = ProgramStatus.of(programModel); |
| 463 | 0 | idAttributes.put(DtoConstants.DTO_STATE, programStatus.getValue()); |
| 464 | 0 | if (programStatus.getNextStatus() != null) { |
| 465 | 0 | idAttributes.put(DtoConstants.DTO_NEXT_STATE, programStatus.getNextStatus().getValue()); |
| 466 | |
} |
| 467 | |
|
| 468 | 0 | String workflowNode = programModel.get("proposal/workflowNode"); |
| 469 | 0 | if(workflowNode!=null){ |
| 470 | 0 | idAttributes.put(DtoConstants.DTO_WORKFLOW_NODE, workflowNode); |
| 471 | |
} |
| 472 | |
} |
| 473 | 0 | programRemoteService.getMetadata(viewContextId, idAttributes, new AbstractCallback<Metadata>() { |
| 474 | |
|
| 475 | |
@Override |
| 476 | |
public void onSuccess(Metadata result) { |
| 477 | 0 | super.onSuccess(result); |
| 478 | 0 | DataModelDefinition def = new DataModelDefinition(result); |
| 479 | 0 | programModel.setDefinition(def); |
| 480 | 0 | comparisonModel.setDefinition(def); |
| 481 | 0 | lastLoadedStatus = ProgramStatus.of(programModel); |
| 482 | 0 | afterMetadataLoaded(onReadyCallback); |
| 483 | 0 | } |
| 484 | |
|
| 485 | |
@Override |
| 486 | |
public void onFailure(Throwable caught) { |
| 487 | 0 | super.onFailure(caught); |
| 488 | 0 | onReadyCallback.exec(false); |
| 489 | 0 | } |
| 490 | |
}); |
| 491 | 0 | } |
| 492 | |
|
| 493 | |
@Override |
| 494 | |
protected void loadModel(final ModelRequestCallback<DataModel> callback) { |
| 495 | 0 | ViewContext viewContext = getViewContext(); |
| 496 | 0 | if (viewContext.getIdType() == IdType.COPY_OF_OBJECT_ID) |
| 497 | |
{ |
| 498 | 0 | ModelRequestCallback<DataModel> comparisonModelCallback = new ModelRequestCallback<DataModel>() { |
| 499 | |
@Override |
| 500 | |
public void onModelReady(DataModel model) { |
| 501 | 0 | majorDisciplineService.getData(getViewContext().getId(), new AbstractCallback<Data>(ProgramProperties.get().common_retrievingData()) { |
| 502 | |
@Override |
| 503 | |
public void onSuccess(Data result) { |
| 504 | 0 | super.onSuccess(result); |
| 505 | 0 | comparisonModel.setRoot(result); |
| 506 | 0 | reqDataModel.retrieveProgramRequirements(MajorProposalController.this, ProgramConstants.PROGRAM_MODEL_ID, new Callback<Boolean>() { |
| 507 | |
@Override |
| 508 | |
public void exec(Boolean result) { |
| 509 | 0 | if (result) { |
| 510 | 0 | reqDataModelComp.retrieveProgramRequirements(MajorProposalController.this, comparisonModelId, new Callback<Boolean>() { |
| 511 | |
@Override |
| 512 | |
public void exec(Boolean result) { |
| 513 | 0 | if (result) { |
| 514 | 0 | callback.onModelReady(comparisonModel); |
| 515 | |
} |
| 516 | 0 | } |
| 517 | |
}); |
| 518 | |
} |
| 519 | 0 | } |
| 520 | |
}); |
| 521 | 0 | } |
| 522 | |
|
| 523 | |
@Override |
| 524 | |
public void onFailure(Throwable caught) { |
| 525 | 0 | super.onFailure(caught); |
| 526 | 0 | callback.onRequestFail(caught); |
| 527 | 0 | } |
| 528 | |
}); |
| 529 | 0 | } |
| 530 | |
|
| 531 | |
@Override |
| 532 | |
public void onRequestFail(Throwable cause) { |
| 533 | 0 | GWT.log("Unable to retrieve comparison model", cause); |
| 534 | 0 | } |
| 535 | |
}; |
| 536 | |
|
| 537 | 0 | createNewVersionAndLoadModel(comparisonModelCallback, viewContext); |
| 538 | 0 | } |
| 539 | |
else |
| 540 | |
{ |
| 541 | 0 | ModelRequestCallback<DataModel> comparisonModelCallback = new ModelRequestCallback<DataModel>() { |
| 542 | |
@Override |
| 543 | |
public void onModelReady(DataModel model) { |
| 544 | 0 | programRemoteService.getData(getViewContext().getId(), new AbstractCallback<Data>(ProgramProperties.get().common_retrievingData()) { |
| 545 | |
@Override |
| 546 | |
public void onSuccess(Data result) { |
| 547 | 0 | super.onSuccess(result); |
| 548 | 0 | comparisonModel.setRoot(result); |
| 549 | 0 | reqDataModel.retrieveProgramRequirements(MajorProposalController.this, ProgramConstants.PROGRAM_MODEL_ID, new Callback<Boolean>() { |
| 550 | |
@Override |
| 551 | |
public void exec(Boolean result) { |
| 552 | 0 | if (result) { |
| 553 | 0 | reqDataModelComp.retrieveProgramRequirements(MajorProposalController.this, comparisonModelId, new Callback<Boolean>() { |
| 554 | |
@Override |
| 555 | |
public void exec(Boolean result) { |
| 556 | 0 | if (result) { |
| 557 | 0 | callback.onModelReady(comparisonModel); |
| 558 | |
} |
| 559 | 0 | } |
| 560 | |
}); |
| 561 | |
} |
| 562 | 0 | } |
| 563 | |
}); |
| 564 | 0 | } |
| 565 | |
|
| 566 | |
@Override |
| 567 | |
public void onFailure(Throwable caught) { |
| 568 | 0 | super.onFailure(caught); |
| 569 | 0 | callback.onRequestFail(caught); |
| 570 | 0 | } |
| 571 | |
}); |
| 572 | 0 | } |
| 573 | |
|
| 574 | |
@Override |
| 575 | |
public void onRequestFail(Throwable cause) { |
| 576 | 0 | GWT.log("Unable to retrieve comparison model", cause); |
| 577 | 0 | } |
| 578 | |
}; |
| 579 | |
|
| 580 | 0 | if (viewContext.getIdType() == IdType.DOCUMENT_ID) |
| 581 | 0 | loadProgramModelFromWorkflowId(comparisonModelCallback); |
| 582 | |
else |
| 583 | 0 | super.loadModel(comparisonModelCallback); |
| 584 | |
} |
| 585 | 0 | } |
| 586 | |
|
| 587 | |
protected void createNewVersionAndLoadModel(final ModelRequestCallback<DataModel> callback, final ViewContext viewContext) { |
| 588 | 0 | Data data = new Data(); |
| 589 | 0 | Data versionData = new Data(); |
| 590 | 0 | versionData.set(new Data.StringKey("versionIndId"), getViewContext().getId()); |
| 591 | 0 | versionData.set(new Data.StringKey("versionComment"), "Major Disicpline Version"); |
| 592 | 0 | data.set(new Data.StringKey("versionInfo"), versionData); |
| 593 | |
|
| 594 | 0 | programRemoteService.saveData(data, new AbstractCallback<DataSaveResult>(ProgramProperties.get().common_retrievingData()) { |
| 595 | |
@Override |
| 596 | |
public void onSuccess(DataSaveResult result) { |
| 597 | 0 | super.onSuccess(result); |
| 598 | 0 | refreshModelAndView(result); |
| 599 | 0 | viewContext.setId(ProgramUtils.getProgramId(programModel)); |
| 600 | 0 | viewContext.setIdType(IdType.OBJECT_ID); |
| 601 | 0 | callback.onModelReady(programModel); |
| 602 | 0 | eventBus.fireEvent(new ModelLoadedEvent(programModel)); |
| 603 | 0 | } |
| 604 | |
|
| 605 | |
@Override |
| 606 | |
public void onFailure(Throwable caught) { |
| 607 | 0 | super.onFailure(caught); |
| 608 | 0 | callback.onRequestFail(caught); |
| 609 | 0 | } |
| 610 | |
}); |
| 611 | |
|
| 612 | 0 | } |
| 613 | |
|
| 614 | |
protected void loadProgramModelFromWorkflowId(final ModelRequestCallback<DataModel> callback){ |
| 615 | 0 | workflowUtil.getDataIdFromWorkflowId(getViewContext().getId(), new KSAsyncCallback<String>(){ |
| 616 | |
@Override |
| 617 | |
public void handleFailure(Throwable caught) { |
| 618 | 0 | Window.alert("Error loading Proposal from Workflow Document: "+caught.getMessage()); |
| 619 | 0 | } |
| 620 | |
|
| 621 | |
@Override |
| 622 | |
public void onSuccess(String proposalId) { |
| 623 | 0 | getViewContext().setId(proposalId); |
| 624 | 0 | MajorProposalController.super.loadModel(callback); |
| 625 | 0 | } |
| 626 | |
}); |
| 627 | 0 | } |
| 628 | |
|
| 629 | |
private void doSave(final Callback<Boolean> okCallback) { |
| 630 | 0 | requestModel(new ModelRequestCallback<DataModel>() { |
| 631 | |
@Override |
| 632 | |
public void onModelReady(DataModel model) { |
| 633 | 0 | MajorProposalController.this.updateModelFromCurrentView(); |
| 634 | 0 | model.validate(new Callback<List<ValidationResultInfo>>() { |
| 635 | |
@Override |
| 636 | |
public void exec(List<ValidationResultInfo> result) { |
| 637 | 0 | boolean isSectionValid = isValid(result, true); |
| 638 | 0 | if (isSectionValid) { |
| 639 | 0 | saveData(okCallback); |
| 640 | |
} else { |
| 641 | 0 | okCallback.exec(false); |
| 642 | 0 | KSNotifier.add(new KSNotification("Unable to save, please check fields for errors.", false, true, 5000)); |
| 643 | |
} |
| 644 | 0 | } |
| 645 | |
}); |
| 646 | |
|
| 647 | 0 | } |
| 648 | |
|
| 649 | |
@Override |
| 650 | |
public void onRequestFail(Throwable cause) { |
| 651 | 0 | GWT.log("Unable to retrieve model for validation and save", cause); |
| 652 | 0 | } |
| 653 | |
}); |
| 654 | 0 | } |
| 655 | |
|
| 656 | |
private void doCancel() { |
| 657 | 0 | showView(ProgramSections.SUMMARY); |
| 658 | 0 | } |
| 659 | |
|
| 660 | |
@Override |
| 661 | |
protected void doSave() { |
| 662 | 0 | doSave(NO_OP_CALLBACK); |
| 663 | 0 | } |
| 664 | |
|
| 665 | |
private void saveData(final Callback<Boolean> okCallback) { |
| 666 | 0 | programRemoteService.saveData(programModel.getRoot(), new AbstractCallback<DataSaveResult>(ProgramProperties.get().common_savingData()) { |
| 667 | |
@Override |
| 668 | |
public void onSuccess(DataSaveResult result) { |
| 669 | 0 | super.onSuccess(result); |
| 670 | |
|
| 671 | |
|
| 672 | 0 | clearAllWarnings(); |
| 673 | 0 | Application.getApplicationContext().clearValidationWarnings(); |
| 674 | |
|
| 675 | 0 | List<ValidationResultInfo> validationResults = result.getValidationResults(); |
| 676 | 0 | Application.getApplicationContext().addValidationWarnings(validationResults); |
| 677 | 0 | if (ValidatorClientUtils.hasErrors(validationResults)) { |
| 678 | 0 | ProgramUtils.retrofitValidationResults(validationResults); |
| 679 | 0 | isValid(validationResults, false, true); |
| 680 | 0 | ProgramUtils.handleValidationErrorsForSpecializations(validationResults, programModel); |
| 681 | |
|
| 682 | |
|
| 683 | 0 | Data currentVariations = getDataProperty(ProgramConstants.VARIATIONS); |
| 684 | |
|
| 685 | 0 | existingVariationIds.clear(); |
| 686 | |
|
| 687 | 0 | for (Iterator<Property> iter = currentVariations.iterator();iter.hasNext();) { |
| 688 | 0 | Property prop = iter.next(); |
| 689 | 0 | String existingId = (String) ((Data) prop.getValue()).get(ProgramConstants.ID); |
| 690 | 0 | if(existingId==null){ |
| 691 | 0 | iter.remove(); |
| 692 | |
}else{ |
| 693 | 0 | existingVariationIds.add(existingId); |
| 694 | |
} |
| 695 | 0 | } |
| 696 | |
|
| 697 | 0 | okCallback.exec(false); |
| 698 | 0 | } else { |
| 699 | 0 | resetFieldInteractionFlag(); |
| 700 | 0 | configurer.applyPermissions(); |
| 701 | 0 | handleSpecializations(); |
| 702 | 0 | throwAfterSaveEvent(); |
| 703 | 0 | HistoryManager.logHistoryChange(); |
| 704 | 0 | ViewContext viewContext = getViewContext(); |
| 705 | 0 | viewContext.setId(getStringProperty(ProgramConstants.ID)); |
| 706 | 0 | viewContext.setIdType(IdType.OBJECT_ID); |
| 707 | |
|
| 708 | 0 | if (ValidatorClientUtils.hasWarnings(validationResults)){ |
| 709 | |
|
| 710 | 0 | isValid(result.getValidationResults(), false, true); |
| 711 | 0 | KSNotifier.show("Saved with Warnings"); |
| 712 | |
} else { |
| 713 | 0 | KSNotifier.show(ProgramProperties.get().common_successfulSave()); |
| 714 | |
} |
| 715 | |
|
| 716 | |
|
| 717 | 0 | ViewContext docContext = new ViewContext(); |
| 718 | 0 | docContext.setId(getStringProperty(ProgramConstants.ID)); |
| 719 | 0 | docContext.setIdType(IdType.OBJECT_ID); |
| 720 | 0 | docContext.setAttribute(ProgramConstants.TYPE, ProgramConstants.MAJOR_LU_TYPE_ID + '/' + ProgramSections.PROGRAM_DETAILS_VIEW); |
| 721 | 0 | RecentlyViewedHelper.addDocument(getProgramName(), |
| 722 | |
HistoryManager.appendContext(AppLocations.Locations.VIEW_PROGRAM.getLocation(), docContext)); |
| 723 | |
|
| 724 | 0 | majorDisciplineService.getData(getViewContext().getId(), new AbstractCallback<Data>(ProgramProperties.get().common_retrievingData()) { |
| 725 | |
|
| 726 | |
@Override |
| 727 | |
public void onFailure(Throwable caught) { |
| 728 | 0 | super.onFailure(caught); |
| 729 | 0 | okCallback.exec(false); |
| 730 | 0 | } |
| 731 | |
|
| 732 | |
@Override |
| 733 | |
public void onSuccess(Data result) { |
| 734 | 0 | super.onSuccess(result); |
| 735 | 0 | if (result != null) { |
| 736 | 0 | programModel.setRoot(result); |
| 737 | |
} |
| 738 | 0 | setHeaderTitle(); |
| 739 | 0 | setStatus(); |
| 740 | 0 | reqDataModel.retrieveProgramRequirements(MajorProposalController.this, ProgramConstants.PROGRAM_MODEL_ID, new Callback<Boolean>() { |
| 741 | |
@Override |
| 742 | |
public void exec(Boolean result) { |
| 743 | 0 | okCallback.exec(true); |
| 744 | 0 | processCurrentView(); |
| 745 | 0 | } |
| 746 | |
}); |
| 747 | 0 | } |
| 748 | |
}); |
| 749 | |
} |
| 750 | 0 | } |
| 751 | |
}); |
| 752 | 0 | } |
| 753 | |
|
| 754 | |
private void processCurrentView() { |
| 755 | 0 | Enum<?> currentView = getCurrentViewEnum(); |
| 756 | 0 | if (currentView.name().equals(ProgramSections.VIEW_ALL.name())) { |
| 757 | 0 | HistoryManager.navigate(AppLocations.Locations.VIEW_PROGRAM.getLocation(), getViewContext()); |
| 758 | |
} else { |
| 759 | 0 | showView(currentView); |
| 760 | |
} |
| 761 | 0 | } |
| 762 | |
|
| 763 | |
|
| 764 | |
|
| 765 | |
|
| 766 | |
private void handleSpecializations() { |
| 767 | 0 | String newVariationId = null; |
| 768 | 0 | Data variations = programModel.get(ProgramConstants.VARIATIONS); |
| 769 | 0 | for (Data.Property prop : variations) { |
| 770 | 0 | String varId = (String) ((Data) prop.getValue()).get(ProgramConstants.ID); |
| 771 | 0 | if (!existingVariationIds.contains(varId)) { |
| 772 | 0 | newVariationId = varId; |
| 773 | 0 | existingVariationIds.add(newVariationId); |
| 774 | 0 | break; |
| 775 | |
} |
| 776 | 0 | } |
| 777 | 0 | if (newVariationId != null) { |
| 778 | 0 | eventBus.fireEvent(new SpecializationCreatedEvent(newVariationId)); |
| 779 | |
} else { |
| 780 | 0 | eventBus.fireEvent(new SpecializationUpdateEvent(variations)); |
| 781 | |
} |
| 782 | 0 | } |
| 783 | |
|
| 784 | |
private void throwAfterSaveEvent() { |
| 785 | 0 | eventBus.fireEvent(new AfterSaveEvent(programModel, this)); |
| 786 | 0 | } |
| 787 | |
|
| 788 | |
@Override |
| 789 | |
public void onModelLoadedEvent() { |
| 790 | 0 | Enum<?> changeSection = ProgramRegistry.getSection(); |
| 791 | 0 | if (changeSection != null) { |
| 792 | 0 | showView(changeSection); |
| 793 | 0 | ProgramRegistry.setSection(null); |
| 794 | |
} else { |
| 795 | 0 | String id = getStringProperty(ProgramConstants.ID); |
| 796 | 0 | if (id == null) { |
| 797 | 0 | showView(ProgramSections.PROGRAM_DETAILS_EDIT); |
| 798 | |
} else { |
| 799 | 0 | showView(ProgramSections.PROGRAM_PROPOSAL_EDIT); |
| 800 | |
} |
| 801 | |
} |
| 802 | |
|
| 803 | 0 | } |
| 804 | |
|
| 805 | |
@Override |
| 806 | |
public void beforeShow(final Callback<Boolean> onReadyCallback) { |
| 807 | 0 | if(!initialized){ |
| 808 | 0 | Application.getApplicationContext().clearCrossConstraintMap(null); |
| 809 | 0 | Application.getApplicationContext().clearPathToFieldMapping(null); |
| 810 | |
} |
| 811 | |
|
| 812 | 0 | Application.getApplicationContext().setParentPath(""); |
| 813 | 0 | super.beforeShow(onReadyCallback); |
| 814 | 0 | } |
| 815 | |
|
| 816 | |
|
| 817 | |
|
| 818 | |
@Override |
| 819 | |
public <V extends Enum<?>> void showView(V viewType, |
| 820 | |
final Callback<Boolean> onReadyCallback) { |
| 821 | 0 | Callback<Boolean> updateCrossConstraintsCallback = new Callback<Boolean>(){ |
| 822 | |
public void exec(Boolean result) { |
| 823 | 0 | onReadyCallback.exec(result); |
| 824 | 0 | for(HasCrossConstraints crossConstraint:Application.getApplicationContext().getCrossConstraints(null)){ |
| 825 | 0 | crossConstraint.reprocessWithUpdatedConstraints(); |
| 826 | |
} |
| 827 | 0 | showWarnings(); |
| 828 | 0 | } |
| 829 | |
}; |
| 830 | 0 | super.showView(viewType, updateCrossConstraintsCallback); |
| 831 | 0 | } |
| 832 | |
|
| 833 | |
|
| 834 | |
@Override |
| 835 | |
public void beforeViewChange(final Enum<?> viewChangingTo, final Callback<Boolean> okToChangeCallback){ |
| 836 | 0 | final Callback<Boolean> reallyOkToChange = new Callback<Boolean>() { |
| 837 | |
|
| 838 | |
@Override |
| 839 | |
public void exec(Boolean result) { |
| 840 | 0 | if (result) { |
| 841 | 0 | if (LUMViews.VARIATION_EDIT.equals(viewChangingTo)) { |
| 842 | 0 | getView(ProgramSections.MANAGE_BODIES_EDIT, new Callback<View>() { |
| 843 | |
@Override |
| 844 | |
public void exec(final View view) { |
| 845 | 0 | if (view != null && view instanceof SectionView) { |
| 846 | 0 | requestModel(new ModelRequestCallback<DataModel>() { |
| 847 | |
public void onModelReady(DataModel model) { |
| 848 | 0 | ((SectionView) view).updateWidgetData(model); |
| 849 | 0 | okToChangeCallback.exec(true); |
| 850 | 0 | } |
| 851 | |
|
| 852 | |
public void onRequestFail(Throwable cause) { |
| 853 | 0 | okToChangeCallback.exec(false); |
| 854 | 0 | } |
| 855 | |
}); |
| 856 | |
} else { |
| 857 | 0 | okToChangeCallback.exec(true); |
| 858 | |
} |
| 859 | 0 | } |
| 860 | |
}); |
| 861 | |
} else { |
| 862 | 0 | okToChangeCallback.exec(true); |
| 863 | |
} |
| 864 | |
} |
| 865 | 0 | } |
| 866 | |
}; |
| 867 | 0 | super.beforeViewChange(viewChangingTo, reallyOkToChange); |
| 868 | 0 | this.showExport(isExportButtonActive()); |
| 869 | 0 | } |
| 870 | |
|
| 871 | |
protected void setStatus() { |
| 872 | 0 | String modelProposalId = programModel.get(QueryPath.parse(proposalPath + "/id")); |
| 873 | |
|
| 874 | 0 | if (modelProposalId != null && !modelProposalId.isEmpty()) { |
| 875 | 0 | String workflowId = programModel.get(QueryPath.parse(proposalPath + "/workflowId")); |
| 876 | 0 | proposalServiceAsync.getProposalByWorkflowId(workflowId, new KSAsyncCallback<ProposalInfo>() { |
| 877 | |
@Override |
| 878 | |
public void handleFailure(Throwable caught) { |
| 879 | 0 | statusLabel.setText("Proposal status: Unknown"); |
| 880 | 0 | } |
| 881 | |
|
| 882 | |
@Override |
| 883 | |
public void onSuccess(ProposalInfo result) { |
| 884 | 0 | statusLabel.setText("Proposal status: " + result.getState()); |
| 885 | 0 | } |
| 886 | |
}); |
| 887 | |
} |
| 888 | 0 | } |
| 889 | |
|
| 890 | |
public ProgramRequirementsDataModel getReqDataModel() { |
| 891 | 0 | return reqDataModel; |
| 892 | |
} |
| 893 | |
|
| 894 | |
public ProgramRequirementsDataModel getReqDataModelComp() { |
| 895 | 0 | return reqDataModelComp; |
| 896 | |
} |
| 897 | |
|
| 898 | |
@Override |
| 899 | |
public void getMetadataForFinalState(final KSAsyncCallback<Metadata> callback) { |
| 900 | |
|
| 901 | 0 | String idType = null; |
| 902 | 0 | String viewContextId = ""; |
| 903 | 0 | if(getViewContext().getIdType() != null){ |
| 904 | 0 | idType = getViewContext().getIdType().toString(); |
| 905 | 0 | viewContextId = getViewContext().getId(); |
| 906 | 0 | if(getViewContext().getIdType()==IdAttributes.IdType.COPY_OF_OBJECT_ID){ |
| 907 | 0 | viewContextId = null; |
| 908 | |
} |
| 909 | |
} |
| 910 | 0 | HashMap<String, String> idAttributes = new HashMap<String, String>(); |
| 911 | 0 | if(idType != null){ |
| 912 | 0 | idAttributes.put(IdAttributes.ID_TYPE, idType); |
| 913 | |
} |
| 914 | |
|
| 915 | 0 | idAttributes.put(StudentIdentityConstants.DOCUMENT_TYPE_NAME, "kuali.proposal.type.majorDiscipline.modify"); |
| 916 | 0 | idAttributes.put(DtoConstants.DTO_STATE, "Draft"); |
| 917 | 0 | idAttributes.put(DtoConstants.DTO_NEXT_STATE, "Active"); |
| 918 | 0 | idAttributes.put(DtoConstants.DTO_WORKFLOW_NODE, "Publication Review"); |
| 919 | |
|
| 920 | |
|
| 921 | 0 | programRemoteService.getMetadata(viewContextId, idAttributes, new KSAsyncCallback<Metadata>(){ |
| 922 | |
@Override |
| 923 | |
public void onSuccess(Metadata metadata) { |
| 924 | |
|
| 925 | 0 | metadata.getProperties().remove("orgCoreProgram"); |
| 926 | 0 | callback.onSuccess(metadata); |
| 927 | 0 | } |
| 928 | |
}); |
| 929 | 0 | } |
| 930 | |
} |