Professional Documents
Culture Documents
CODE WALKTHROUGH
-AK
Web -Flow
A user browses to the site where ePASS is installed. The web server encounters a file with a .JSP extension, and passes it to the JRun servlet engine for interpretation. The JRun servlet engine checks to see if the JSP file has already been compiled. If the JSP file has been compiled, the JRun servlet engine tells the Java Virtual Machine (JVM) to run the corresponding CLASS file. If the JSP file has not been compiled, the JRun servlet engine translates it into a Java file, that it subsequently compiles. Then the JRun servlet engine tells the JVM to run the resulting CLASS file. When it runs the CLASS file, the JVM builds the HTML document and forwards it to the JRun servlet engine. The JRun servlet engine forwards the HTML document to the web server. The web server displays the HTML files on the browser.
START
Lets Open one JSP page and walkthrough that.. *A very simple JSP file - detail_prod.jsp *Also, open the create item page in UI
JSP Page
Import Declarations head.jsp section Variable Declarations Logic section HTML section tail.jsp section
EPASS API
When user is creating a new organization or performing any other ePASS operation, the relevant JSP is instancing Java classes and invoking their methods of Epass API.
ApplicationServices Package
This package contains Java interfaces that are frequently instanced in JSPs. Examples: A. OrganizationServiceIntf B. BiddingServiceIntf C. AuctionDataServiceIntf Lets Walkthrough these files
Some more services: MessageServiceIntf - By invoking the methods defined for this interface, a JSP can be used to manipulate messages in context. (lets walkthrough this.. Focus on return type)
Structs Package
The Structs package contains several classes that let you retrieve data from or write data to the ePASS database, through intermediary business objects. IMP: we also need to import these packages in our JSP. Usually, services returns Struct objects.
BusinessLogic.Key Package
The BusinessLogic.Key package is an additional ePASS package It is used in conjunction with the Structs package. This package contains several classes called KeyImpls. A KeyImpl is used to store the database key of the record where object data is stored.
EPASSReferences
Instances of this class are used to contain information needed by ePASS code throughout the life of a request. An EPASSReferences instance contains the request, response, structures, current context and business service references. Its availabe in below build path:
com/avinamart/WebInterface/EPASSReferences .java
Data Members
HttpServletRequest req HttpServletResponse res UserDataContext userDataContext EPASSStructsReference structs An ePASS object that stores any type of ePASS struct currently used. SessionService sessionService An ePASS object that stores the users session information. EPASSServicesReference serviceRef An ePASS object that stores ePASS Application Services reference. EPASSKeyReference keyRef An ePASS object that stores ePASS object keys being used by this user. OrganizationKeyImpl orgKey An ePASS object that stores the primary key of a database entry describing an organization. And more.
Possible Actions
com/avinamartWebInterface/EPASSJSPA ctions.java
Lets Walkthrough this
Continue
4. Create a new instance of the BusinessUserStruct and add it to the Epass Reference Object 5. Read the contents of the form, stored in the HttpRequest object and copy the data to the BusinessUserStruct. To make use of the static convert- ToStruct method, it needs to add a special prefix to all input fields on the form so that those fields can be specifically identified on the back-end.
6. Call the UIWrapper to add organization. Pass in the reference object, which contains the Organization and Business User struct(step 5). Returned is an Organization key that is used to identify the database record of the newly created Organization and Business user.
OrganizationKeyImpl orgKey = EPASSUiAdminServices.createOrganization(ref ); Note: Struct has all the methods defined to access the data base. Somewhere which calls Service, and Service calls QueryBean.
Continue
Reference Files: com/webinterface/EPASSUiAdminServices.java search for _createOrganization method com/webinterface/OrganizationStruct.java com/webinterface/BusinessUserStruct.java com/avinamart/webinterface/EPASSReferences.java com/avinamart/webinterface/EPASSStructsReference.ja va
Creating RFQ
1. Create a new instance of AuctionStruct, and add it to the Epass Reference object. AuctionStruct auctionxyx = new AuctionStruct(); ref.structs.auctionStruct = auctionxyx; 2. Read the contents of the form, stored in the HttpRequest object and copy the data to the AuctionStruct struct. RequestUtility.convertToStruct(StructSchemaManager.getSchema( AuctionStruct.class),request, ref.structs.auctionStruct);
Continue
Reference Files AuctionConfigurationService has saveAuction Method.
THANK YOU !