1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.module.purap.document.web.struts;
17
18 import org.apache.struts.action.ActionForm;
19 import org.apache.struts.action.ActionForward;
20 import org.apache.struts.action.ActionMapping;
21 import org.kuali.ole.module.purap.document.ElectronicInvoiceRejectDocument;
22 import org.kuali.ole.sys.OLEConstants;
23 import org.kuali.ole.sys.document.web.struts.FinancialSystemTransactionalDocumentActionBase;
24 import org.kuali.rice.krad.bo.Note;
25 import org.kuali.rice.krad.bo.PersistableBusinessObject;
26 import org.kuali.rice.krad.util.GlobalVariables;
27
28 import javax.servlet.http.HttpServletRequest;
29 import javax.servlet.http.HttpServletResponse;
30 import java.util.List;
31
32
33
34
35 public class ElectronicInvoiceRejectAction extends FinancialSystemTransactionalDocumentActionBase {
36
37 public ActionForward startResearch(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
38
39 ElectronicInvoiceRejectForm electronicInvoiceRejectForm = (ElectronicInvoiceRejectForm) form;
40 ElectronicInvoiceRejectDocument eirDocument = (ElectronicInvoiceRejectDocument) electronicInvoiceRejectForm.getDocument();
41 eirDocument.setInvoiceResearchIndicator(true);
42
43 Note noteObj = getDocumentService().createNoteFromDocument(eirDocument, "Research started by: " + GlobalVariables.getUserSession().getPerson().getName());
44 PersistableBusinessObject noteParent = eirDocument.getNoteTarget();
45 List<Note> noteList = getNoteService().getByRemoteObjectId(noteParent.getObjectId());
46 noteList.add(noteObj);
47 getNoteService().saveNoteList(noteList);
48 getNoteService().save(noteObj);
49 getDocumentService().saveDocument(eirDocument);
50
51 return mapping.findForward(OLEConstants.MAPPING_BASIC);
52 }
53
54 public ActionForward completeResearch(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
55
56 ElectronicInvoiceRejectForm electronicInvoiceRejectForm = (ElectronicInvoiceRejectForm) form;
57 ElectronicInvoiceRejectDocument eirDocument = (ElectronicInvoiceRejectDocument) electronicInvoiceRejectForm.getDocument();
58 eirDocument.setInvoiceResearchIndicator(false);
59
60 Note noteObj = getDocumentService().createNoteFromDocument(eirDocument, "Research completed by: " + GlobalVariables.getUserSession().getPerson().getName());
61 PersistableBusinessObject noteParent = eirDocument.getNoteTarget();
62 List<Note> noteList = this.getNoteService().getByRemoteObjectId(noteParent.getObjectId());
63 noteList.add(noteObj);
64 getNoteService().saveNoteList(noteList);
65
66 getNoteService().save(noteObj);
67 getDocumentService().saveDocument(eirDocument);
68
69 return mapping.findForward(OLEConstants.MAPPING_BASIC);
70
71 }
72
73 }
74