Enterprise Java Development@TOPIC@

Chapter 17. Project 1 Technical Details

17.1. Database Schema
17.1.1. eSales Candidate Database Schema
17.1.2. eBidbot Candidate Database Schema
17.2. Business Objects
17.2.1. eSales Candidate Business Objects
17.2.2. eBidbot Candidate Business Objects
17.3. Validation API
17.4. Sales Ingest
17.5. DAOs
17.5.1. eSales DAOs
17.5.2. Bidbot DAOs
17.6. SQL Tuning (Indexes)
17.7. Business Logic
17.7.1. eSales Business Logic
17.7.2. eBidbot Business Logic

Note

There are a lot of technical details presented with this specification. This is done to provide clarity and a starting point for design discussion. However, it is not done so to specify specific class or method naming, project layout, or order of work. You are free to make many technical adjustments to the ideas presented.

Design 2 sets of database schema that account for the following information. Although we will deploy the 2 database schemas to the same database for the project, they should be designed to be independently deployed to separate databases. eSales and eBidbot are two independent applications. This will primarily affect your attempt re-use tables or to make primary key assumptions between the two.




Add validation API declarations to your business objects as appropriate. This need not be extensive or exhaustive. Just do enough to show use of declarative validation as a part of your application.

Design and implement a mechanism to ingest a starting state for eSales based on a provided data file and parser. You will implement two primary sets of classes to support this requirement; the DAO(s) and an Ingestor.


Note

Please ignore references in the diagrams that call out use of JDBC. All DAOs can be implemented exclusively with JPA for this assignment.

Design and implement a DAO layer that will map the business objects between the object model and the database using the Java Persistence API (JPA). These DAOs will support all standard CRUD operations and can optionally implement the same interface as other potential DAO implementations. The implementation can make liberal use of JPA @Annotations, descriptor files, or a combination of both. Your interface should encapsulate the fact that an EntityManager is being used and the same EntityManager should be shared among other DAOs in the same Thread. Your DAOs should not attempt to control the transaction or they will NOT be portable to the EJB tier.

Add tuning to your database schema by augmenting the DDL files with indexes for foreign keys, joins, and where clauses. This need not be extensive or exhaustive. Just do enough to show that proper data model and database tuning is part of the overall enterprise development process.

Design an initial business interface and business logic for the applications. The core O/R mapping work will be done by the DAOs. However, it is the ultimate responsibility of these business logic implementations that either it or the business objects enforce the business rules of the application. The DAOs only perform O/R mapping and do not enforce such things as a minimum bid. The business logic is assumed to work within the context of a single, externally controlled transaction. Do not attempt to control the transaction of the EntityManager within these objects or you will NOT be portable to the EJB tier. You need only implement the behavior required to implement the end-to-end use case listed in the testing section. Some of the anticipated methods are listed below.


AccountMgmt/AccountMgmtImpl

encapsulates the actions required to create, get, update and close an account.

  1. createaccount - you will need to at least create a seller and two or more buyer accounts.

SellerMgmt/SellerMgmtImpl

encapsulates the actions required to create and get auctions for a seller.

  1. createAuction - creates a new auction for a seller. All dates and properties of the auction need to be of consistent and legal values.

  2. getUserAuctions - returns a collection of auctions associated with a seller. This can be used to determine if the auction has been added.

  3. getAuction - returns a specific auction by ID. This can be used to track the state of a specific auction for a seller.

BuyerMgmt/BuyerMgmtImpl

encapsulates the actions required to get and bid on auctions.

  1. getOpenAuctions - returns a collection of auctions that have not ended. This can be used to pick a specific auction to bid on.

  2. placeBid - creates a bid for a specific user and auction. The auction must be open, the user must exist, and the bid amount must be greater than any pre-existing bid.

  3. getAuction - returns a specific auction by ID. This can be used to track the state of a specific auction for a buyer.

TestSupport/TestSupport

a useful tool during testing that encapsulates how to get the application back into a known state prior to running a test or to inspect values not normally exposed through the normal business interfaces.

  1. getAccounts - get all accounts in the system.

  2. removeAccount - sanely remove an account from the system. This may require removing the account from any current bids, etc. in order to satisfy referential integrity.

  3. getAuctions - get all auctions in the system.

  4. removeAuction - sanely remove an auction from the system. This may require removing bids, images, and other objects that may have references to this object.

  5. clearAll - sanely take the state of the system down to a coldstart.

Ingestor

the Ingestor written as a part of a separate requirement is also logically considered part of this tier.

  1. ingest - point an externally provided parser at a set of test data and use the DAOs to populate the system to a known state.