Presentation is loading. Please wait.

Presentation is loading. Please wait.

ePurchasing System using Struts Framework

Similar presentations


Presentation on theme: "ePurchasing System using Struts Framework"— Presentation transcript:

1 ePurchasing System using Struts Framework
Java Administration Special Interest Group December 9, 2002 Mimpin Halim University of Hawai’i Today I’m going a presentation about the University of Hawai’i’s Purchasing application called ePurchasing built using Struts Framework.

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 The goals of this presentation are: To introduce the ePurchasing System from a distance Including the highlight of ePurchasing requisition processing steps as a case study Then we will get more into its backend technologies. Including Struts Framework and the technology that we use to tap into the legacy system. Next, we will discuss about the benefits and limitations of Struts from Management and developer point of view. And also highlight the steps for developing UH ePurchasing system using Struts, without, of course, the purpose of making you an expert in using Struts

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 As for the ePurchasing System itself, it is built with the goals of… Mitigate the risk by reducing human errors To obtain shorter turn-around time To shift employees’ focus from paperwork to productivity To reduce cost of inventories and papers And as a transition to a 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 Now, let’s look at a general overview of the system. The ePurchasing System supports requisition, purchase order, purchase order change, invoice and payment processing It provides electronic approvals And supports multiple user roles with varied access to the system features using LDAP authentication It also validates accounts for activity and available budget using a real-time interface to the legacy financial system (Legacy system = IBM Mainframe (MVS) running AdaBase Natural) <change slide> The System is integrated with SuperQuote from CommercePoint

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 ePurchasing is integrated with SuperQuote from CommercePoint SuperQuote: Is the electronic system that will replace the manual process for obtaining quotations, allowing more vendors to participate price bidding. Also, increase the supplier competition in responding to online requests which will result in lower prices. Data from the selected quotation is automatically inserted into ePurchasing-generated purchase orders. It supports real-time encumbering of purchases and real-time posting of payment expenditures Handles the creations, modifications and storage/retrieval of purchasing documents. And of course it’s built using Struts Framework 1.0!

6 ePurchasing Implementation
System development started in August 2001 System was implemented in December 2001 Currently in phased development and release cycles The development of the system was started in Mid 2001 and was first implemented in December, 2001 Currently the system is in the development phase and we are gradually rolling it out to units in the University System to allow for trainings and enhancements. With every phase we increase functionality and compliance to business policies

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, processed purchases As of November 5th this year, 38 units out of 58 units have implemented the system which consists of 585 users out of approximately 800 users in total. There has been approximately 38 hundred processed purchase orders with more than 37 hundred payments that adds up to more than 8 million dollars processed purchases

8 ePurchasing Document flow of Requisition & Purchase Order
Next let’s quickly run through the general document flows of requisitions and purchase orders in this application.

9 Requisition Document Flow from Business Logic Perspective
The requisition document flow… The words in red are the processes and the pictures of documents are the states of the requisition itself. These processes are performed by different user roles. Further on in the presentation, I will show the screen captures of the actual application. First, requisitioner login to the application and create a requisition and then enter the account information and other related information which lead to the requisition submission for approval by pre-determined role. The requisition can also be denied or deleted. Once the requisition is approved, it can be transferred to a purchase order which is indicated by the dotted line. In the process, different user roles have the ability to do lookup, edit or delete existing documents in the system.

10 Purchase Order Document Flow from Business Logic Perspective
Account access validation Encumbrance posting Created purchase order can then be submitted by certain roles for approval, during the submission account will be validated against the legacy financial system in real-time and if account passed all the validations, encumbrance will be posted to the legacy financial system. In process purchase order can also directly be approved by authorized personnel providing the entries in the purchase order passed certain business policy validations. Procurement (Office of Procurement and Real Property and Risk Management) is a central office that approves purchases over a certain dollar threshold ($25,000) or certain types of purchases. Purchasing at UH is decentralized and the departments have authority to make small purchases (< $25,000). Only those outside of their authority require approval and processing by Procurement.

11 ePurchasing Screen Captures
Now let’s browse through the screen captures of the application.

12 ePurchasing Login First, user access ePurchasing using a web browser and login with a user id and password

13 ePurchasing Main Menu Then user will select an option from the ePurchasing main menu, in this case we’ll go for ‘Pending requisition from SuperQuote’ option which will create a requisition with pre-filled information from SuperQUOTE bidding. Other options include starting a requisition with a blank form with only user default information populated.

14 ePurchasing Pending Requisitions
In the ‘Pending requisition using SuperQuote’ option user will see the recently created document listing and a search feature below it. User can either do lookup or select a document from the most recent document list identified by SuperQuote Number.

15 ePurchasing New Requisition Form
When user selected a document from the recent list or the search results, document header information is defaulted from the information entered in SuperQUOTE and the items portion is also defaulted from the SuperQUOTE request.

