EMP-DEPT
This is an implementation of the familiar
EMP-DEPT database using the Object Oriented features of Oracle 9i.
Problem Definition
The basic problem has three tables:
- a table of departments
- a table of employees
- a table defining the limits of each salary grade
This Rose Model represents the basic EMP-DEPT model.
Some additions to the original problem have been made to make things more interesting.
- a new Class Staff with two subclasses Salaried and Contractor
- a method in Department to total the saleries
- a method in each of Salaried and Contractor to calculate the annual salary
- Object reference - an object reference from staff to dept.
Technical description
A complication here is the need to order the declarations to ensure that each type, and table is defined
before it is referenced. The reverse problem occurs when the system is deleted:
tables and types cannot be removed if they are still being used.
So we have to split up the declaration of a type from the implementation (body) of the type.
The order of presentation here is the order in which the parts need to be declared.
In a realistic system, we would have to use a code management system which would know about these dependencies and
would execute the updates to the schema in the correct order.
Extensions to the Basic Model
Work to do
You may like to use Rational Rose here to model the changes in the system as you make them.
- Read and understand the structure of the EMP-DEPT OO implementation
- Develop a complete Class (type) diagram ( perhaps using Rational Rose) of the EMP-DEPT system
- Consider how you would make the following further additions to the system:
- add a new subtype of staff to hold volunteers who are paid an annual gratuity.
Define a new version of annualsal for this type of staff.
- [done] using the Step Function type, define the salary grade
- [done] add a member function to Salaried to return the appropriate grade
- [done] add children to staff, with a variable number of child objects, each defining a name and dob
- implement the manager association using object reference
- add a member function to Staff to return their manager's name
- add a member function to Staff to return their level in the hierarchy ( i.e. the number of managers above them + 1)
- add a member function to return the age of a member of staff in years
- add a member function to return the length of service in years
Work for me to do
- some forms and results
- bring rose model and oracle implementation into line
- do something with the children
- add all the emp data
- add integrity constraints