use of org.apache.struts.action.ActionForward in project cu-kfs by CU-CommunityApps.
the class CuPaymentRequestAction method docHandler.
@Override
public ActionForward docHandler(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
ActionForward forward = super.docHandler(mapping, form, request, response);
PaymentRequestForm preqForm = (PaymentRequestForm) form;
PaymentRequestDocument document = (PaymentRequestDocument) preqForm.getDocument();
if (CollectionUtils.isNotEmpty(document.getItems())) {
Collections.sort(document.getItems(), new Comparator() {
public int compare(Object o1, Object o2) {
PaymentRequestItem item1 = (PaymentRequestItem) o1;
PaymentRequestItem item2 = (PaymentRequestItem) o2;
Integer inv1 = ((CuPaymentRequestItemExtension) item1.getExtension()).getInvLineNumber();
Integer inv2 = ((CuPaymentRequestItemExtension) item2.getExtension()).getInvLineNumber();
if (inv1 == null) {
if (inv2 == null) {
return -1;
} else {
return 1;
}
} else {
if (inv2 == null) {
return -1;
} else {
return inv1.compareTo(inv2);
}
}
}
});
}
return forward;
}
use of org.apache.struts.action.ActionForward in project cu-kfs by CU-CommunityApps.
the class CuPurchaseOrderAction method save.
// ==== CU Customization (KFSPTS-1457): Added the ability for certain users to move "CXER"-status POs into "OPEN" or "VOID" status. ====
@Override
public ActionForward save(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
ActionForward forward = super.save(mapping, form, request, response);
// reindex the document to pick up the changes.
PurchaseOrderDocument document = (PurchaseOrderDocument) ((PurchaseOrderForm) form).getDocument();
this.reIndexDocument(document);
return forward;
}
use of org.apache.struts.action.ActionForward in project cu-kfs by CU-CommunityApps.
the class CuPurchaseOrderAction method cancel.
// ==== End CU Customization ====
public ActionForward cancel(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
Object question = request.getParameter(KFSConstants.QUESTION_INST_ATTRIBUTE_NAME);
ActionForward forward = super.cancel(mapping, form, request, response);
if (question == null) {
return forward;
} else {
Object buttonClicked = request.getParameter(KFSConstants.QUESTION_CLICKED_BUTTON);
if ((KFSConstants.DOCUMENT_CANCEL_QUESTION.equals(question)) && ConfirmationQuestion.NO.equals(buttonClicked)) {
// if no button clicked just reload the doc
return forward;
}
// else go to cancel logic below
}
// TODO : need to check note length ?
KualiDocumentFormBase kualiDocumentFormBase = (KualiDocumentFormBase) form;
String reason = request.getParameter(KFSConstants.QUESTION_REASON_ATTRIBUTE_NAME);
if (StringUtils.isNotBlank(reason)) {
String noteText = "Reason for cancelling PO : " + reason;
Note newNote = new Note();
newNote.setNoteText(noteText);
newNote.setNoteTypeCode(KFSConstants.NoteTypeEnum.BUSINESS_OBJECT_NOTE_TYPE.getCode());
kualiDocumentFormBase.setNewNote(newNote);
try {
insertBONote(mapping, kualiDocumentFormBase, request, response);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return forward;
}
use of org.apache.struts.action.ActionForward in project cu-kfs by CU-CommunityApps.
the class CuRequisitionAction method insertBONote.
@Override
public ActionForward insertBONote(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
KualiDocumentFormBase kualiDocumentFormBase = (KualiDocumentFormBase) form;
Note newNote = kualiDocumentFormBase.getNewNote();
NoteExtendedAttribute extendedAttribute = (NoteExtendedAttribute) newNote.getExtension();
ActionForward forward = super.insertBONote(mapping, form, request, response);
if (newNote != kualiDocumentFormBase.getNewNote()) {
Note addedNote = kualiDocumentFormBase.getDocument().getNotes().get(kualiDocumentFormBase.getDocument().getNotes().size() - 1);
extendedAttribute.setNoteIdentifier(addedNote.getNoteIdentifier());
addedNote.setExtension(extendedAttribute);
SpringContext.getBean(BusinessObjectService.class).save(extendedAttribute);
addedNote.refreshReferenceObject("extension");
}
return forward;
}
use of org.apache.struts.action.ActionForward in project cu-kfs by CU-CommunityApps.
the class CuRequisitionAction method copy.
/**
* Overridden to guarantee that form of copied document is set to whatever the entry mode of the document is
* @see org.kuali.kfs.kns.web.struts.action.KualiTransactionalDocumentActionBase#copy
* (org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm,
* javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
public ActionForward copy(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
ActionForward forward = null;
String docID = "docId";
if (request.getParameter(docID) == null) {
forward = super.copy(mapping, form, request, response);
} else {
// this is copy document from Procurement Gateway:
// use this url to call: http://localhost:8080/kfs-dev/purapRequisition.do?methodToCall=copy&docId=xxxx
String docId = request.getParameter(docID);
KualiDocumentFormBase kualiDocumentFormBase = (KualiDocumentFormBase) form;
CuRequisitionDocument document = null;
document = (CuRequisitionDocument) getDocumentService().getByDocumentHeaderId(docId);
document.toCopyFromGateway();
kualiDocumentFormBase.setDocument(document);
WorkflowDocument workflowDocument = document.getDocumentHeader().getWorkflowDocument();
kualiDocumentFormBase.setDocTypeName(workflowDocument.getDocumentTypeName());
SpringContext.getBean(SessionDocumentService.class).addDocumentToUserSession(GlobalVariables.getUserSession(), workflowDocument);
forward = mapping.findForward(RiceConstants.MAPPING_BASIC);
}
return forward;
}
Aggregations