1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
package org.kuali.student.core.workflow.ui.client.widgets; |
16 | |
|
17 | |
import java.util.ArrayList; |
18 | |
import java.util.List; |
19 | |
|
20 | |
import org.kuali.student.common.assembly.data.QueryPath; |
21 | |
import org.kuali.student.common.dto.RichTextInfo; |
22 | |
import org.kuali.student.common.dto.DtoConstants.DtoState; |
23 | |
import org.kuali.student.common.ui.client.application.Application; |
24 | |
import org.kuali.student.common.ui.client.application.KSAsyncCallback; |
25 | |
import org.kuali.student.common.ui.client.configurable.mvc.LayoutController; |
26 | |
import org.kuali.student.common.ui.client.configurable.mvc.SectionTitle; |
27 | |
import org.kuali.student.common.ui.client.event.SaveActionEvent; |
28 | |
import org.kuali.student.common.ui.client.mvc.Callback; |
29 | |
import org.kuali.student.common.ui.client.mvc.DataModel; |
30 | |
import org.kuali.student.common.ui.client.mvc.ModelRequestCallback; |
31 | |
import org.kuali.student.common.ui.client.widgets.KSDropDown; |
32 | |
import org.kuali.student.common.ui.client.widgets.KSLabel; |
33 | |
import org.kuali.student.common.ui.client.widgets.KSLightBox; |
34 | |
import org.kuali.student.common.ui.client.widgets.KSRichEditor; |
35 | |
import org.kuali.student.common.ui.client.widgets.StylishDropDown; |
36 | |
import org.kuali.student.common.ui.client.widgets.KSButtonAbstract.ButtonStyle; |
37 | |
import org.kuali.student.common.ui.client.widgets.buttongroups.AcknowledgeCancelGroup; |
38 | |
import org.kuali.student.common.ui.client.widgets.buttongroups.ConfirmApprovalCancelGroup; |
39 | |
import org.kuali.student.common.ui.client.widgets.buttongroups.ConfirmCancelGroup; |
40 | |
import org.kuali.student.common.ui.client.widgets.buttongroups.RejectCancelGroup; |
41 | |
import org.kuali.student.common.ui.client.widgets.buttongroups.ButtonEnumerations.AcknowledgeCancelEnum; |
42 | |
import org.kuali.student.common.ui.client.widgets.buttongroups.ButtonEnumerations.ConfirmApprovalCancelEnum; |
43 | |
import org.kuali.student.common.ui.client.widgets.buttongroups.ButtonEnumerations.ConfirmCancelEnum; |
44 | |
import org.kuali.student.common.ui.client.widgets.buttongroups.ButtonEnumerations.RejectCancelEnum; |
45 | |
import org.kuali.student.common.ui.client.widgets.dialog.ConfirmationDialog; |
46 | |
import org.kuali.student.common.ui.client.widgets.field.layout.element.AbbrPanel; |
47 | |
import org.kuali.student.common.ui.client.widgets.list.impl.SimpleListItems; |
48 | |
import org.kuali.student.common.ui.client.widgets.menus.KSMenuItemData; |
49 | |
import org.kuali.student.common.ui.client.widgets.notification.KSNotification; |
50 | |
import org.kuali.student.common.ui.client.widgets.notification.KSNotifier; |
51 | |
import org.kuali.student.common.validation.dto.ValidationResultInfo; |
52 | |
import org.kuali.student.core.comment.dto.CommentInfo; |
53 | |
import org.kuali.student.core.comments.ui.client.service.CommentRpcService; |
54 | |
import org.kuali.student.core.comments.ui.client.service.CommentRpcServiceAsync; |
55 | |
import org.kuali.student.core.workflow.ui.client.WorkflowConstants; |
56 | |
import org.kuali.student.core.workflow.ui.client.service.WorkflowRpcService; |
57 | |
import org.kuali.student.core.workflow.ui.client.service.WorkflowRpcServiceAsync; |
58 | |
|
59 | |
import com.google.gwt.core.client.GWT; |
60 | |
import com.google.gwt.event.dom.client.ClickEvent; |
61 | |
import com.google.gwt.event.dom.client.ClickHandler; |
62 | |
import com.google.gwt.user.client.Window; |
63 | |
import com.google.gwt.user.client.rpc.AsyncCallback; |
64 | |
import com.google.gwt.user.client.ui.VerticalPanel; |
65 | |
import com.google.gwt.user.client.ui.Widget; |
66 | |
|
67 | 0 | public class WorkflowUtilities{ |
68 | |
|
69 | |
|
70 | |
public static final String PROPOSAL_REF_TYPE_KEY = "referenceType.clu.proposal"; |
71 | |
|
72 | 0 | public static enum DecisionRationaleDetail { |
73 | 0 | APPROVE("kuali.comment.type.workflowDecisionRationale.approve", "Approved"), |
74 | 0 | REJECT("kuali.comment.type.workflowDecisionRationale.reject", "Rejected"), |
75 | 0 | RETURN_TO_PREVIOUS("kuali.comment.type.workflowDecisionRationale.return", "Sent for Revisions"), |
76 | 0 | WITHDRAW("kuali.comment.type.workflowDecisionRationale.withdraw", "Withdrawn"), |
77 | 0 | ACKNOWLEDGE("kuali.comment.type.workflowDecisionRationale.acknowledge", "Acknowledged"), |
78 | 0 | FYI("kuali.comment.type.workflowDecisionRationale.fyi", "FYI"), |
79 | 0 | CANCEL_WORKFLOW("kuali.comment.type.workflowDecisionRationale.cancelWorkflow", "Cancelled"), |
80 | 0 | BLANKET_APPROVE("kuali.comment.type.workflowDecisionRationale.blanketApprove", "Blanket Approved") |
81 | |
; |
82 | |
|
83 | 0 | private String type = ""; |
84 | 0 | private String label = ""; |
85 | |
|
86 | 0 | private DecisionRationaleDetail(String type, String label) { |
87 | 0 | this.type = type; |
88 | 0 | this.label = label; |
89 | 0 | } |
90 | |
|
91 | |
public String getType() { |
92 | 0 | return type; |
93 | |
} |
94 | |
|
95 | |
public String getLabel() { |
96 | 0 | return label; |
97 | |
} |
98 | |
|
99 | |
public static DecisionRationaleDetail getByType(String type) { |
100 | 0 | for (DecisionRationaleDetail detail : DecisionRationaleDetail.values()) { |
101 | 0 | if (detail.getType().equals(type)) { |
102 | 0 | return detail; |
103 | |
} |
104 | |
} |
105 | 0 | return null; |
106 | |
} |
107 | |
|
108 | |
} |
109 | |
|
110 | 0 | DataModel dataModel=null; |
111 | |
|
112 | 0 | boolean loaded=false; |
113 | |
|
114 | 0 | private boolean workflowWidgetsEnabled = true; |
115 | |
|
116 | |
private KSMenuItemData wfApproveItem; |
117 | |
private KSMenuItemData wfDisApproveItem; |
118 | |
private KSMenuItemData wfAcknowledgeItem; |
119 | |
private KSMenuItemData wfStartWorkflowItem; |
120 | |
private KSMenuItemData wfCancelWorkflowItem; |
121 | |
private KSMenuItemData wfFYIWorkflowItem; |
122 | |
private KSMenuItemData wfWithdrawItem; |
123 | |
private KSMenuItemData wfReturnToPreviousItem; |
124 | |
private KSMenuItemData wfBlanketApproveItem; |
125 | |
|
126 | 0 | private final List<KSMenuItemData> items = new ArrayList<KSMenuItemData>(); |
127 | |
|
128 | |
SaveActionEvent approveSaveActionEvent; |
129 | |
SaveActionEvent startWorkflowSaveActionEvent; |
130 | |
|
131 | 0 | WorkflowRpcServiceAsync workflowRpcServiceAsync = GWT.create(WorkflowRpcService.class); |
132 | 0 | private final CommentRpcServiceAsync commentServiceAsync = GWT.create(CommentRpcService.class); |
133 | |
|
134 | |
private String modelName; |
135 | |
private String proposalPath; |
136 | 0 | private String proposalId = ""; |
137 | |
private String workflowId; |
138 | 0 | private String proposalName=""; |
139 | 0 | private String workflowActions=""; |
140 | |
|
141 | 0 | private final List<StylishDropDown> workflowWidgets = new ArrayList<StylishDropDown>(); |
142 | |
private Callback<Boolean> submitCallback; |
143 | 0 | private final ConfirmationDialog dialog = new ConfirmationDialog("Submit Proposal", "Are you sure you want to submit the proposal to workflow?", "Submit"); |
144 | |
private AbbrPanel required; |
145 | |
private KSLightBox submitSuccessDialog; |
146 | |
private VerticalPanel dialogPanel; |
147 | |
|
148 | 0 | private final KSLabel workflowStatusLabel = new KSLabel(""); |
149 | |
|
150 | |
private final LayoutController parentController; |
151 | |
|
152 | 0 | public WorkflowUtilities(LayoutController parentController, String proposalPath) { |
153 | 0 | this.parentController = parentController; |
154 | 0 | this.proposalPath = proposalPath; |
155 | 0 | setupWFButtons(); |
156 | 0 | setupDialog(); |
157 | 0 | } |
158 | |
|
159 | |
public void requestAndSetupModel() { |
160 | |
|
161 | 0 | if(null==dataModel){ |
162 | |
|
163 | 0 | parentController.requestModel(modelName, new ModelRequestCallback<DataModel>() { |
164 | |
|
165 | |
@Override |
166 | |
public void onRequestFail(Throwable cause) { |
167 | 0 | Window.alert("Model Request Failed. "+cause.getMessage()); |
168 | 0 | } |
169 | |
|
170 | |
@Override |
171 | |
public void onModelReady(DataModel model) { |
172 | |
|
173 | 0 | dataModel = model; |
174 | 0 | updateWorkflow(dataModel); |
175 | 0 | } |
176 | |
}); |
177 | |
}else{ |
178 | |
|
179 | |
|
180 | 0 | updateWorkflow(dataModel); |
181 | |
} |
182 | 0 | } |
183 | |
|
184 | |
private void setupWFButtons() { |
185 | 0 | wfApproveItem = getApproveItem(); |
186 | 0 | wfDisApproveItem = getDisApproveItem(); |
187 | 0 | wfAcknowledgeItem = getAcknowledgeItem(); |
188 | 0 | wfStartWorkflowItem = getStartItem(); |
189 | 0 | wfCancelWorkflowItem = getCancelWorkflowItem(); |
190 | 0 | wfFYIWorkflowItem = getFYIWorkflowItem(); |
191 | 0 | wfWithdrawItem = getWithdrawItem(); |
192 | 0 | wfReturnToPreviousItem = getReturnToPreviousItem(); |
193 | 0 | wfBlanketApproveItem = getBlanketApproveItem(); |
194 | 0 | } |
195 | |
|
196 | |
private void setupSubmitSuccessDialog(){ |
197 | 0 | if(submitSuccessDialog==null){ |
198 | 0 | submitSuccessDialog= new KSLightBox(); |
199 | 0 | submitSuccessDialog.setSize(580, 400); |
200 | 0 | dialogPanel = new VerticalPanel(); |
201 | 0 | submitSuccessDialog.setWidget(dialogPanel); |
202 | |
|
203 | |
} |
204 | |
|
205 | 0 | } |
206 | |
|
207 | |
private void setupDialog(){ |
208 | |
|
209 | 0 | dialog.getConfirmButton().addClickHandler(new ClickHandler(){ |
210 | |
|
211 | |
@Override |
212 | |
public void onClick(ClickEvent event) { |
213 | 0 | dialog.getConfirmButton().setEnabled(false); |
214 | 0 | workflowRpcServiceAsync.submitDocumentWithId(workflowId, new KSAsyncCallback<Boolean>(){ |
215 | |
@Override |
216 | |
public void handleFailure(Throwable caught) { |
217 | 0 | Window.alert("Error starting Proposal workflow"); |
218 | 0 | dialog.getConfirmButton().setEnabled(true); |
219 | 0 | } |
220 | |
public void onSuccess(Boolean result) { |
221 | 0 | if (result){ |
222 | 0 | updateWorkflow(dataModel); |
223 | 0 | dialog.hide(); |
224 | 0 | dialog.getConfirmButton().setEnabled(true); |
225 | 0 | if(submitCallback != null){ |
226 | 0 | submitCallback.exec(true); |
227 | |
} |
228 | |
|
229 | 0 | KSNotifier.add(new KSNotification("Proposal has been routed to workflow", false)); |
230 | |
} else { |
231 | 0 | Window.alert("Error starting Proposal workflow"); |
232 | |
} |
233 | 0 | } |
234 | |
}); |
235 | |
|
236 | 0 | } |
237 | |
}); |
238 | 0 | } |
239 | |
|
240 | |
public Widget getWorkflowActionsWidget(){ |
241 | |
|
242 | 0 | StylishDropDown workflowActionsDropDown = new StylishDropDown("Workflow Actions"); |
243 | 0 | workflowActionsDropDown.makeAButtonWhenOneItem(true); |
244 | 0 | workflowActionsDropDown.addStyleName("KS-Workflow-DropDown"); |
245 | 0 | workflowWidgets.add(workflowActionsDropDown); |
246 | 0 | workflowActionsDropDown.setVisible(false); |
247 | 0 | updateWorkflow(dataModel); |
248 | |
|
249 | |
|
250 | |
|
251 | |
|
252 | 0 | return workflowActionsDropDown; |
253 | |
} |
254 | |
|
255 | |
public void enableWorkflowActionsWidgets(boolean enable) { |
256 | 0 | workflowWidgetsEnabled = enable; |
257 | 0 | updateWorkflowActionsWidget(); |
258 | 0 | } |
259 | |
|
260 | |
public void doValidationCheck(Callback<List<ValidationResultInfo>> callback){ |
261 | 0 | dataModel.validateNextState(callback); |
262 | 0 | } |
263 | |
|
264 | |
public KSLabel getWorkflowStatusLabel(){ |
265 | 0 | return workflowStatusLabel; |
266 | |
} |
267 | |
|
268 | |
private void updateWorkflowIdFromModel(final DataModel model){ |
269 | 0 | if(model!=null){ |
270 | 0 | String modelProposalId = model.get(QueryPath.parse(proposalPath + "/id")); |
271 | |
|
272 | |
|
273 | 0 | if (modelProposalId != null && !modelProposalId.isEmpty() && !modelProposalId.equals(proposalId)){ |
274 | 0 | proposalId = modelProposalId; |
275 | 0 | workflowId = model.get(QueryPath.parse(proposalPath + "/workflowId")); |
276 | 0 | proposalName = model.get(QueryPath.parse(proposalPath + "/name")); |
277 | |
} |
278 | |
} |
279 | 0 | } |
280 | |
|
281 | |
private void updateWorkflow(DataModel model){ |
282 | 0 | updateWorkflowIdFromModel(model); |
283 | |
|
284 | 0 | if (workflowId != null && !workflowId.isEmpty()){ |
285 | |
|
286 | 0 | workflowRpcServiceAsync.getActionsRequested(workflowId, new KSAsyncCallback<String>(){ |
287 | |
|
288 | |
public void onSuccess(String result) { |
289 | 0 | workflowActions = result; |
290 | 0 | updateWorkflowActionsWidget(); |
291 | 0 | } |
292 | |
}); |
293 | |
|
294 | 0 | workflowRpcServiceAsync.getDocumentStatus(workflowId, new KSAsyncCallback<String>(){ |
295 | |
@Override |
296 | |
public void handleFailure(Throwable caught) { |
297 | 0 | workflowStatusLabel.setText("Status: Unknown"); |
298 | 0 | } |
299 | |
|
300 | |
@Override |
301 | |
public void onSuccess(String result) { |
302 | 0 | setWorkflowStatus(result); |
303 | 0 | } |
304 | |
}); |
305 | |
} else { |
306 | 0 | workflowStatusLabel.setText("Status: Draft"); |
307 | |
} |
308 | 0 | } |
309 | |
|
310 | |
private void updateWorkflowActionsWidget(){ |
311 | 0 | items.clear(); |
312 | |
|
313 | |
|
314 | |
|
315 | 0 | if (workflowWidgetsEnabled){ |
316 | 0 | if(workflowActions.contains("S")){ |
317 | 0 | items.add(wfStartWorkflowItem); |
318 | |
} |
319 | 0 | if(workflowActions.contains("C")){ |
320 | 0 | items.add(wfCancelWorkflowItem); |
321 | |
} |
322 | 0 | if(workflowActions.contains("A")){ |
323 | 0 | items.add(wfApproveItem); |
324 | 0 | items.add(wfDisApproveItem); |
325 | |
} |
326 | 0 | if(workflowActions.contains("K")){ |
327 | 0 | items.add(wfAcknowledgeItem); |
328 | |
} |
329 | 0 | if(workflowActions.contains("F")){ |
330 | 0 | items.add(wfFYIWorkflowItem); |
331 | |
} |
332 | 0 | if(workflowActions.contains("R")){ |
333 | 0 | items.add(wfReturnToPreviousItem); |
334 | |
} |
335 | 0 | if(workflowActions.contains("B")){ |
336 | 0 | items.add(wfBlanketApproveItem); |
337 | |
} |
338 | 0 | if(workflowActions.contains("W")){ |
339 | 0 | items.add(wfWithdrawItem); |
340 | |
} |
341 | |
} else { |
342 | 0 | if(workflowActions.contains("C")){ |
343 | 0 | items.add(wfCancelWorkflowItem); |
344 | |
} |
345 | 0 | if(workflowActions.contains("W")){ |
346 | 0 | items.add(wfWithdrawItem); |
347 | |
} |
348 | |
} |
349 | 0 | for(StylishDropDown widget: workflowWidgets){ |
350 | |
|
351 | 0 | widget.setItems(items); |
352 | 0 | widget.setEnabled(true); |
353 | 0 | if(items.isEmpty()){ |
354 | 0 | widget.setVisible(false); |
355 | |
} |
356 | |
else{ |
357 | 0 | widget.setVisible(true); |
358 | |
} |
359 | |
} |
360 | 0 | } |
361 | |
|
362 | |
private KSMenuItemData getFYIWorkflowItem() { |
363 | |
KSMenuItemData wfFYIWorkflowItem; |
364 | 0 | final KSRichEditor rationaleEditor = new KSRichEditor(); |
365 | 0 | wfFYIWorkflowItem = new KSMenuItemData("FYI Proposal", new ClickHandler(){ |
366 | |
public void onClick(ClickEvent event) { |
367 | 0 | addRationale(rationaleEditor,DecisionRationaleDetail.FYI.getType()); |
368 | 0 | workflowRpcServiceAsync.fyiDocumentWithId(workflowId, new KSAsyncCallback<Boolean>(){ |
369 | |
@Override |
370 | |
public void handleFailure(Throwable caught) { |
371 | 0 | Window.alert("Error FYIing Proposal"); |
372 | 0 | } |
373 | |
public void onSuccess( |
374 | |
Boolean result) { |
375 | 0 | if(result){ |
376 | 0 | updateWorkflow(dataModel); |
377 | 0 | if(submitCallback != null){ |
378 | 0 | submitCallback.exec(true); |
379 | |
} |
380 | |
|
381 | 0 | KSNotifier.add(new KSNotification("Proposal was FYIed", false)); |
382 | |
}else{ |
383 | 0 | Window.alert("Error FYIing Proposal"); |
384 | |
} |
385 | 0 | } |
386 | |
|
387 | |
}); |
388 | 0 | } |
389 | |
}); |
390 | 0 | return wfFYIWorkflowItem; |
391 | |
} |
392 | |
|
393 | |
private KSMenuItemData getAcknowledgeItem() { |
394 | |
KSMenuItemData wfAcknowledgeItem; |
395 | 0 | wfAcknowledgeItem = new KSMenuItemData("Acknowledge Proposal", new ClickHandler(){ |
396 | |
public void onClick(ClickEvent event) { |
397 | 0 | setupSubmitSuccessDialog(); |
398 | 0 | final KSRichEditor rationaleEditor = new KSRichEditor(); |
399 | 0 | AcknowledgeCancelGroup approvalButton = new AcknowledgeCancelGroup(new Callback<AcknowledgeCancelEnum>(){ |
400 | |
|
401 | |
@Override |
402 | |
public void exec(AcknowledgeCancelEnum result) { |
403 | 0 | if(!result.name().equals("CANCEL")){ |
404 | 0 | addRationale(rationaleEditor,DecisionRationaleDetail.ACKNOWLEDGE.getType()); |
405 | 0 | workflowRpcServiceAsync.acknowledgeDocumentWithId(workflowId, new KSAsyncCallback<Boolean>(){ |
406 | |
@Override |
407 | |
public void handleFailure(Throwable caught) { |
408 | 0 | submitSuccessDialog.hide(); |
409 | 0 | Window.alert("Error acknowledging Proposal"); |
410 | 0 | } |
411 | |
public void onSuccess(Boolean result) { |
412 | 0 | submitSuccessDialog.hide(); |
413 | 0 | if(result){ |
414 | 0 | updateWorkflow(dataModel); |
415 | 0 | if(submitCallback != null){ |
416 | 0 | submitCallback.exec(true); |
417 | |
} |
418 | |
|
419 | 0 | KSNotifier.add(new KSNotification("Proposal was acknowledged", false)); |
420 | |
}else{ |
421 | 0 | Window.alert("Error acknowledging Proposal"); |
422 | |
} |
423 | 0 | } |
424 | |
}); |
425 | |
} |
426 | |
else{ |
427 | 0 | submitSuccessDialog.hide(); |
428 | |
} |
429 | 0 | } |
430 | |
}); |
431 | |
|
432 | 0 | SectionTitle headerTitle = SectionTitle.generateH3Title("Acknowledge Proposal"); |
433 | 0 | SectionTitle dialogLabel = SectionTitle.generateH4Title("You are acknowledging the " + proposalName +" proposal"); |
434 | 0 | SectionTitle fieldLabel = SectionTitle.generateH4Title("Decision Rationale"); |
435 | 0 | rationaleEditor.addStyleName("KS-Comment-Create-Editor"); |
436 | 0 | dialogPanel.clear(); |
437 | 0 | dialogPanel.add(headerTitle); |
438 | 0 | dialogPanel.add(dialogLabel); |
439 | 0 | dialogPanel.add(fieldLabel); |
440 | 0 | dialogPanel.add(rationaleEditor); |
441 | 0 | dialogPanel.add(approvalButton); |
442 | 0 | submitSuccessDialog.show(); |
443 | 0 | } |
444 | |
}); |
445 | 0 | return wfAcknowledgeItem; |
446 | |
} |
447 | |
|
448 | |
private KSMenuItemData getDisApproveItem() { |
449 | |
KSMenuItemData wfDisApproveItem; |
450 | 0 | wfDisApproveItem = new KSMenuItemData("Reject Proposal", new ClickHandler(){ |
451 | |
public void onClick(ClickEvent event) { |
452 | 0 | setupSubmitSuccessDialog(); |
453 | 0 | final KSRichEditor rationaleEditor = new KSRichEditor(); |
454 | 0 | RejectCancelGroup disapprovalButton = new RejectCancelGroup(new Callback<RejectCancelEnum>(){ |
455 | |
|
456 | |
@Override |
457 | |
public void exec(RejectCancelEnum result) { |
458 | 0 | if(!result.name().equals("CANCEL")){ |
459 | 0 | if(rationaleEditor.getText().trim().equals("")){ |
460 | 0 | required.setText("Please enter the decision rationale"); |
461 | |
} |
462 | |
else{ |
463 | 0 | addRationale(rationaleEditor,DecisionRationaleDetail.REJECT.getType()); |
464 | 0 | workflowRpcServiceAsync.disapproveDocumentWithId(workflowId, new KSAsyncCallback<Boolean>(){ |
465 | |
@Override |
466 | |
public void handleFailure(Throwable caught) { |
467 | 0 | submitSuccessDialog.hide(); |
468 | 0 | Window.alert("Error rejecting Proposal"); |
469 | 0 | } |
470 | |
public void onSuccess(Boolean result) { |
471 | 0 | submitSuccessDialog.hide(); |
472 | 0 | if(submitCallback != null){ |
473 | 0 | submitCallback.exec(result); |
474 | |
} |
475 | 0 | if(result){ |
476 | 0 | KSNotifier.add(new KSNotification("Proposal was rejected", false)); |
477 | 0 | updateWorkflow(dataModel); |
478 | |
}else{ |
479 | 0 | Window.alert("Error rejecting Proposal"); |
480 | |
} |
481 | 0 | } |
482 | |
|
483 | |
}); |
484 | |
} |
485 | |
|
486 | |
} |
487 | |
else{ |
488 | 0 | submitSuccessDialog.hide(); |
489 | |
} |
490 | 0 | } |
491 | |
}); |
492 | 0 | SectionTitle headerTitle = SectionTitle.generateH3Title("Reject Proposal"); |
493 | 0 | SectionTitle dialogLabel = SectionTitle.generateH4Title("You are rejecting the " + proposalName +" proposal"); |
494 | 0 | SectionTitle fieldLabel = SectionTitle.generateH4Title("Decision Rationale"); |
495 | 0 | required = new AbbrPanel("Required", "ks-form-module-elements-required", " * "); |
496 | 0 | required.setVisible(true); |
497 | |
|
498 | |
|
499 | |
|
500 | 0 | rationaleEditor.addStyleName("KS-Comment-Create-Editor"); |
501 | 0 | dialogPanel.clear(); |
502 | 0 | dialogPanel.add(headerTitle); |
503 | 0 | dialogPanel.add(dialogLabel); |
504 | 0 | dialogPanel.add(fieldLabel); |
505 | 0 | dialogPanel.add(required); |
506 | 0 | dialogPanel.add(rationaleEditor); |
507 | 0 | dialogPanel.add(disapprovalButton); |
508 | 0 | submitSuccessDialog.setWidget(dialogPanel); |
509 | 0 | submitSuccessDialog.show(); |
510 | 0 | } |
511 | |
}); |
512 | 0 | return wfDisApproveItem; |
513 | |
} |
514 | |
|
515 | |
private KSMenuItemData getApproveItem() { |
516 | |
KSMenuItemData wfApproveItem; |
517 | |
|
518 | 0 | wfApproveItem= new KSMenuItemData("Approve Proposal", new ClickHandler(){ |
519 | |
public void onClick(ClickEvent event) { |
520 | 0 | setupSubmitSuccessDialog(); |
521 | 0 | final KSRichEditor rationaleEditor = new KSRichEditor(); |
522 | 0 | ConfirmApprovalCancelGroup approvalButton = new ConfirmApprovalCancelGroup(new Callback<ConfirmApprovalCancelEnum>(){ |
523 | |
|
524 | |
@Override |
525 | |
public void exec(ConfirmApprovalCancelEnum result) { |
526 | 0 | if(!result.name().equals("CANCEL")){ |
527 | 0 | if(rationaleEditor.getText().trim().equals("")){ |
528 | 0 | required.setText("Please enter the decision rationale"); |
529 | |
} |
530 | |
else{ |
531 | 0 | addRationale(rationaleEditor,DecisionRationaleDetail.APPROVE.getType()); |
532 | |
|
533 | 0 | workflowRpcServiceAsync.approveDocumentWithId(workflowId, new KSAsyncCallback<Boolean>(){ |
534 | |
@Override |
535 | |
public void handleFailure(Throwable caught) { |
536 | 0 | submitSuccessDialog.hide(); |
537 | 0 | Window.alert("Error approving Proposal"); |
538 | 0 | } |
539 | |
public void onSuccess(Boolean result) { |
540 | 0 | submitSuccessDialog.hide(); |
541 | 0 | if (result){ |
542 | 0 | updateWorkflow(dataModel); |
543 | 0 | if(submitCallback != null){ |
544 | 0 | submitCallback.exec(result); |
545 | |
} |
546 | |
|
547 | 0 | KSNotifier.add(new KSNotification("Proposal was approved", false)); |
548 | |
} else { |
549 | 0 | Window.alert("Error approving Proposal"); |
550 | |
} |
551 | 0 | } |
552 | |
}); |
553 | |
} |
554 | |
|
555 | |
} |
556 | |
else{ |
557 | 0 | submitSuccessDialog.hide(); |
558 | |
} |
559 | 0 | } |
560 | |
}); |
561 | |
|
562 | 0 | SectionTitle headerTitle = SectionTitle.generateH3Title("Approve Proposal"); |
563 | 0 | SectionTitle dialogLabel = SectionTitle.generateH4Title("You are approving the " + proposalName +" proposal"); |
564 | 0 | SectionTitle fieldLabel = SectionTitle.generateH4Title("Decision Rationale"); |
565 | 0 | required = new AbbrPanel("Required", "ks-form-module-elements-required", " * "); |
566 | 0 | required.setVisible(true); |
567 | 0 | rationaleEditor.addStyleName("KS-Comment-Create-Editor"); |
568 | 0 | dialogPanel.clear(); |
569 | 0 | dialogPanel.add(headerTitle); |
570 | 0 | dialogPanel.add(dialogLabel); |
571 | 0 | dialogPanel.add(fieldLabel); |
572 | 0 | dialogPanel.add(required); |
573 | 0 | dialogPanel.add(rationaleEditor); |
574 | 0 | dialogPanel.add(approvalButton); |
575 | 0 | dialogPanel.setSize("580px", "400px"); |
576 | |
|
577 | 0 | submitSuccessDialog.show(); |
578 | 0 | } |
579 | |
}); |
580 | 0 | return wfApproveItem; |
581 | |
} |
582 | |
|
583 | |
private KSMenuItemData getWithdrawItem() { |
584 | |
KSMenuItemData wfWithdrawItem; |
585 | |
|
586 | 0 | wfWithdrawItem = new KSMenuItemData("Withdraw Proposal", new ClickHandler() { |
587 | |
public void onClick(ClickEvent event) { |
588 | 0 | setupSubmitSuccessDialog(); |
589 | 0 | final KSRichEditor rationaleEditor = new KSRichEditor(); |
590 | 0 | ConfirmCancelGroup withdrawButton = new ConfirmCancelGroup(new Callback<ConfirmCancelEnum>() { |
591 | |
|
592 | |
@Override |
593 | |
public void exec(ConfirmCancelEnum result) { |
594 | 0 | if (!result.name().equals("CANCEL")) { |
595 | 0 | if (rationaleEditor.getText().trim().equals("")) { |
596 | 0 | required.setText("Please enter the decision rationale"); |
597 | |
} else { |
598 | 0 | addRationale(rationaleEditor, DecisionRationaleDetail.WITHDRAW.getType()); |
599 | |
|
600 | 0 | workflowRpcServiceAsync.withdrawDocumentWithId(workflowId, new KSAsyncCallback<Boolean>() { |
601 | |
@Override |
602 | |
public void handleFailure(Throwable caught) { |
603 | 0 | submitSuccessDialog.hide(); |
604 | 0 | Window.alert("Error withdrawing Proposal"); |
605 | 0 | } |
606 | |
|
607 | |
public void onSuccess(Boolean result) { |
608 | 0 | submitSuccessDialog.hide(); |
609 | 0 | if (result) { |
610 | 0 | updateWorkflow(dataModel); |
611 | 0 | if (submitCallback != null) { |
612 | 0 | submitCallback.exec(result); |
613 | |
} |
614 | |
|
615 | 0 | KSNotifier.add(new KSNotification("Proposal will be withdrawn", false)); |
616 | |
} else { |
617 | 0 | Window.alert("Error withdrawing Proposal"); |
618 | |
} |
619 | 0 | } |
620 | |
}); |
621 | |
} |
622 | |
|
623 | |
} else { |
624 | 0 | submitSuccessDialog.hide(); |
625 | |
} |
626 | 0 | } |
627 | |
}); |
628 | |
|
629 | 0 | SectionTitle headerTitle = SectionTitle.generateH3Title("Withdraw Proposal"); |
630 | 0 | SectionTitle dialogLabel = SectionTitle.generateH4Title("You are withdrawing the " + proposalName + " proposal"); |
631 | 0 | SectionTitle fieldLabel = SectionTitle.generateH4Title("Decision Rationale"); |
632 | 0 | required = new AbbrPanel("Required", "ks-form-module-elements-required", " * "); |
633 | 0 | required.setVisible(true); |
634 | 0 | rationaleEditor.addStyleName("KS-Comment-Create-Editor"); |
635 | 0 | dialogPanel.clear(); |
636 | 0 | dialogPanel.add(headerTitle); |
637 | 0 | dialogPanel.add(dialogLabel); |
638 | 0 | dialogPanel.add(fieldLabel); |
639 | 0 | dialogPanel.add(required); |
640 | 0 | dialogPanel.add(rationaleEditor); |
641 | 0 | dialogPanel.add(withdrawButton); |
642 | 0 | dialogPanel.setSize("580px", "400px"); |
643 | |
|
644 | 0 | submitSuccessDialog.show(); |
645 | 0 | } |
646 | |
}); |
647 | 0 | return wfWithdrawItem; |
648 | |
} |
649 | |
|
650 | |
private KSMenuItemData getBlanketApproveItem() { |
651 | |
KSMenuItemData wfBlanketApproveItem; |
652 | |
|
653 | 0 | wfBlanketApproveItem = new KSMenuItemData("Blanket Approve Proposal", new ClickHandler() { |
654 | |
public void onClick(ClickEvent event) { |
655 | 0 | setupSubmitSuccessDialog(); |
656 | 0 | final KSRichEditor rationaleEditor = new KSRichEditor(); |
657 | 0 | ConfirmCancelGroup blanketApprovalButton = new ConfirmCancelGroup(new Callback<ConfirmCancelEnum>() { |
658 | |
|
659 | |
@Override |
660 | |
public void exec(ConfirmCancelEnum result) { |
661 | 0 | if (!result.name().equals("CANCEL")) { |
662 | 0 | if (rationaleEditor.getText().trim().equals("")) { |
663 | 0 | required.setText("Please enter the decision rationale"); |
664 | |
} else { |
665 | 0 | addRationale(rationaleEditor, DecisionRationaleDetail.BLANKET_APPROVE.getType()); |
666 | |
|
667 | 0 | workflowRpcServiceAsync.blanketApproveDocumentWithId(workflowId, new KSAsyncCallback<Boolean>() { |
668 | |
@Override |
669 | |
public void handleFailure(Throwable caught) { |
670 | 0 | submitSuccessDialog.hide(); |
671 | 0 | Window.alert("Error blanket approving Proposal"); |
672 | 0 | } |
673 | |
|
674 | |
public void onSuccess(Boolean result) { |
675 | 0 | submitSuccessDialog.hide(); |
676 | 0 | if (result) { |
677 | |
|
678 | |
|
679 | |
|
680 | 0 | enableWorkflowActionsWidgets(false); |
681 | |
|
682 | 0 | updateWorkflow(dataModel); |
683 | 0 | if (submitCallback != null) { |
684 | 0 | submitCallback.exec(result); |
685 | |
} |
686 | |
|
687 | 0 | KSNotifier.add(new KSNotification("Proposal will be blanket approved", false)); |
688 | |
} else { |
689 | 0 | Window.alert("Error blanket approving Proposal"); |
690 | |
} |
691 | 0 | } |
692 | |
}); |
693 | |
} |
694 | |
} else { |
695 | 0 | submitSuccessDialog.hide(); |
696 | |
} |
697 | 0 | } |
698 | |
}); |
699 | |
|
700 | 0 | SectionTitle headerTitle = SectionTitle.generateH3Title("Blanket Approve Proposal"); |
701 | 0 | SectionTitle dialogLabel = SectionTitle.generateH4Title("You are blanket approving the " + proposalName + " proposal"); |
702 | 0 | SectionTitle fieldLabel = SectionTitle.generateH4Title("Decision Rationale"); |
703 | 0 | required = new AbbrPanel("Required", "ks-form-module-elements-required", " * "); |
704 | 0 | required.setVisible(true); |
705 | 0 | rationaleEditor.addStyleName("KS-Comment-Create-Editor"); |
706 | 0 | dialogPanel.clear(); |
707 | 0 | dialogPanel.add(headerTitle); |
708 | 0 | dialogPanel.add(dialogLabel); |
709 | 0 | dialogPanel.add(fieldLabel); |
710 | 0 | dialogPanel.add(required); |
711 | 0 | dialogPanel.add(rationaleEditor); |
712 | 0 | dialogPanel.add(blanketApprovalButton); |
713 | 0 | dialogPanel.setSize("580px", "400px"); |
714 | |
|
715 | 0 | submitSuccessDialog.show(); |
716 | 0 | } |
717 | |
}); |
718 | 0 | return wfBlanketApproveItem; |
719 | |
} |
720 | |
|
721 | |
protected KSDropDown setUpReturnToPreviousDropDown(String workflowId) { |
722 | |
|
723 | 0 | final KSDropDown nodeNameDropDown = new KSDropDown(); |
724 | 0 | nodeNameDropDown.setBlankFirstItem(true); |
725 | 0 | workflowRpcServiceAsync.getPreviousRouteNodeNames(workflowId, new KSAsyncCallback<List<String>>() { |
726 | |
@Override |
727 | |
public void handleFailure(Throwable caught) { |
728 | 0 | Window.alert("Error getting previous node names for Proposal"); |
729 | 0 | } |
730 | |
|
731 | |
public void onSuccess(List<String> result) { |
732 | 0 | SimpleListItems nodeNameList = new SimpleListItems(); |
733 | 0 | for (String nodeName : result) { |
734 | 0 | nodeNameList.addItem(nodeName, nodeName); |
735 | |
} |
736 | 0 | nodeNameDropDown.setListItems(nodeNameList); |
737 | 0 | } |
738 | |
}); |
739 | 0 | nodeNameDropDown.setInitialized(true); |
740 | 0 | return nodeNameDropDown; |
741 | |
} |
742 | |
|
743 | |
private KSMenuItemData getReturnToPreviousItem() { |
744 | |
KSMenuItemData wfReturnToPreviousItem; |
745 | |
|
746 | 0 | wfReturnToPreviousItem = new KSMenuItemData("Return Proposal to Previous Node", new ClickHandler() { |
747 | |
public void onClick(ClickEvent event) { |
748 | 0 | setupSubmitSuccessDialog(); |
749 | 0 | final KSRichEditor rationaleEditor = new KSRichEditor(); |
750 | 0 | final KSDropDown nodeNameDropDown = setUpReturnToPreviousDropDown(workflowId); |
751 | 0 | ConfirmCancelGroup returnButton = new ConfirmCancelGroup(new Callback<ConfirmCancelEnum>() { |
752 | |
|
753 | |
@Override |
754 | |
public void exec(ConfirmCancelEnum result) { |
755 | 0 | if (!result.name().equals("CANCEL")) { |
756 | 0 | if ((rationaleEditor.getText().trim().equals("")) && (nodeNameDropDown.getSelectedItem().trim().equals(""))) { |
757 | 0 | required.setText("Please enter the decision rationale and select a node name to return to"); |
758 | 0 | } else if (rationaleEditor.getText().trim().equals("")) { |
759 | 0 | required.setText("Please enter the decision rationale"); |
760 | 0 | } else if (nodeNameDropDown.getSelectedItem().trim().equals("")) { |
761 | 0 | required.setText("Please select a node name to return to"); |
762 | |
} else { |
763 | 0 | addRationale(rationaleEditor, DecisionRationaleDetail.RETURN_TO_PREVIOUS.getType()); |
764 | 0 | String nodeName = nodeNameDropDown.getSelectedItem().trim(); |
765 | 0 | workflowRpcServiceAsync.returnDocumentWithId(workflowId, nodeName, new KSAsyncCallback<Boolean>() { |
766 | |
@Override |
767 | |
public void handleFailure(Throwable caught) { |
768 | 0 | submitSuccessDialog.hide(); |
769 | 0 | Window.alert("Error returning the Proposal to a previous node"); |
770 | 0 | } |
771 | |
|
772 | |
public void onSuccess(Boolean result) { |
773 | 0 | submitSuccessDialog.hide(); |
774 | 0 | if (result) { |
775 | 0 | updateWorkflow(dataModel); |
776 | 0 | if (submitCallback != null) { |
777 | 0 | submitCallback.exec(result); |
778 | |
} |
779 | |
|
780 | 0 | KSNotifier.add(new KSNotification("Proposal was returned", false)); |
781 | |
} else { |
782 | 0 | Window.alert("Error returning the Proposal to a previous node"); |
783 | |
} |
784 | 0 | } |
785 | |
}); |
786 | 0 | } |
787 | |
|
788 | |
} else { |
789 | 0 | submitSuccessDialog.hide(); |
790 | |
} |
791 | 0 | } |
792 | |
}); |
793 | |
|
794 | 0 | SectionTitle headerTitle = SectionTitle.generateH3Title("Return Proposal to Previous Node"); |
795 | 0 | SectionTitle dialogLabel = SectionTitle.generateH4Title("You are returning the " + proposalName + " proposal to a previous node"); |
796 | 0 | SectionTitle nnFieldLabel = SectionTitle.generateH4Title("Workflow Node Name"); |
797 | 0 | SectionTitle drFieldLabel = SectionTitle.generateH4Title("Decision Rationale"); |
798 | 0 | required = new AbbrPanel("Required", "ks-form-module-elements-required", " * "); |
799 | 0 | required.setVisible(true); |
800 | 0 | rationaleEditor.addStyleName("KS-Comment-Create-Editor"); |
801 | 0 | dialogPanel.clear(); |
802 | 0 | dialogPanel.add(headerTitle); |
803 | 0 | dialogPanel.add(dialogLabel); |
804 | 0 | dialogPanel.add(nnFieldLabel); |
805 | 0 | dialogPanel.add(nodeNameDropDown); |
806 | 0 | dialogPanel.add(drFieldLabel); |
807 | 0 | dialogPanel.add(required); |
808 | 0 | dialogPanel.add(rationaleEditor); |
809 | 0 | dialogPanel.add(returnButton); |
810 | 0 | dialogPanel.setSize("580px", "400px"); |
811 | |
|
812 | 0 | submitSuccessDialog.show(); |
813 | 0 | } |
814 | |
}); |
815 | 0 | return wfReturnToPreviousItem; |
816 | |
} |
817 | |
|
818 | |
private void addRationale(KSRichEditor rationaleEditor, String rationaleType) { |
819 | 0 | CommentInfo newDecisionRationale = new CommentInfo(); |
820 | 0 | RichTextInfo text = new RichTextInfo(); |
821 | 0 | text.setFormatted(rationaleEditor.getHTML()); |
822 | 0 | text.setPlain(rationaleEditor.getText()); |
823 | 0 | newDecisionRationale.setReferenceTypeKey(PROPOSAL_REF_TYPE_KEY); |
824 | 0 | newDecisionRationale.setReferenceId(proposalId); |
825 | 0 | newDecisionRationale.setState(DtoState.ACTIVE.toString()); |
826 | 0 | newDecisionRationale.setCommentText(text); |
827 | 0 | newDecisionRationale.setType(rationaleType); |
828 | |
|
829 | |
try { |
830 | 0 | commentServiceAsync.addComment(proposalId, PROPOSAL_REF_TYPE_KEY, newDecisionRationale, new KSAsyncCallback<CommentInfo>() { |
831 | |
|
832 | |
@Override |
833 | |
public void handleFailure(Throwable caught) { |
834 | 0 | GWT.log("Add Comment Failed", caught); |
835 | 0 | } |
836 | |
|
837 | |
@Override |
838 | |
public void onSuccess(CommentInfo result) { |
839 | 0 | System.out.println("Rationale Added successfully"); |
840 | 0 | } |
841 | |
}); |
842 | 0 | } catch (Exception e) { |
843 | 0 | GWT.log("Add Comment Failed", e); |
844 | 0 | } |
845 | 0 | } |
846 | |
|
847 | |
private KSMenuItemData getStartItem() { |
848 | |
KSMenuItemData wfStartWorkflowItem; |
849 | 0 | wfStartWorkflowItem = new KSMenuItemData("Submit Proposal", new ClickHandler(){ |
850 | |
public void onClick(ClickEvent event) { |
851 | |
|
852 | 0 | dataModel.validateNextState(new Callback<List<ValidationResultInfo>>() { |
853 | |
@Override |
854 | |
public void exec(List<ValidationResultInfo> result) { |
855 | |
|
856 | 0 | boolean isValid = parentController.isValid(result, false); |
857 | 0 | if(isValid){ |
858 | 0 | dialog.show(); |
859 | |
} |
860 | |
else{ |
861 | 0 | Window.alert("Unable to submit to workflow. Please check sections for missing fields."); |
862 | |
} |
863 | 0 | } |
864 | |
}); |
865 | 0 | } |
866 | |
|
867 | |
}); |
868 | 0 | return wfStartWorkflowItem; |
869 | |
} |
870 | |
|
871 | |
private KSMenuItemData getCancelWorkflowItem() { |
872 | |
KSMenuItemData wfCancelWorkflowItem; |
873 | 0 | final KSRichEditor rationaleEditor = new KSRichEditor(); |
874 | 0 | wfCancelWorkflowItem = new KSMenuItemData("Cancel Proposal", new ClickHandler() { |
875 | |
public void onClick(ClickEvent event) { |
876 | 0 | final ConfirmationDialog confirmationCancelProposal = |
877 | |
new ConfirmationDialog("Cancel Proposal","This action is not reversible and all data will be lost. Do you wish to cancel this proposal?"); |
878 | |
|
879 | 0 | confirmationCancelProposal.getConfirmButton().setText("Yes, cancel proposal"); |
880 | 0 | confirmationCancelProposal.getCancelButton().setStyleName(ButtonStyle.PRIMARY_SMALL.getStyle()); |
881 | 0 | confirmationCancelProposal.getCancelButton().setText("No, return to proposal"); |
882 | |
|
883 | 0 | confirmationCancelProposal.getConfirmButton().addClickHandler(new ClickHandler(){ |
884 | |
@Override |
885 | |
public void onClick(ClickEvent event) { |
886 | 0 | addRationale(rationaleEditor, DecisionRationaleDetail.CANCEL_WORKFLOW.getType()); |
887 | 0 | workflowRpcServiceAsync.cancelDocumentWithId(workflowId, new KSAsyncCallback<Boolean>() { |
888 | |
@Override |
889 | |
public void handleFailure(Throwable caught) { |
890 | 0 | confirmationCancelProposal.hide(); |
891 | 0 | Window.alert("Error Cancelling Proposal"); |
892 | 0 | } |
893 | |
public void onSuccess(Boolean result) { |
894 | 0 | confirmationCancelProposal.hide(); |
895 | 0 | if (result) { |
896 | 0 | updateWorkflow(dataModel); |
897 | 0 | if (submitCallback != null) { |
898 | 0 | submitCallback.exec(true); |
899 | |
} |
900 | |
|
901 | 0 | KSNotifier.add(new KSNotification("Proposal will be Cancelled", false)); |
902 | |
} else { |
903 | 0 | Window.alert("Error Cancelling Proposal"); |
904 | |
} |
905 | 0 | } |
906 | |
}); |
907 | |
|
908 | 0 | } |
909 | |
|
910 | |
}); |
911 | 0 | confirmationCancelProposal.show(); |
912 | 0 | } |
913 | |
}); |
914 | 0 | return wfCancelWorkflowItem; |
915 | |
} |
916 | |
|
917 | |
private void setWorkflowStatus(String statusCd){ |
918 | 0 | String statusTranslation = ""; |
919 | 0 | if (WorkflowConstants.ROUTE_HEADER_SAVED_CD.equals(statusCd)){ |
920 | 0 | statusTranslation = getLabel(WorkflowConstants.ROUTE_HEADER_SAVED_LABEL_KEY); |
921 | 0 | } else if (WorkflowConstants.ROUTE_HEADER_INITIATED_CD.equals(statusCd)){ |
922 | 0 | statusTranslation = getLabel(WorkflowConstants.ROUTE_HEADER_INITIATED_LABEL_KEY); |
923 | 0 | } else if (WorkflowConstants.ROUTE_HEADER_ENROUTE_CD.equals(statusCd)){ |
924 | 0 | statusTranslation = getLabel(WorkflowConstants.ROUTE_HEADER_ENROUTE_LABEL_KEY); |
925 | 0 | } else if (WorkflowConstants.ROUTE_HEADER_APPROVED_CD.equals(statusCd)){ |
926 | 0 | statusTranslation = getLabel(WorkflowConstants.ROUTE_HEADER_APPROVED_LABEL_KEY); |
927 | 0 | } else if (WorkflowConstants.ROUTE_HEADER_CANCEL_CD.equals(statusCd)){ |
928 | 0 | statusTranslation = getLabel(WorkflowConstants.ROUTE_HEADER_CANCEL_LABEL_KEY); |
929 | 0 | } else if (WorkflowConstants.ROUTE_HEADER_EXCEPTION_CD.equals(statusCd)){ |
930 | 0 | statusTranslation = getLabel(WorkflowConstants.ROUTE_HEADER_EXCEPTION_LABEL_KEY); |
931 | 0 | } else if (WorkflowConstants.ROUTE_HEADER_DISAPPROVED_CD.equals(statusCd)){ |
932 | 0 | statusTranslation = getLabel(WorkflowConstants.ROUTE_HEADER_DISAPPROVED_LABEL_KEY); |
933 | 0 | } else if (WorkflowConstants.ROUTE_HEADER_FINAL_CD.equals(statusCd)){ |
934 | 0 | statusTranslation = getLabel(WorkflowConstants.ROUTE_HEADER_FINAL_LABEL_KEY); |
935 | 0 | } else if (WorkflowConstants.ROUTE_HEADER_DISAPPROVE_CANCEL_CD.equals(statusCd)){ |
936 | 0 | statusTranslation = getLabel(WorkflowConstants.ROUTE_HEADER_DISAPPROVE_CANCEL_LABEL_KEY); |
937 | 0 | } else if (WorkflowConstants.ROUTE_HEADER_PROCESSED_CD.equals(statusCd)){ |
938 | 0 | statusTranslation = getLabel(WorkflowConstants.ROUTE_HEADER_PROCESSED_LABEL_KEY); |
939 | |
} else { |
940 | 0 | statusTranslation = statusCd; |
941 | |
} |
942 | |
|
943 | 0 | workflowStatusLabel.setText("Status: " + statusTranslation); |
944 | 0 | } |
945 | |
|
946 | |
|
947 | |
|
948 | |
|
949 | |
|
950 | |
|
951 | |
public void setModelName(String modelName) { |
952 | 0 | this.modelName = modelName; |
953 | 0 | } |
954 | |
|
955 | |
|
956 | |
|
957 | |
|
958 | |
|
959 | |
public void setProposalPath(String proposalPath) { |
960 | 0 | this.proposalPath = proposalPath; |
961 | 0 | } |
962 | |
|
963 | |
public void setWorkflowRpcService(WorkflowRpcServiceAsync workflowRpcServiceAsync){ |
964 | 0 | this.workflowRpcServiceAsync = workflowRpcServiceAsync; |
965 | 0 | } |
966 | |
|
967 | |
|
968 | |
public void refresh(){ |
969 | 0 | updateWorkflow(dataModel); |
970 | 0 | } |
971 | |
|
972 | |
private String getLabel(String labelKey) { |
973 | 0 | return Application.getApplicationContext().getUILabel("common", null, null, labelKey); |
974 | |
} |
975 | |
|
976 | |
public void getDataIdFromWorkflowId(String workflowId, AsyncCallback<String> callback){ |
977 | 0 | workflowRpcServiceAsync.getDataIdFromWorkflowId(workflowId, callback); |
978 | 0 | } |
979 | |
|
980 | |
public void addSubmitCallback(Callback<Boolean> callback) { |
981 | 0 | this.submitCallback = callback; |
982 | |
|
983 | 0 | } |
984 | |
} |