This is a GUI Java
application that can process orders from clients. It works with a MySQL
database. Uses the JDBC
driver.
Use Cases...
As you can see a lot of stuff can be done like adding shippers, searching for products, orders etc.
This is the diagram of the relational database. A dump file is included in the project. Export it to your MySql
Framework. The database was made using MySql WorkBench
.
- The Presentation layer consists of 4 classes and is organized on the MVC model:
View
: it contains all the methods for constructing the GUIModel
: contains the methods that will further communicate with the Model classesController
: adds the functionality of the Model class to the ViewTableContent
: it is an enum and it is used to store the current state of the table showing on the screen(in the class View there is only 1 table and its content is always changed according to which button is pressed)
- The Model layer contains 1 parent class and 6 child classes. For every table in the database, there is a corresponding class with EXACTLY the same field names and field data types.Category
,Client
,Supplier
,Shipper
,Product
,Orders
– are the child classesAbstractModel
is the parent class and it extendsAbstractBLL
class(so every model class extendsAbstractModel<T extends AbstractBLL>
where T is the corresponding BLL class for every table. In this way, for every model class, its corresponding BLL class can be stored easily so the programmer does not need to verify it each time for what model class what bll class corresponds…
- The Model Layer(BLL) contains classes that implement the application logic. TheAbstractBLL
abstract class contains the methods for communicating with theDAO
classes(update/insert/delete/find). But it also contains methods which can be applied to different model objects before inserting them into the database or after extracting them from the database. For every model class there is a corresponding BLL class which extends the parentAbstractBLL
and each of these classes override thegetValidators()
method which returns a List with the validators that need to be applied only to that particular model class.- validators: there is another subpackage named
validators
in the bll package which contains all the classes that are used for validating data: and Email validator, a Phone validator, and a Date validator. These classes implement the interfaceValidator
and add functionality to the one, single method in the interface: validate. - data: for now, this subpackage contains only one class named
OrderFile
which does not else but creates a .txt file for each order.
- The Infrastructure layer is further divided into 2 more packages:dao
andconnection
. connection
: contains a singleton classConnectionFactory
which is responsible for accessing the database, retrieving connections and closing connections.dao
: contains an abstract class namedAbstractDAO
which implements all the necessary operations which need to be implemented on a table like: insert, delete, find by id, find all, update. It works with generic model objects. There are 6 otherdao
classes which are the children ofAbstractDAO
and they are the correspondingdao
classes for the model classes one by one and they add full functionality to the parent class in the sense that the parent class knows with what type of data it is working on.
- The UML diagram in the package
dao
:
- The UML diagram in the package
model
:
- The UML diagrams in the package
bll
with its 2 subpackages:
- The UML diagram in the package
presentation
:
- After the application starts, the end user will see this:
- To view other tables, one button from the top needs to be pressed:
- For operations, use the buttons on the left:
- For updating a row, simply select the cell you want to modify, double click it and then modify to your needs. Then either press enter or double click elsewhere. Then press the
update
button. - For inserting a new row, press the
insert
button, and then introduce the new fields. Be attentive when introducing the values and introduce only valid data. PressOK
. If you get the message:Insert Successful
, it means that you inserted the row successfully else you will get a warning message alongside a log in the console. Check it to further explanation of the error. - For deleting a row, simply click once a row, and it will be colored in blue. Press the
delete
button. Whoala. - For searching for specific elements, you have to first choose the field for which you are applying the filter then in the input box, type your data for which you want to search. If the chosen field has a
String
format then the option bigger/smaller don’t have any purpose for now. Just press OK. All the rows having the field that contain theString
you entered will appear. Fornumber
formats, use the bigger/smaller button to search for bigger, smaller values. If you do not select any of the 2, only equal values will be showed to you. When searching forDate
format, you can use the bigger/smaller option as well to search for previous dates or dates after a given date. - To show the total number of rows, simply press the
totals
button and then enter. For the tableOrders
andProduct
there is one more option for selecting the total number of quantities. - GOOD LUCK!