private String acknowledgedReceipt(ApprovalLink approvalLink, String organizationId) throws Exception { String message = ""; PuridiomProcessLoader processLoader = new PuridiomProcessLoader(organizationId); PuridiomProcess process = processLoader.loadProcess("po-supplier-acknowledgement.xml"); Map incomingRequest = new HashMap(); Contact contact; String[] contactData; if (approvalLink.getDoctype().equalsIgnoreCase("PO")) { incomingRequest.put("PoHeader_icPoHeader", approvalLink.getIcHeader().toString()); contactData = approvalLink.getUserId().split("//"); contact = this.getVendorContact(contactData[0], contactData[1], organizationId); incomingRequest.put("userName", contact.getDisplayName()); incomingRequest.put("userId", contact.getEmailAddr()); } incomingRequest.put("organizationId", organizationId); process.executeProcess(incomingRequest); return message; }
/** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods. * * @param request servlet request * @param response servlet response */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); String requestURI = request.getRequestURI(); ApprovalLink approvalLink = new ApprovalLink(); String approvalLinkURL = requestURI.substring(requestURI.lastIndexOf("/") + 1, requestURI.length()); String[] approvalLinkData = this.getIcApprovalLink(approvalLinkURL); String message = ""; response.setContentType("text/plain"); try { approvalLink = this.retrieveApprovalLink(approvalLinkData[0], approvalLinkData[1]); message = this.acknowledgedReceipt(approvalLink, approvalLinkData[1]); message += "Thank you"; out.println(message); Log.debug( this, "Receipt Acknowledgement (ApprovalLink = " + approvalLink.getIcApprovalLink() + ") was processing successfully"); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); Log.error( this, "Error processing Receipt Acknowledgement (ApprovalLink = " + approvalLink.getIcApprovalLink() + ") : " + e.getMessage()); } out.close(); }