16 ePurchasing Requisition Submission
Next, after the requisitioner enters account information and other information as necessary, he/she can then save or submit the requisition for approval by an approval authority. Currently we allow 2 approval types, electronic approval and hard copy approval. The difference is whether the approving authority will be physically signing the paper requisition or if he will log on to the system and approve it online. If the requisition is approved online, then we print the approving authority's name and date of approval in the signature block. A requisition number is assigned once it’s saved.

17 ePurchasing Requisition Transfer
Once approved, the requisition can then be transferred to a purchase order and purchase order number will be automatically generated. A link is provided for easy retrieval of the newly created purchase order.

18 ePurchasing Purchase Order Form
If no other edits need to be made to the purchase order, the last step needed is to click on the Approve button If the account(s) pass business policy validations, the purchase order is approved and encumbrance is posted

19 ePurchasing Hardcopy Purchase Order
With a few clicks of a mouse and minimal data entry, you have a purchase order ready to send to the vendor! This step will eventually be accompanied by all-electronic-purchase-order with possible implementation of Web Services or with other protocols that enable the system to send information to the vendor electronically.

20 Let’s talk about Struts!
Now, 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 Struts is an open source framework for web application development created by Craig MacClanahan and was donated to Apache Software Foundation in the year The Struts framework provides the invisible underpinnings every professional Web application needs to survive. Struts helps you create an extensible development environment for your application, based on proven design patterns and published standards like Java Servlets, JavaBeans and XML. The framework is built using 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 Benefits of using Struts from the management perspective. First of all, it’s open source, which means purchasing is not necessary! Secondly, it has good documentation (online and offline) just like most java based tools. It is stable and mature since it’s been out there under constant improvement by industry experts for more than 2 years now. With its manageable learning curve, programmers will be able to adopt it easily. Because of these reasons, there are large user community that uses Struts; user community is one of the most important resources, where developers can find answers.

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 From a developer’s perspective, Struts is highly customizable, feature-rich, extendable and flexible, widely supported with many third party free tools. With its solid design, it lets developer concentrate on building a project rather than the code to support the project. In these days of tight timelines this is often the secret of success! As I mentioned before, Struts has large user community with very active mailing list; around 2000 to 3000 mails are sent out per day. Modularity! Allowing modular design, Struts breaks apart large processes across several customizable steps which is very crucial in the success of large size projects.

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 There are a few limitation of Struts especially in Struts version 1.0… First of all, building large and complicated forms within Struts can be complicated. Creating objects consist of a number of repetitive manual work. Secondly, it lacks the ability to use meta data to drive the creation of forms and the associated ActionForm. This feature is implemented for Struts 1.1, it’s called DynaActionForm. Lastly, implementing validation JavaScript in client-side form can be painful than using standard JSP. This is the trade-off by using the server side validation feature. Struts 1.1 have the validator feature to generate automatic JavaScript validation for form fields. Even with this improvement, pages that need intensive client-side scripting will always be a bit more difficult to build within Struts but it’s not impossible.

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 The framework features… It supports internationalization (I18n). Struts also have built in database support with JDBC connection pooling capabilities. It is compatible with varieties of model implementations and presentation layers. As with other Java based tools, it has the write once and 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 To be able to run Struts, a few free/open source components are needed, such as JDK 1.2 or higher, Servlet 2.2/JSP 1.1 container or higher and XML parser that’s compliant with JAXP 1.1 or higher.

27 Inside Struts Framework
Controller Model View Inside Struts framework…there are three components inside struts framework…the MVC…I know we’ve heard this over and over again but I will go through anyway just incase… Controller : controller is the component that manipulates the data object. Model: represents the data objects. The Model is what is being modified and presented to the user. View: Serves as the screen representation of the Model. It is the object that presents the current state of the data objects. It defines the way the user interface reacts to the user’s input.

28 Struts implementation of MVC in ePurchasing Architecture
Now how does this whole thing work…when a request is made from a previously displayed View… The request is received by the ActionServlet, which acts as the Controller, and the ActionServlet looks up the requested URI in an XML file (the struts-config) and determines the name of the Action class that will call the necessary business logic. The Action class calls a Model Components associated with the task which will do data manipulation and return the data to the action class. Once the Action has completed its processing, it returns control to the ActionServlet. As part of the return, the Action class provides a key that indicates the results of its processing. The ActionServlet uses this key to determine where the results should be forwarded for presentation. The request is completed when the ActionServlet responds by forwarding the request to the View that was linked to the returned key, and this View presents the results of the Action.

29 Controller More about controller…

30 Controller : Components
ActionServlet RequestProcessor Action Classes Controller components…Actionservlet, RequestProcessor, Action Classes. ActionServlet and RequestProcessor are provided by the framework We will not be talking too much of the technical detail about any of these but I will mention the basic definition of each of them in the next few slides.

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 ActionServlets… ActionServlets extend <javax.servlet.http.HttpServlets> Receives all framework requests Selects proper application module Delegates request handling to the RequestProcessor instance There is only one instance per web application Default implementation provided by framework (can be extended if necessary) May go away in future versions

