Designed the Application Architecture Using Struts Framework
Download
ePurchasing System using Struts Framework
Download Presentation
ePurchasing System using Struts Framework
- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
-
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 • Benefits and Limitations of using Struts • Introduce backend technologies from even further away
-
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
-
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
-
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
-
ePurchasing Implementation • System development started in August 2001 • System was implemented in December 2001 • Currently in phased development and release cycles
-
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
-
ePurchasingDocument flow ofRequisition & Purchase Order
-
Requisition Document Flowfrom Business Logic Perspective
-
Purchase Order Document Flowfrom Business Logic Perspective Account access validation Encumbrance posting
-
ePurchasingScreen Captures
-
ePurchasing Login
-
ePurchasing Main Menu
-
ePurchasing Pending Requisitions
-
ePurchasing New Requisition Form
-
ePurchasing Requisition Submission
-
ePurchasing Requisition Transfer
-
ePurchasing Purchase Order Form
-
ePurchasing Hardcopy Purchase Order
-
Let's talk about Struts!
-
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
-
Benefits of using Struts from Management perspective • Open Source • Good documentation • Stable and Mature • Developed by industry experts • Manageable learning curve • Large user community
-
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
-
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
-
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
-
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
-
Inside Struts Framework • Controller • Model • View
-
Struts implementation of MVC in ePurchasing Architecture
-
Controller
-
Controller : Components ActionServlet RequestProcessor Action Classes
-
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
-
Controller : RequestProcessor One instance per web application module Processes all request for module Invokes proper Action instance Default implementation provided by framework
-
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
-
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>
-
Requisition Document Flowfrom Business Logic Perspective
-
The Journey of Requisitionwith Action URI
-
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; }…
-
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
-
Model
-
Model : Facts No model components provided Struts supports any model component - EJB, Corba, JavaBeans, etc Decouple model implementation from the framework
-
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.
-
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();
-
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
-
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
-
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>
-
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
-
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 { …
-
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…
-
View
-
View : Components Java Server Pages HTMLs JavaScripts and StyleSheets Resources Bundles JavaBeans extending ActionForms Custom Tags - HTML, Bean, Logic
Designed the Application Architecture Using Struts Framework
Source: https://www.slideserve.com/keanu/epurchasing-system-using-struts-framework
0 Response to "Designed the Application Architecture Using Struts Framework"
Postar um comentário