1 / 52

ePurchasing System using Struts Framework

ePurchasing System using Struts Framework. Java Administration Special Interest Group December 9, 2002 Mimpin Halim University of Hawai’i. Presentation Goals. Introduce UH ePurchasing System from 1,001 miles away Highlight ePurchasing requisition processing steps

keanu
Download Presentation

ePurchasing System using Struts Framework

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ePurchasing System using Struts Framework Java Administration Special Interest Group December 9, 2002 Mimpin Halim University of Hawai’i

  2. Presentation Goals • Introduce UH ePurchasing System from 1,001 miles away • Highlight ePurchasing requisition processing steps • Benefits and Limitations of using Struts • Introduce backend technologies from even further away

  3. ePurchasing Goals • Mitigate risk by reducing human errors • Shorter turn-around time • Shift employees' focus from paperwork to productivity • Use information more efficiently by integrating enhanced transaction data with the existing systems • Reduce cost of papers • Transition to completely paperless purchasing system

  4. University of Hawai’i ePurchasing System Overview • Supports requisition, purchase order, purchase order change, invoice and payment processing • Provides electronic approvals • Supports multiple user roles with varied access to the system features using LDAP authentication • Validates accounts for activity and available budget

  5. University of Hawai’i ePurchasing System Overview(cont.) • Integrated with SuperQUOTE™ from CommercePoint • Supports real-time encumbering of purchases and real-time posting of payment expenditures • Handles the creation, modification and storage/retrieval of purchasing documents. • Built using Struts Framework v1.0 in transition to v1.1

  6. ePurchasing Implementation • System development started in August 2001 • System was implemented in December 2001 • Currently in phased development and release cycles

  7. ePurchasing Statistics • As of November 5, 2002: • 38 out of 58 units implemented • 585 out of ± 800 users • 3,891 processed purchase orders • 3,767 payments • $8,547,487.60 processed purchases

  8. ePurchasingDocument flow ofRequisition & Purchase Order

  9. Requisition Document Flowfrom Business Logic Perspective

  10. Purchase Order Document Flowfrom Business Logic Perspective Account access validation Encumbrance posting

  11. ePurchasingScreen Captures

  12. ePurchasing Login

  13. ePurchasing Main Menu

  14. ePurchasing Pending Requisitions

  15. ePurchasing New Requisition Form

  16. ePurchasing Requisition Submission

  17. ePurchasing Requisition Transfer

  18. ePurchasing Purchase Order Form

  19. ePurchasing Hardcopy Purchase Order

  20. Let’s talk about Struts!

  21. Struts Overview • Open source framework for building web applications created by Craig MacClanahan. • Donated to Apache Software Foundation (ASF) in 2000 • Provides extensible development environment • Based on standard technologies like Java Servlets, JavaBeans, ResourceBundles and XML • Based on Model 2 architecture, a variation of MVC design paradigm

  22. Benefits of using Struts from Management perspective • Open Source • Good documentation • Stable and Mature • Developed by industry experts • Manageable learning curve • Large user community

  23. Benefits of using Struts from Developer perspective • Highly customizable • Feature-rich • Extendable and flexible • Widely supported with many free third party tools • Solid design with good documentation • Large user community with very active mailing list • Provides good separation between presentation and business logic. • Modular architecture promotes easier development

  24. Limitations of using Struts from Developer perspective • Building large and complicated form • Lack of “dynamic properties” • Complicated client-side form/JavaScript interaction • Last two limitation have been addressed in Struts 1.1

  25. Struts Framework Features • Supports internationalization - I18N • Database support and JDBC Connection pooling capabilities • Compatible with a variety of model implementations - EJB, JavaBeans, CORBA, etc. • Compatible with a varietiy of presentation layers - JSP, XML/XSLT, etc. • Write once, run anywhere philosophy

  26. Struts Environment • Java Software Development Kit 1.2 or higher • Servlet 2.2/JSP 1.1 container or higher • XML parser compliant with JAXP 1.1 or higher

  27. Inside Struts Framework • Controller • Model • View

  28. Struts implementation of MVC in ePurchasing Architecture

  29. Controller

  30. Controller : Components ActionServlet RequestProcessor Action Classes

  31. Controller : ActionServlets Extends <javax.servlet.http.HttpServlets> Receives all framework requests Selects proper application module Delegates request handling to the RequestProcessor instance One instance per web application Default implementation provided by framework

  32. Controller : RequestProcessor One instance per web application module Processes all request for module Invokes proper Action instance Default implementation provided by framework

  33. Controller : Action Classes Extends <org.apache.struts.action.Action> In Struts 1.0 overrides the perform()method In Struts 1.1 overrides the execute()method Acts as a bridge between user-invoked URI and a business method Provides information about which view should be rendered and returned

  34. Example of ActionMapping <!-- Initial requisition form with user defaults --> <struts-config> … <action-mappings type="org.apache.struts.action.ActionMapping"> … <!-- Initial requisition form with user defaults --> <action path="/newReqInit" type="edu.hawaii.purchasing.NewReqInitAction" name="reqForm" scope="request" attribute="reqForm"> <forward name="success" path="/jsp/reqForm.jsp" /> </action> … </action-mappings> </struts-config>

  35. Requisition Document Flowfrom Business Logic Perspective

  36. The Journey of Requisitionwith Action URI

  37. Example of Action Class public class NewReqAction extends Action { public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { // Check if user logged in // (can be implemented by extending RequestProcessor) HttpSession session = request.getSession(false); LoginModel loginModel = new LoginModel(); if (!loginModel.isLoggedIn(session)) { ActionForward login = mapping.findForward("login"); login.setRedirect(true); return login; }…

  38. Example of Action Class (cont.) … // Get User’s information String userID = (String) session.getAttribute("userID"); UserBean userBean = UserModel.getUserInfo(userID); userBean.setFirstName((String) session.getAttribute("firstName")); userBean.setLastName((String) session.getAttribute("lastName")); userBean.setMiddleInitial((String) session.getAttribute("middleInitial")); ReqModel reqModel = new ReqModel(); ReqBean reqBean = new ReqBean(); VndrBean vndrBean = new VndrBean(); reqBean = (ReqBean) reqModel.init(userBean, vndrBean, reqBean); request.setAttribute("reqBean", reqBean); return (mapping.findForward("success")); } // perform() } // eof: NewReqAction

  39. Model

  40. Model : Facts No model components provided Struts supports any model component - EJB, Corba, JavaBeans, etc Decouple model implementation from the framework

  41. Model Component of ePurchasing Java Data Base Connectivity (JDBC 2.0) with Oracle Database utilizing Poolman Connection Pooling. EntireX Java ACI v5.2.1.0 by Software AG to tap into the IBM Mainframe for Remote Procedure Call.

  42. Example of Model Class public class UserModel { private static Category logger = Category.getInstance(UserModel.class.getName()); public static UserBean getUserInfo(String userID) throws IOException { Connection conn = null; Statement stmt = null; ResultSet rs = null; try { conn = DriverManager.getConnection( PropertiesLoader.getProperty("oracle.datasource")); stmt = conn.createStatement();

  43. Example of Model Class (cont.) // SQL Statement String colNames = "dept, deliv_addr_1, deliv_addr_2, deliv_addr_3, " + “deliv_addr_4, deliv_city, deliv_st, deliv_zip, …”; String tableName = "fmis_user "; String sqlStmt = "select " + colNames + "from " + tableName + "where user_id = '" + userID + "'"; rs = stmt.executeQuery(sqlStmt); UserBean user = new UserBean(); while (rs.next()) { user.setDelivDept(rs.getString("dept")); user.setDelivAddr1(rs.getString("deliv_addr_1")); user.setDelivAddr2(rs.getString("deliv_addr_2")); … } return user; } … //catch exception and finally close ResultSet, Statement, Connection

  44. Invoker Action Class … // Get User’s information String userID = (String) session.getAttribute("userID"); UserBean userBean = UserModel.getUserInfo(userID); userBean.setFirstName((String) session.getAttribute("firstName")); userBean.setLastName((String) session.getAttribute("lastName")); userBean.setMiddleInitial((String) session.getAttribute("middleInitial")); ReqModel reqModel = new ReqModel(); ReqBean reqBean = new ReqBean(); VndrBean vndrBean = new VndrBean(); reqBean = (ReqBean) reqModel.init(userBean, vndrBean, reqBean); request.setAttribute("reqBean", reqBean); return (mapping.findForward("success")); } // perform() } // eof: NewReqAction

  45. Struts ActionMapping <!-- Initial requisition form with user defaults --> <struts-config> … <action-mappings type="org.apache.struts.action.ActionMapping"> … <!-- Initial requisition form with user defaults --> <action path="/newReqInit" type="edu.hawaii.purchasing.NewReqInitAction" name="reqForm" scope="request" attribute="reqForm"> <forward name="success" path="/jsp/reqForm.jsp" /> </action> … </action-mappings> </struts-config>

  46. Model : Natural Broker Execute Remote Procedure Call to specific Broker program running in the Mainframe Call is sent to the Broker as a String containing program name, parameters needed for the program to execute Return user-defined number of bytes in the form of byte arrays Can do more than one invocation with a given open connection to the host running the EntireX Broker server

  47. Using Natural Broker public String[][] getBalance(String document) throws IOException { … String brokerParms = "JWSPEBAL28000" + document + fisYear; int receiveBufferSize = 28000; byte[] replyArray = null; String[][] acctBalances = new String[1][5]; BrokerMessage bReply = nb.perform(brokerParms, receiveBufferSize); if (bReply == null) { if (logger.isDebugEnabled()) { logger.debug("getBalance() - No results"); } return acctBalances; } else { …

  48. Using Natural Broker (cont.) replyArray = nb.getResults(bReply); String count = new String(replyArray, 0, 2); int acctCount = Integer.parseInt(count); if (acctCount == 0) { return acctBalances; } acctBalances = new String[acctCount][5]; // each account has 5 properties for (int i = 0; i < acctCount; i++) { int rOffset = 2 + (i * 40); acctBalances[i][0] = new String(replyArray, rOffset, 2); // campus acctBalances[i][1] = new String(replyArray, rOffset + 2, 6); // account acctBalances[i][2] = new String(replyArray, rOffset + 8, 4); // subcode acctBalances[i][3] = new String(replyArray, rOffset + 12, 14); // curr. amt acctBalances[i][4] = new String(replyArray, rOffset + 26, 14); // liq. amt…

  49. View

  50. View : Components Java Server Pages HTMLs JavaScripts and StyleSheets Resources Bundles JavaBeans extending ActionForms Custom Tags - HTML, Bean, Logic

More Related