32 Controller : RequestProcessor
One instance per web application module Processes all request for module Invokes proper Action instance Default implementation provided by framework RequestProcessor… Only one instance per web application module Processes all request for the module Invokes proper <Action> instance Default implementation provided by framework (can also be extended if necessary)

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 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 (Command pattern) Returns information about which view should be rendered and returned Part of the Controller (not the Model) Now let’s bring up the general requisition flow again…

34 Example of ActionMapping
<!-- Initial requisition form with user defaults --> <struts-config> <action-mappings type="org.apache.struts.action.ActionMapping"> <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> When the ActionServlet receives a request from the client, ActionServlet will translate the URI into specific class to invoke by specifying the attributes and the presentation file to use when sending out the responses to client using ActionMapping in struts-config.xml. Now let’s bring up the general requisition flow again to see how we can actually see the processes in terms of the action URIs…

35 Requisition Document Flow from Business Logic Perspective
This is the initial business logic perspective of document flow. I’ll narrow it down to only a few tasks and change it to action URIs.

36 The Journey of Requisition with Action URI
The red string below the tasks are the action URIs representing each task

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; }… ActionServlet will then invoke a specific Action class and pass on the HttpServletRequest and other related objects to that specific Action class. This is an excerpt of codes taken from “creating a new requisition” option. A new requisition will be pre-filled with default user information obtained from the database.

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 Action class invoke the model method to retrieve user’s info and set the necessary properties of an object that is going to be returned to the presentation layer shown previously in the example of ActionMapping.

39 Model Model classes access and manipulates the data from database and return it to the invoker Action class. This is where the business logic located in, in the model class.

40 Model : Facts No model components provided
Struts supports any model component - EJB, Corba, JavaBeans, etc Decouple model implementation from the framework Some facts about Model in Struts Framework… There’s no built-in support for the model. Programmers have to choose a model components. The good news is though, the framework supports any model component like EJB, Corba, etc. In ePurchasing we’re using JavaBeans. We should always keep in mind to decouple the application from a specific model implementation for modularity reasons.

41 Model Component of ePurchasing
Java Data Base Connectivity (JDBC 2.0) with Oracle Database utilizing Poolman Connection Pooling. EntireX Java ACI v by Software AG to tap into the IBM Mainframe for Remote Procedure Call. - In ePurchaisng, we are using several types of model components to access and manipulates our data. We use PoolMan JDBC connection pooling by CodeStudio (but not anymore). - We use RPC using the Natural Broker utilities by Software AG, the EntireX Java ACI to do transaction with out mainframe server.

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(); Next I will show some examples of the Model Classes in ePurchasing… Connection object is obtained from the PoolMan connection pooling and statement is created from it. PropertiesLoader is a class that open an application resource file and retrieve specified property from it.

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 Statement string is constructed and query is executed. The result can then be manipulated (not in this example) and can be used to populate the UserBean which holds all the user’s info. The user bean is then returned the Action class. In this example we can see how decoupling works, action class passes non-framework specific information to the model and action classes only need to know about UserBean.

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"> <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 Next I will talk about the Natural Broker as a Model… The Natural Broker utilities execute specific program running in the AdaBase Natural in our mainframe server using RPC. The call is sent to the server as a string of characters containing necessary call name and parameters including the return size of the result. Result then of course is returned according to specified size. An open connection to the host running the Broker program can be used for arbitrary number of invocations.

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 { This is an example of one of the classes that makes a call to the mainframe. Broker program parameter and receive buffer size are determined and pass-on to the Natural Broker object. Broker object performs the call.

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 … Results are obtained in byte arrays. Bytes of arrays are then parsed and manipulated as need before returning it to the invoker.

49 View After all the data manipulation is done and returned to the invoker action class, mapping to the presentation layer will be resolved and used to return to the client with the manipulated data.

50 View : Components Java Server Pages HTMLs JavaScripts and StyleSheets
Resources Bundles JavaBeans extending ActionForms Custom Tags - HTML, Bean, Logic The View component of ePurchasing consists of JSPs, HTMLs, JavaScripts, StyleSheets, Resource Bundles containing messages/error messages, JavaBeans extending ActionForms; used by views to display values. And Custom tags from Struts.

51 Future Improvements Upgrade to Struts 1.1
Utilize Validators and Tiles from Struts 1.1 Use XML/XSLT for View Component What’s new in 1.1? Because of tight timelines, currently we are still working on improving the application in terms of performance and technologies. First of all, we need to upgrade to Struts 1.1 because it offers helpful features to make codes more manageable like Validators, Tiles and Nested taglibs. Struts 1.1 also has ActionServlet that supports multiple applications. For the presentation layer, we are looking into the possibility of using XML/XSLT to replace the JSPs.

52 Questions? That’s it! Any questions?


Download ppt "ePurchasing System using Struts Framework"

Similar presentations


Ads by Google