Search in sources :

Example 21 with ActionForward

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;
}
Also used : PaymentRequestForm(org.kuali.kfs.module.purap.document.web.struts.PaymentRequestForm) PaymentRequestItem(org.kuali.kfs.module.purap.businessobject.PaymentRequestItem) PaymentRequestDocument(org.kuali.kfs.module.purap.document.PaymentRequestDocument) ActionForward(org.apache.struts.action.ActionForward) Comparator(java.util.Comparator)

Example 22 with ActionForward

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;
}
Also used : PurchaseOrderDocument(org.kuali.kfs.module.purap.document.PurchaseOrderDocument) ActionForward(org.apache.struts.action.ActionForward)

Example 23 with ActionForward

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;
}
Also used : KualiDocumentFormBase(org.kuali.kfs.kns.web.struts.form.KualiDocumentFormBase) Note(org.kuali.kfs.krad.bo.Note) ActionForward(org.apache.struts.action.ActionForward) AuthorizationException(org.kuali.kfs.krad.exception.AuthorizationException)

Example 24 with ActionForward

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;
}
Also used : NoteExtendedAttribute(edu.cornell.kfs.sys.businessobject.NoteExtendedAttribute) KualiDocumentFormBase(org.kuali.kfs.kns.web.struts.form.KualiDocumentFormBase) Note(org.kuali.kfs.krad.bo.Note) ActionForward(org.apache.struts.action.ActionForward) BusinessObjectService(org.kuali.kfs.krad.service.BusinessObjectService)

Example 25 with ActionForward

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;
}
Also used : CuRequisitionDocument(edu.cornell.kfs.module.purap.document.CuRequisitionDocument) SessionDocumentService(org.kuali.kfs.krad.service.SessionDocumentService) WorkflowDocument(org.kuali.rice.kew.api.WorkflowDocument) KualiDocumentFormBase(org.kuali.kfs.kns.web.struts.form.KualiDocumentFormBase) ActionForward(org.apache.struts.action.ActionForward)

Aggregations

ActionForward (org.apache.struts.action.ActionForward)117 AbstractContest (cn.edu.zju.acm.onlinejudge.bean.AbstractContest)16 ActionMessages (org.apache.struts.action.ActionMessages)14 Problem (cn.edu.zju.acm.onlinejudge.bean.Problem)11 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)11 UserProfile (cn.edu.zju.acm.onlinejudge.bean.UserProfile)9 ActionMessage (org.apache.struts.action.ActionMessage)9 KualiDocumentFormBase (org.kuali.kfs.kns.web.struts.form.KualiDocumentFormBase)8 IWantDocument (edu.cornell.kfs.module.purap.document.IWantDocument)7 PurApFavoriteAccountLineBuilderForIWantDocument (edu.cornell.kfs.module.purap.util.PurApFavoriteAccountLineBuilderForIWantDocument)7 UserContext (org.mifos.security.util.UserContext)7 IOException (java.io.IOException)6 Date (java.util.Date)6 AuthorizationPersistence (cn.edu.zju.acm.onlinejudge.persistence.AuthorizationPersistence)5 ArrayList (java.util.ArrayList)5 Cookie (javax.servlet.http.Cookie)5 ActionMapping (org.apache.struts.action.ActionMapping)5 CloseSession (org.mifos.framework.util.helpers.CloseSession)5 Submission (cn.edu.zju.acm.onlinejudge.bean.Submission)4 IWantDocumentService (edu.cornell.kfs.module.purap.document.service.IWantDocumentService)4