Main Structure and Process of Application 3-10-2010 v1
Main Structure and Process of Application 3-10-2010 v1
Explaination
Main Structure and Process of
Application
USER
User Input
Application
Output
DAO Classes
(Create – Retrieve – Update - Delete)
APPLICATION
Executed Updates
Executed Queries
Database
(Employee
Transfer
Management
2010)
DATABASE
SERVER
In the Diagram above, you can see our Application has 4 (four) parts:
- BEAN classes: contain all data were got from Database in the application.
- DAO classes: Data Access Object – contains all methods which interact
directly with database.
- Graphic User Interface classes: are Jframes and its control which
interact directly with the User, then get/set data to/from BEAN object
- Utility classes: all the common functions like create & close connection,
cryptography tools, validate form tools etc. are stored in these classes.
Detail Classes Design
2.1 BEAN Classes
Bean Classes used to store all the data which has been got from Database,
or which has been input by user and will be inserted into database.
A Bean Class should store all the data in a respective table in database. It
also stores other necessary relative data.
- Properties correspond with all fields of a table in database and also contain
other relative data.
- Constructors (Default/Full Parameters) and Get/Set Method for all the
properties in the class
There are six Bean Classes in the Application correspond with six tables in
the database: Location, Department, Project, Role, Employee,
Transfer.
2.1.1 Location Bean
This class stores all the data which from Locations table.
Class : Location
Class : Department
Class : Project
Class : Project
Class : Employee
Class : Employee
In this Application, each DAO class executes CRUD functions for each
respective BEAN class. We have six Bean classes correspond six tables in
Database, and then we have to create six DAO classes to maintain CRUD
actions: LocationDAO, DepartmentDAO, ProjectDAO, RoleDAO,
EmployeeDAO, and TransferDAO.
A DAO class has to contain at least: selectAll, update, insert, and delete
methods. It also has some extra methods to execute some related action to
respective BEAN class.
In a method,
Class : LocationDAO
Method Name Return type Agruments Description
selectAllLocation List<Location> Get a list of Location objects from
Locations table
insertLocation int Location obj Get data from obj agrument, append
to query string, and insert into
Locations table. Return the most
recently insert LocationID
updateLocation void Location obj Get data from obj agrument, include
LocationID, and update that Location
object to Locations table
deleteLocation Void int locID Delete a record in Locations table
which has LocationId = locID
Class : DepartmentDAO
Method Name Return type Agrument Description
s
selectAllDepartment List<Department> Get a list of Department objects
from Departments table
insertDepartment int Department Get data from obj agrument,
obj append to query string, and
insert into Departments table.
Return the most recently insert
DepartmentID
updateDepartment void Department Get data from obj agrument,
obj include DepartmentID, and
update that Department object
to Departments table
deleteDepartment Void int deptID Delete a record in Departments
table which has DepartmentID =
deptID
2.2.3 Project DAO
Class : ProjectDAO
Method Name Return type Agruments Description
selectAllProject List<Project> Get a list of Project objects from
Projects table
insertProject int Project obj Get data from obj agrument, append
to query string, and insert into
Projects table. Return the most
recently insert ProjectID
updateProject void Project obj Get data from obj agrument, include
ProjectID, and update that Project
object to Projects table
deleteProject Void int projID Delete a record from Projects table
which has Project ID = projID
Class : RoleDAO
Method Name Return type Agruments Description
selectAllRole List<Role> Get a list of Role objects from Roles
table
insertRole int Role obj Get data from obj agrument, append
to query string, and insert into Roles
table. Return the most recently
insert RoleID
updateRole void Role obj Get data from obj agrument, include
RoleID, and update that Role object
to Roles table
deleteRole Void int roleID Delete a record from Roles table
which has RoleID = projID
2.2.5 Employee DAO
Class : EmployeeDAO
Method Name Return Agrumen Description
type ts
selectAllEmployeeByCondition List String Get a list of Employee objects
<Employee> condition from Roles table base on
input condition
selectAllEmployee List selectAllEmployeeByConditio
<Employee> n() with condition string = “”
selectOneEmployeeByID Employee int EmpID selectAllEmployeeByConditio
n() with condition string =
“EmployeeID = ” + EmpID.
If the result has row,return
the first record, else return
null.
insertEmployee int Employee Get data from obj agrument,
obj append to query string, and
insert into Employees table.
Return the most recently
insert RoleID
updateEmployee void Employee Get data from obj agrument,
obj include EmployeeID, and
update that Employee object
to Employees table
deleteEmployee Void int empID Delete a record from Roles
table which has EmployeeID
= empID
2.2.6 Transfer DAO
Class : TransferDAO
Method Name Return Agrumen Description
type ts
selectAllTransferByCondition List String Get a list of Tranfer objects
<Transfer> condition from Transfers table base on
input condition
selectAllTransfer List selectAllTransferByCondition(
<Transfer> ) with condition string = “”
selectOneTransferByID Transfer int EmpID selectAllTransferByCondition(
) with condition string =
“EmployeeID = ” + EmpID.
If the result has row,return
the first record, else return
null.
insertTransfer int Transfer Get data from obj agrument,
obj append to query string, and
insert into Transfers table.
Return the most recently
insert TransferID
updateTransfer void Transfer Get data from obj agrument,
obj include TransferID, and
update that Transfer object
to Transfers table
deleteTransfer void int tranID Delete a record from
Transfers table which has
TransferID = empID
2.3 User Interface Classes
- In GUI, we should include 2 libraries: SwingX and QuaQua look and feel
to make our Application friendlier.
Password PasswordField
Server Textfield
Action Performed :
Username Textfield Solve Connection Prolems
ButtonConfig
Password PasswordField
MainFrame
When the application run, the first frame display is Login Frame, the user
input username and password. Login Frame gets an object has type
Employee from EmployeeDAO. If object is not null, its mean valid user, then
the Login Frame will disappear, and MainFrame will display.
At the Login Frame, when the user click on Config button (if he/she gets
connection prolems) , the Connection Configurator will display, allow the
user can change Connection String, test new connection, and save it to file.
2.3.2 Main Frame
FUNTIONAL
PANELS
Sidebar Details Area (Respective Panel
will be included on
events created by
User)
When user login successfully, an Employee object will be got and pass into
the constructor of MainFrame. The MainFrame will display. MainFrame
splitted into 2 areas: the left one is Sidebar, the right one is Details Area
(most of tasks will be processed on this area).
There are 2 sidebars in MainFrame: one for NORMAL USER, one for
ADMINISTRATOR.
The Sidebar of MainFrame base on the Current User is System Admin or not,
then it display the respective sidebar.
Details Area will include components, which are derived from Jpanel
component. Each component has its own design and execute specified task
like: Employees Manage, Department Manage… correspond the required
functions.
Utility Classes
Utilitiy classes are the classes contain common methods which can be used
many times in other classes.
3.1 EmpConnection
This class maintains all tasks relate to the database connection like: open,
close, test…
Class : EmpConecction
Class : EmpConecction
3.3 ValidateFormTools
This class use to check a Text Field contains data or not, check 2
JpasswordField have the exactly same string, or check a string can be
converted into number(int, double) or not.
Class : EmpConecction