You are on page 1of 52

Rational Software

Payroll System Use-Case Design Solution

Version 2003
Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

Revision History
Date Issue Description Author
09/01/2000 V2000 Generate for beta Shawn Siemers
10/02/2000 V2000 Final release Shawn Siemers
01/14/2003 V2003 Final Release Alex Kutsick

Confidential Rational Software, 2003 Page 2 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

Table of Contents
1. Exercise: Use-Case Design, Part 1 5
1.1 Use-Case Realization - Run Payroll 5
1.1.1 Run Payroll (with ss interface) 5
1.1.2 Run Payroll (with Security) 8
1.1.3 Run Payroll (with Distribution) 10
1.1.4 Run Payroll (with OODBMS Persistency) 13
1.1.5 Run Payroll (with everything) 16
1.2 Use-Case Realization - Maintain Timecard 19
1.2.1 Maintain Timecard (with ss interface) 19
1.2.2 Maintain Timecard (with Security) 21
1.2.3 Maintain Timecard (with Distribution) 24
1.2.4 Maintain Timecard (with OODBMS Persistence) 27
1.2.5 Maintain Timecard (with everything) 30
1.3 Use-Case Realization - Login 37
1.3.1 Login 37
1.3.2 Login (with Security) 39
1.4 ObjectStore Support 42

2. Exercise: Use-Case Design, Part 2 49


2.1 Packages and Their Dependencies 49
2.1.1 Package Descriptions 49

Confidential Rational Software, 2003 Page 3 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

Payroll System Use-Case Design Solution


1. Exercise: Use-Case Design, Part 1
1.1 Use-Case Realization - Run Payroll

1.1.1 Run Payroll (with ss interface)


Run Payroll - Basic Flow (with ss interface)

: : : Employee : Timec ard : : Paycheck : IPrintService : Printer : IBankSystem


: System Clock : Bank System
SystemClockInt erface PayrollController PurchaseOrder

1. // start( )

1.1. // run payroll( )


1.1.1. // is payday?( )

1.1.2. // get pay amount( ) Commis sioned


employees also need
1.1.2.1. // get timecard info( ) to ret rieve POs

1.1.2.2. // get PO info( )

Perform t hese steps 1.1.2.3. // calculatePay( )


for eac h employee

1.1.3. // create with amount(float)

1.1.4. // get pay amount( ) For mail or


pick-up
a paycheck is
1.1.5. print(Paycheck, String) printed
1.1.5.1. // print( )

For direct-deposit a
1.1.6. // get bank info( ) transaction is
created to send the
payment information
1.1.7. deposit(Paycheck, BankInformation)
1.1.7.1. // send transaction( )

Confidential Rational Software, 2003 Page 5 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

Run Payroll - Basic Flow (with ss interface)

: SystemClockInterface
:
1. // start( ) IPrintService
1.1.5. print(Paycheck, String)
1.1. // run payroll( ) 1.1.5.1. // print( )

: PayrollController
: System Clock 1.1. 1. // is payday ?( )
1.1.2. // get pay amount( )
1.1.4. // get pay amount( )
1.1.6. // get bank info( ) : Printer
1.1. 3. // creat e with amount (float)

1.1.7. deposit(Paycheck, BankInformation) 1.1.2.3. // calculatePay( )

:
Pay check
: IBankSystem
: Employee

1.1.2.1. // get timec ard info( )

1.1.2.2. // get PO info( )

1.1.7.1. // send transaction( )


: :
PurchaseOrder Timecard

: Bank System

Confidential Rational Software, 2003 Page 6 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

Run Payroll - VOPC (with ss interface)

<<Interface>>
<<boundary>>
<<control>> direct deposits checks via IBankSystem
SystemClockInterface 0..1 (from External System Interfaces)
PayrollController
1 1 0..1
// start() 0..1 + deposit()
0..1
0..1
0..*
<<entity>>
+paycheckPrinter
Employee
name 0..1 <<Interface>>
employee id : int IPrintService
bank info : BankInformation (from External System Interfaces)
social security number
address + print()
phone number
email
payment method

// is payday?() +generatedPaychecks
// get pay amount() 1
// get payment method() 0..*
<<entity>>
// get bank info() : BankInformation
1 0..* Paycheck
// calculatePay()
// add(theTimecard : Timecard) amount
// get Employee ID() : int 0..* <<entity>>
// getTimecard(forPayPeriod : Date) : Timecard // create with amount(forAmount : float) : Paycheck
Tiadd(thePaycheck
// d : Paycheck) hours worked
pay period

// get timecard info()


// update timecard()
// new()
<<entity>> <<entity>> // save()
HourlyEmployee SalariedEmployee
hourlyRate annualSalary

+ // getHourlyRate() + // getAnnualSalary()

<<entity>>
CommissionedEmployee <<entity>>
commissionRate PurchaseOrder

1 0..*
+ // getPurchaseOrders() // get PO info()
+ // getCommissionRate()

Confidential Rational Software, 2003 Page 7 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

1.1.2 Run Payroll (with Security)


Run Payroll - Basic Flow (with security)
This is the same collaboration diagram as Run Payroll (with ss interfac e).
There are no additional proces sing steps for Security for Run Pay roll, as the
PayrollController is meant to be "all-knowing" and "all-seeing" and thus, has
open access to all secure dat a for Employ ees.

1. // start( )
: SystemClockInterface
:
IPrintService
: System Clock
1.1.5. print(Paycheck, String)
1.1. / / run payroll( ) 1.1.5.1. // print( )

: Pay rollController
1.1.1. // is payday?( )
1.1. 2. // get pay amount ( )
1.1. 4. // get pay amount ( )
1.1. 6. // get bank info( ) : Printer
1.1.3. // create with amount(float)

1.1.7. deposit(Paycheck, BankInformation) 1.1.2.3. // calculatePay( )

:
Paycheck
: IBankSystem
: Employee

1.1.7.1. // send transaction( ) 1.1. 2.1. / / get timecard info( )

1.1.2.2. // get PO info( )

: :
PurchaseOrder Timecard
: Bank System

Confidential Rational Software, 2003 Page 8 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

Run Payroll - VOPC (with Security)


This is the same VOPC as Run Payroll (with ss interface).
There are no additional processing steps for Security for Run Payroll, as the
PayrollController is meant to be "all-knowing" and "all-seeing" and thus, has
open access to all secure data for Employees.

<<Interface>>
<<boundary>>
<<control>> direct deposits checks via IBankSystem
SystemClockInterface 0..1 (from External System Interfaces)
PayrollController
1 1 0..1
// start() 0..1 + deposit()
0..1
0..1
0..*
<<entity>>
+paycheckPrinter
Employee
name <<Interface>>
0..1
employee id : int IPrintService
bank info : BankInformation (from External System Interfaces)
social security number
address + print()
phone number
email
payment method

// is payday?() +generatedPaychecks
// get pay amount() 1
// get payment method() 0..*
<<entity>>
// get bank info() : BankInformation
1 0..* Paycheck
// calculatePay()
// add(theTimecard : Timecard) amount
// get Employee ID() : int 0..* <<entity>>
// getTimecard(forPayPeriod : Date) : Timecard Timecard // create with amount(forAmount : float) : Paycheck
// add(thePaycheck : Paycheck) hours worked
pay period

// get timecard info()


// update timecard()
// new()
<<entity>> <<entity>> // save()
HourlyEmployee SalariedEmployee
hourlyRate annualSalary

+ // getHourlyRate() + // getAnnualSalary()

<<entity>>
CommissionedEmployee <<entity>>
commissionRate PurchaseOrder

1 0..*
+ // getPurchaseOrders() // get PO info()
+ // getCommissionRate()

Confidential Rational Software, 2003 Page 9 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

1.1.3 Run Payroll (with Distribution)


Run Payroll - Basic Flow (with Distribution)

: : Naming. : : Employee : Timecard : : Paychec k : IPrintService : Printer : IBankSystem


: System Clock : Bank System
SystemClockInt erface IPayrollController PurchaseOrder

1. // start( ) Look up remote object by


spec ifying it's URL. This
1.1. lookup(String)
returns a reference to t he
remote object interface.

1.2. / / run pay roll( )


1.2.1. // is pay day?( )
All calls are forwarded to Commissioned
the remote object employees also need
1.2.2. // get pay amount( )
to ret rieve POs
1.2.2.1. // get timecard info( )

1.2.2.2. // get PO info( )

Perform these steps


for each employee 1.2. 2.3. / / calculatePay( )

1.2.3. // creat e with amount(float)

1.2. 4. // get payment method( ) For mail or


pic k-up
a paycheck is
printed
1.2.5. print(Paycheck, String)
1.2. 5.1. // print( )
For direct-deposit a
transaction is
created to send the
1.2.6. // get bank info( ) payment information

1.2.7. deposit(Paycheck, BankInformation)


1.2.7.1. // send transaction( )

Confidential Rational Software, 2003 Page 10 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

Run Payroll - Basic Flow (with Distribution)

: Naming.
1.2.2.3. // calculatePay( )
:
1.1. lookup(String) 1.2.1. // is payday?( )
1.2. 2. // get pay amount ( ) 1.2.2.1. // get timecard info( )Timecard
1.2. // run payroll( ) 1.2.4. // get payment method( )
1.2. 6. // get bank info( )
: SystemClockInterface : IPayrollController : Employee

1.2.2.2. // get PO info( )


1. // start( )

:
PurchaseOrder
1.2.5. print(Paycheck, String)

1.2.3. // create with amount(float)


System Clock 1.2.7. deposit(Paycheck, BankInformation)

: IBankSystem
:
Paycheck
:
IPrintService
1.2.7.1. // send transaction( )

1.2. 5.1. / / print ( )

: Bank System

: Printer

Confidential Rational Software, 2003 Page 11 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

Run Payroll - VOPC (with Distribution)


Naming.
(from java.rmi)

<<Interface>>
+ lookup() IPayrollController
(from Payroll) UnicastRemoteObject
PayrollController is (from Server)
distributed
Remote + // run payroll()
(from java.rmi)
# UnicastRemoteObject()
+ clone() Serializable
+ exportObject()
(from java.io)

<<Interface>>
<<boundary>> <<control>>
direct deposits checks via IBankSystem
SystemClockInterface PayrollController 0..1 (from External System Interfaces)

0..1
// start() // run payroll() 0..1 + deposit()
0..* 0..1
0..1
<<entity>>
+paycheckPrinter
Employee
name 0..1 <<Interface>>
employee id : int IPrintService
(from External System Interfaces)
bank info : BankInformation
social security number
address + print()
phone number
email
payment method

// is payday?()
// get pay amount()
// get payment method() 1 +generatedPaychecks
// get bank info() : BankInformation
// calculatePay() 0..*
// add(theTimecard : Timecard) <<entity>>
0..*
// get Employee ID() : int Paycheck
1 amount
// getTimecard(forPayPeriod : Date) : Timecard
// add(thePaycheck : Paycheck)
// create with amount(forAmount : float) : Paycheck
0..*
<<entity>>
Timecard
hours worked
<<entity>> <<entity>> pay period
HourlyEmployee SalariedEmployee
hourlyRate annualSalary // get timecard info()
// update timecard()
+ // getHourlyRate() + // getAnnualSalary() // new()
// save()

<<entity>>
CommissionedEmployee <<entity>>
commissionRate PurchaseOrder

1 0..*
+ // getPurchaseOrders() // get PO info()
+ // getCommissionRate()

Confidential Rational Software, 2003 Page 12 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

1.1.4 Run Payroll (with OODBMS Persistency)


Run Payroll - Basic Flow (with OODBMS Persistency)

: : : : Employee : Timecard : : Paycheck : IPrintService : IBankSystem : Bank System


: System Clock : Printer
SystemClockInterface PayrollController PayrollDBManager PurchaseOrder

1. // start( ) When the Employee is


retrieved from the database,
1.1. // run payroll( ) the Timecards and
PurchaseOrders are
1.1.1. getEmployee(string) retrieved as well
Sequence Diagram:
OODBMS Support /
1.1.2. // is payday?( ) PayrollDBManager - Get
Employee
1.1.3. // get pay amount( )
Commiss ioned
Perform these steps 1.1.3.1. / / get timecard info( ) employees also need
for each employee to ret rieve POs

1.1.3.2. // get PO info( )

1.1.3.3. // calculatePay( )

Create a new
1.1.4. // create with amount (calculatedPay )
paycheck for the
employee 1.1.5. // add(Paycheck)
containing the
calculated pay.

1.1.6. save(Paycheck, Employee) For mail or


pick-up
Sequence Diagram: a paycheck is
OODBMS Support / 1.1.7. // get payment method( ) printed
PayrollDBManager -
1.1.8. print(Paycheck, String)
Save Paycheck
1.1.8.1. / / print ( )
For direct-deposit a
transaction is
1.1.9. // get bank info( )
created to send the
payment information

1.1.10. deposit(Paycheck, Bank Informat ion)


1.1.10.1. // send transaction( )

Confidential Rational Software, 2003 Page 13 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

Run Payroll - Basic Flow (with OODBMS Persistency)

:
Timecard
1.1.2. // is payday?( ) 1.1.3.3. // calculatePay( )
1.1.3. // get pay amount( )
1.1.5. // add(P aycheck) 1.1. 3.1. // get t imecard info( )
1.1.7. // get payment method( )
1. // start( ) 1.1. // run payroll( ) 1.1.9. // get bank info( )
: SystemClockInterface : PayrollController : Employee

1.1.3.2. // get PO info( )


: Syst em Clock
1.1.4. // create with amount (calculatedPay)

1.1.10. deposit(Paycheck, BankInformation) :


PurchaseOrder
1.1.8. print(Paycheck, String)
:
Pay check
: IBankSystem
1.1.1. getEmployee(string)
1.1.6. save(Paycheck, Employee)
1.1.10.1. // send transaction( )
:
IPrintService
: PayrollDBManager

1.1. 8.1. // print ( )


: Bank System

: Printer

Confidential Rational Software, 2003 Page 14 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

Run Payroll - VOPC (with OODBMS Persistency)

<<control>>
PayrollController
<<boundary>>
0..1
SystemClockInterface 1
1 1 0..1 0..1
0..1 direct deposits checks via
// start()

1
PayrollDBManager
(from ObjectStore Support) <<Interface>>
+paycheckPrinter 0..1 IBankSystem
(from External System Interfaces)
+ save()
+ getTimecard() 0..1 <<Interface>>
+ getEmployee() IPrintService + deposit()
(from External System Interfaces)

0..* + print()
<<entity>>
Employee
name
employee id : int
bank info : BankInformation +generatedPaychecks
social security number
address 0..*
phone number <<entity>>
email Paycheck
payment method
amount
1 0..*
// is payday?()
// create with amount(forAmount : float) : Paycheck
// get pay amount()
// get payment method() 1
// get bank info() : BankInformation
// calculatePay() <<entity>>
0..*
// add(theTimecard : Timecard) Timecard
// get Employee ID() : int hours worked
// getTimecard(forPayPeriod : Date) : Timecard pay period
// add(thePaycheck : Paycheck)
// get timecard info()
// update timecard()
// new()
// save()
<<entity>> <<entity>>
HourlyEmployee SalariedEmployee
hourlyRate annualSalary

+ // getHourlyRate() + // getAnnualSalary()

<<entity>>
CommissionedEmployee <<entity>>
commissionRate PurchaseOrder

1 0..*
+ // getPurchaseOrders() // get PO info()
+ // getCommissionRate()

Confidential Rational Software, 2003 Page 15 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

1.1.5 Run Payroll (with everything)


Run Payroll - Basic Flow (with everything)

: : Naming. : : : Employee : Timecard : : Paycheck : IPrintService : Printer : IBankSystem


: Syst em Clock : Bank System
SystemClockInt erface IPayrollController PayrollDBManager PurchaseOrder

1. // start( ) Lookup remote object by When the Employee is


specifying it's URL. retrieved from the database,
1.1. lookup(String)
This returns a reference the Timecards and
to the remote object PurchaseOrders are
interface. retrieved as well
1.2. // run payroll( ) Sequence Diagram:
OODBMS Support /
1.2.1. getEmploy ee(string) Pay rollDBManager - Get
All calls are forwarded to Employee
the remote object
1.2.2. // is payday?( )

Perform these steps


1.2.3. // get pay amount( )
for each employee Commis sioned
employees also need
1.2.3.1. // get timecard info( ) to ret rieve POs

1.2.3.2. // get PO info( )

1.2.3.3. // calculatePay( )

Create a new
paycheck for the 1.2.4. // create with amount (calculatedPay)
employee
containing the 1.2.5. // add(Paycheck)
calculated pay.
For mail or
1.2.6. save(Paycheck, Employee) pick-up
a paycheck is
Sequence Diagram: printed
OODBMS Support / 1.2.7. // get payment method( )
PayrollDBManager -
Save Paycheck 1.2.8. print(Paycheck, String)
1.2.8.1. // print( )

For direct-deposit a
1.2.9. // get bank info( ) transaction is
created to send the
payment information
1.2.10. deposit(Paycheck, BankInformation)
1.2.10.1. // send transaction( )

Confidential Rational Software, 2003 Page 16 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

Run Payroll - Basic Flow (with everything)


: Naming.
1.2.3.3. // calculatePay( )
1.2.2. // is pay day?( )
1.2.3. // get pay amount( )
1.1. lookup(String) 1.2.5. // add(Paycheck)
1. // start( ) 1.2. 7. // get payment method( )
1.2. // run payroll( ) 1.2.9. // get bank info( ) 1.2.3.1. // get timecard info( )
: SystemClockInterface :
: IPayrollController : Employee
Timecard

1.2.3.2. // get PO info( )


Syst em Clock

1.2.4. // create with amount (calculat edPay)


:
PurchaseOrder

1.2.10. deposit(Paycheck, BankInformation)

1.2. 8. print (Payc heck, String) :


Paycheck

1.2.1. getEmployee(string)
1.2.6. save(Paycheck, Employee)
: IBankSystem

1.2.10.1. // s end t ransaction( )


: PayrollDBManager

:
IPrintService
: Bank System

1.2.8.1. // print( )

: Printer

Confidential Rational Software, 2003 Page 17 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

Run Payroll - VOPC (with everything)


PayrollController is
distributed <<Interface>>
IPayrollController
(from Payroll)
UnicastRemoteObject
+ // run payroll() Remote (from Server)

(from java.rmi)

<<boundary>>
SystemClockInterface <<control>>
PayrollController 0..1 direct deposits checks via
<<Interface>>
// start() IBankSystem
1 0..1 0..1 (from External System Interfaces)
0..1 0..1
+ deposit()
PayrollDBManager1
(from ObjectStore Support)

Naming. + save() +paycheckPrinter


(from java.rmi) + getTimecard() 0..1
+ getEmployee() <<Interface>>
+ lookup() IPrintService
(from External System Interfaces)

0..* + print()
<<entity>>
Employee
name
employee id : int
bank info : BankInformation +generatedPaychecks
social security number
address 0..*
phone number <<entity>>
email Paycheck
payment method
amount
1 0..*
// is payday?()
// get pay amount() // create with amount(forAmount : float) : Paycheck
// get payment method() 1
// get bank info() : BankInformation
// calculatePay() <<entity>>
// add(theTimecard : Timecard) 0..* Timecard
// get Employee ID() : int hours worked
// getTimecard(forPayPeriod : Date) : Timecard pay period
// add(thePaycheck : Paycheck)
// get timecard info() Serializable
// update timecard() (from java.io)
// new()
// save()
<<entity>> <<entity>>
HourlyEmployee SalariedEmployee
hourlyRate annualSalary

+ // getHourlyRate() + // getAnnualSalary()

<<entity>>
CommissionedEmployee <<entity>>
commissionRate PurchaseOrder
0..*
+ // getPurchaseOrders() 1 // get PO info()
+ // getCommissionRate()

Confidential Rational Software, 2003 Page 18 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

1.2 Use-Case Realization - Maintain Timecard

1.2.1 Maintain Timecard (with ss interface)


Maintain Timecard - Basic Flow (with ss interface)

: : : Timecard : Employee :
: Employee : Project
TimecardForm TimecardController IProjectManagement Database
Management
1. // maintain timecard( ) Get Timec ard for
current pay period.
1.1. // get current timecard( )
1.1. 1. // getTimecard(Date)

1.2. // display timecard( )

1.3. // get charge codes( )


1.3.1. get ChargeNumbers(String)
1.3.1.1. // get charge numbers( )

2. // enter hours for charge numbers( )

2.1. // update timecard( )

2.1.1. // update timecard( )

3. // save timec ard( )


3.1. // save timecard( )
3.1.1. // save( )

Confidential Rational Software, 2003 Page 19 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

Maintain Timecard - Basic Flow (with ss interface)


1.2. // display timecard( )

: :
TimecardForm IProjectManagementDatabase
1. // maintain timecard( )
2. // enter hours for charge numbers( )
3. // save timecard( )
1.1. // get current timecard( ) 1.3.1.1. // get charge numbers( )
1.3. // get charge codes( ) 1.3. 1. get ChargeNumbers(St ring)
2.1. / / updat e t imecard( )
3.1. // save timecard( )

2.1.1. // update timecard( )


: Employee 3.1.1. // save( )
: : : Project Management
TimecardController Timecard Database

1.1.1. // getTimecard(Date)

: Employee

Maintain Timecard - VOPC (with ss interface)


<<boundary>>
TimecardForm

// display timecard()
// open(forUser : ISecureUser)
// enter hours for charge numbers()
// display charge codes()
// save timecard()
1

1
<<control>>
TimecardController
<<Interface>>
// get current timecard() +chargeNumSource IProjectManagementDatabase
(from External System Interfaces)
// get charge codes()
// update timecard() 0..* 0..1
0..1 + getChargeNumbers()
// setSession()
// create()
<<entity>> // save timecard()
Timecard +currentTimecard
hours worked 0..1
pay period 0..1

// get timecard info()


// update timecard() 1
// new() : Timecard 0..*
// save() <<entity>>
1
Employee
name
employee id : int

// add(theTimecard : Timecard)
// get Employee ID() : int
// getTimecard(forPayPeriod : Date) : Timecard

Confidential Rational Software, 2003 Page 20 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

1.2.2 Maintain Timecard (with Security)


Maintain Timecard - Basic Flow (New Timecard with Security)

: : : : Employee : Timecard TimecardAccess : EmployeeS es sion : :


: Employee : Project
MainEmployeeForm TimecardForm TimecardController SecurityAccess ISec ureUser IProjectManagementDatabase
Management

1. // maintain timecard( )

1.1. // open(ISecureUser)

1.1.1. // create( )
The secure user session for the
employee established at Login must
be propagated to all forms and 1.1.2. // setSession(ISecureUser)
A current timecard
does not exist
1.1.3. // get current timecard( )
2. // get Timecard(Date) A new Timecard is created
and added to the Employee

3. // new( )

4. // add(Timecard)

5. new( )
The employee is
given " open" 6. makeReadable( )
permis sions for
his/ her timecard
7. makeWriteable( )

8. makeDeleteable( )
9. setAccess(Timecard, TimecardAccess)

1.1. 4. // display timecard( )

1.1.5. // get charge codes( )


1.1.5.1. getChargeNumbers(String)
1.1.5.1.1. // get charge numbers( )

1.1.6. // display charge codes( )

10. // enter hours for charge numbers( )

10.1. // update timecard( )

10.1.1. // update timecard( )

No need to check Timecard access


permissions, the TimecardController
alread knows that it is the Employee's
11. // s ave timecard( ) Timecard.

11.1. // save timecard( )


11.1.1. // save( )

Confidential Rational Software, 2003 Page 21 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

Maintain Timecard - Basic Flow (New Timecard with Security)


1.1.4. // display t imecard( )
1.1.6. // display charge codes( )

:
TimecardForm

10. // enter hours for charge numbers( )


11. // save timec ard( ) 1.1.1. // create( )
1.1. 2. // s etSession(ISecureUser)
1.1. 3. // get current timecard( ) :
3. // new( ) Timecard
1.1. 5. // get charge codes ( ) 10.1.1. // update timecard( )
10.1. // update timecard( ) 11.1.1. // save( )
11.1. // save timecard( )

: Employee 1.1. // open(ISecureUser)


2. // getTimecard(Date)
1. // maintain timecard( ) 4. // add(Timecard)
:
: Employee
TimecardController
: MainEmployeeForm

9. setAccess(Timecard, TimecardAccess)
1.1.5.1. getChargeNumbers(String)

5. new( )
: 6. makeReadable( )
IProjectManagementDatabase 7. makeW riteable( )
8. mak eDelet eable( ) EmployeeSession :
ISecureUser

1.1.5.1.1. // get charge numbers( )

TimecardAccess :
SecurityAccess

: Project Management
Database

Confidential Rational Software, 2003 Page 22 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

Maintain Timecard - VOPC (with Security)

<<boundary>>
TimecardForm
(from Employee Activities)
MainEmployeeForm
(from Employee Activities)
- // display timecard()
1 0..1 + // open()
+ // maintain timecard()
+ // enter hours for charge numbers()
+ // display charge codes()
+ // save timecard()
1

1
<<control>>
TimecardController
<<entity>>
(from Employee Activities)
Employee
(from Payroll Artifacts)
+ // get current timecard()
- name
+ // get charge codes()
+ // update timecard() 0..1 1 - employee id : int
+ // setSession() 0..1 + // add(theTimecard : Timecard)
+ // create()
+ // save timecard() 1

0..*

0..*
+chargeNumSource +currentTimecard
<<entity>>
<<Interface>> 0..1
Timecard
IProjectManagementDatabase <<Interface>>
(from Payroll Artifacts)
(from External System Interfaces) ISecureUser 0..1
- hours worked
(from Secure Interfaces)
- pay period
+ getChargeNumbers()
SecurityAccess + setAccess()
+ // get timecard info()
+ getAccess()
(from Secure Interfaces) + // update timecard()
+ getUserId()
+ // new() : Timecard
+ new()
+ isReadable() + // save()
+ isWriteable()
+ isDeleteable()
+ makeReadable() Timecard
+ makeWriteable() needs to be
<<Interface>>
+ makeDeleteable() secure
ISecureData
+ new()
(from Secure Interfaces)

Confidential Rational Software, 2003 Page 23 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

1.2.3 Maintain Timecard (with Distribution)


Maintain Timecard - Basic Flow (with distribution)

: : Naming. : : Timecard : Employee :


: Employee : Project
TimecardForm ITimecardController IProjectManagementDatabase
Management

1. // open() Lookup remote object by


specifying it's URL. This
1.1. lookup(String) returns a reference to the Get the Timecard for
remote object interface. the current pay period.

1.2. // get current timecard( )


1.2.1. // getTimecard(Date)
All calls are forwarded to
the remote object

1.3. // display timecard( )

1.4. // get charge codes( ) 1.4.1. getChargeNumbers(String)


1.4.1.1. // get charge numbers( )

1.5. // display charge codes( )

2. // ent er hours for charge numbers( )

2.1. // update timecard( )


2.1.1. // update timec ard( )

3. // save timecard( )
3.1. // save timecard( )
3.1.1. // save( )

Confidential Rational Software, 2003 Page 24 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

Maintain Timecard - Basic Flow (with distribution)


1.3. // display timecard( )
1.5. // display charge codes( )

1.1. lookup(String)
:
: Naming.
TimecardForm
1. // open()
2. // enter hours for charge numbers( )
3. // save timecard( ) 1.2. // get current timecard( )
1.4. // get charge codes( )
2.1. // update timecard( )
3.1. // save timecard( )

1.2.1. // getTimecard(Date)
: Employee :
: Employee
ITimecardController

2.1. 1. // update timecard( )


3.1.1. // save( )
1.4. 1. getChargeNumbers(String)

: :
IProjectManagementDatabase Timecard

1.4.1.1. // get charge numbers( )

: Project Management
Database

Confidential Rational Software, 2003 Page 25 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

Maintain Timecard - VOPC (with Distribution)

Distributed Naming.
<<boundary>> (from java.rmi)
class client TimecardForm
(from Employee Activities)
+ lookup()
- // display timecard()
+ // open()
+ // enter hours for charge numbers()
+ // display charge codes()
<<Interface>>
+ // save timecard()
1 ITimecardController
1 (from Employee Activities)

+ // get current timecard()


TimecardController + // get charge codes()
is distributed + // update timecard()
Remote
+ // setSession(forUser : ISecureUser)
+ // create() : ITimecardController (from java.rmi)

+ // save timecard()
<<control>>
TimecardController <<entity>>
(from Employee Activities) Employee
(from Payroll Artifacts)

+ // get current timecard() - name


+ // get charge codes() 0..1 1 - employee id : int
+ // update timecard()
+ // create() : TimecardController + // add()
+ // save timecard() 1

0..*
0..1

+chargeNumSource
+currentTimecard 0..*
<<entity>>
0..1
Timecard
0..1
<<Interface>> (from Payroll Artifacts)
IProjectManagementDatabase - hours worked
(from External System Interfaces) - pay period
UnicastRemoteObject
(from Server)
+ getChargeNumbers() + // get timecard info()
+ // update timecard()
# UnicastRemoteObject() + // new()
+ clone() + // save()
+ exportObject()

Timecard must be
passed between
distributed objects
Serializable
(from java.io)

Confidential Rational Software, 2003 Page 26 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

1.2.4 Maintain Timecard (with OODBMS Persistence)


Maintain Timecard - Basic Flow (with OODBMS Persistency)

: : : : Timecard :
: Employee : Project
TimecardForm TimecardController PayrollDBManager IProjectManagementDatabase
Management
1. // open()

1.1. // create( )
Ret rieve the current
Timecard for the E mployee
1.2. // get current timecard( )
Sequence Diagram: ObjectStore
Support / PayrollDBManager -
1.2.1. getTimecard(Employee, Date) Get Timecard

1.3. // display timecard( )

1.4. // get charge codes( )


1.4.1. getChargeNumbers(String)
1.4.1.1. // get charge numbers( )

1.5. // display charge codes( )

2. // enter hours for charge numbers( )

2.1. // update timecard( )


2.1.1. // update timecard( )

Save the Timecard in


the Payroll Database
3. // save timecard( )
3.1. // save timecard( )

3.1.1. save(Timecard, Employee)

Sequence Diagram:
Object Store S upport /
PayrollDBManager - S ave

Confidential Rational Software, 2003 Page 27 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

Maintain Timecard - Basic Flow (with OODBMS Persistency)


1.3. / / display timecard( )
1.5. // display charge codes( )
1.1. // create( )
1.2. // get current timecard( )
1. // open() 1.4. // get charge codes( )
2. // enter hours for charge numbers( ) 2.1. // update timecard( ) 1.2.1. getTimecard(Employee, Date)
3. // save timecard( ) 3.1. // save timecard( ) 3.1.1. s ave(Timecard, Employ ee)
: :
: PayrollDBManager
TimecardForm TimecardController

: Employee
2.1. 1. // update timecard( )
1.4.1. getChargeNumbers(String)

: :
IProjectManagementDatabase Timecard

1.4.1.1. // get charge numbers( )

: Project Management
Database

Confidential Rational Software, 2003 Page 28 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

Maintain Timecard - VOPC (with OODBMS Persistency)


PayrollDBManager <<entity>> <<Interface>>
(from ObjectStore Support) Timecard IProjectManagementDatabase
(from Payroll Artifacts) (from External System Interfaces)
+ save() - hours worked
+ getTimecard() - pay period + getChargeNumbers()
1
+ // get timecard info() 0..1
+ // update timecard()
+ // new()
+ // save() +chargeNumSource
0..1

+currentTimecard
0..*
0..1 0..*

<<control>>
TimecardController
(from Employee Activities)

+ // get current timecard()


+ // get charge codes()
+ // update timecard()
+ // create()
+ // save timecard()
1

1
<<boundary>>
TimecardForm
(from Employee Activities)

- // display timecard()
+ // open()
+ // enter hours for charge numbers()
+ // display charge codes()
+ // save timecard()

Confidential Rational Software, 2003 Page 29 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

1.2.5 Maintain Timecard (with everything)


Maintain Timecard - Basic Flow (with everything)

: : Naming. : : : Timecard : Employee TimecardAccess : EmployeeSession : : : Project


: Employee
TimecardForm ITimecardController PayrollDBManager SecurityAccess ISecureUser IProject ManagementDatabase Management
Lookup remote object by
1. // open(ISec ureUser)
specifying it's URL. This
1.1. lookup(String) returns a reference to the
remote object interface.
The secure
Retrieve the current Timecard for
user session
1.2. / / create( ) the Employee from the Payroll
for the
Database. A current timecard
employee
does not exist.
established at 1.3. // setSes sion(ISecureUs er)
Login must be
propagated to Sequence Diagram: ObjectStore
all forms and 1.4. // get current timecard( ) Support / PayrollDBManager -
controllers, so Get Timecard
access can be
checked for 1.4.1. getTimecard(Employee, Date)
secure data All calls are forwarded to A new Timecard is created
the remote object and added to the Employee
1.4.2. // new( )

1.4. 3. // add(Timecard)

1.4.4. new( )
1.4.5. makeReadable( )
The employee is
given "open" 1.4.6. makeWriteable( )
permissions for
1.4.7. makeDeleteable( )
his/her timecard

1.4.8. setAccess(Timecard, TimecardAccess)

1.5. / / display timecard( )

1.6. // get charge codes( )


1.6.1. get ChargeNumbers(String) 1.6.1.1. // get charge numbers( )

1.7. / / dis play charge codes( )

/ enter hours for charge numbers( )

2.1. // update timecard( )


2.1.1. // update timecard( )

No need to check Timecard access


permissions, the TimecardController
3. // save timecard( ) alread knows that it is the Employee's
Timecard.
3.1. // s ave timecard( )

3.1.1. s ave(Timecard, Employee)


Save the Timecard in
the Payroll Database

Sequence Diagram:
ObjectStore Support /
PayrollDBManager - Save

Confidential Rational Software, 2003 Page 30 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

Maintain Timecard - Basic Flow (with everything), Part 1

: : Naming. : : : Timecard : Employee TimecardAccess : EmployeeSession :


: Employee
TimecardForm ITimecardController PayrollDBManager SecurityAccess ISecureUser
Lookup remote object by
1. // open(ISecureUser) specifying it's URL. This
returns a reference to the Retrieve the current Timecard for
1.1. lookup(String)
remote object interface. the Employee from the Payroll
The secure Database. A current timecard
user session does not exist.
1.2. // create( )
for the
employee Sequence Diagram: OODBMS
established at 1.3. // setSession(ISecureUser) Support / PayrollDBManager -
Login must be Get Timecard
propagated to
all forms and 1.4. // get current timecard( )
controllers, so All calls are forwarded to A new Timecard is created
access can be the remote object
1.4.1. getTimecard(Employee, Date) and added to the Employee
checked for
secure data

1.4.2. // new( )

1.4. 3. // add(Timec ard)

The employee is 1.4.4. new( )


given "open"
permissions for 1.4.5. makeReadable( )
his/her timecard
1.4.6. makeWriteable( )

1.4.7. makeDeleteable( )

1.4.8. setAccess(Timecard, TimecardA ccess)

1.5. // display timecard( )

Sequence Diagram: Maintain


Timecard (with everything) / Maintain
Timecard - Basic Flow (with
everything), Part 2
See Maintain Timecard - Basic Flow (with everything), Part 2

Confidential Rational Software, 2003 Page 31 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

Maintain Timecard - Basic Flow (with everything), Part 2


Sequence Diagram: Maintain Timecard (with
Continued from Maintain Timecard - Basic Flow (with everything), Part 1 everything) / Maintain Timecard - Basic Flow (with
everything), Part 1
: : : : Timecard :
: Employee : Project
TimecardForm TimecardController PayrollDBManager IProjectManagementDatabase
Management
1. // get charge codes( )
1.1. getChargeNumbers(String)
1.1.1. // get charge numbers( )

2. // display charge codes( )

3. // enter hours for charge numbers( )

3.1. // update timecard( )


3.1.1. // update timecard( )

No need to check Timecard access


permissions, the TimecardController
alread knows that it is the Employee's
Timecard.
4. // save timecard( )
4.1. // save timecard( )

4.1.1. save(Timecard, Employee)

Save the Timecard in


the Payroll Database
Sequence Diagram:
ObjectStore Support /
PayrollDBManager - Save

Confidential Rational Software, 2003 Page 32 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

Maintain Timecard - Basic Flow (with everything), Part 1


1.5. // display timecard( )

1.1. lookup(String)
:
: Naming.
TimecardForm

1. // open(ISecureUser)
1.2. // create( )
1.3. // setSession(ISecureUser)
1.4. // get current timecard( )

1.4.1. getTimecard(Employee, Date)


: Employ ee :
: PayrollDBManager
ITimecardController
1.4.2. // new( )
1.4.8. setAccess(Timecard, TimecardAccess)

EmployeeSession : 1.4.3. // add(Timecard) :


ISecureUser 1.4.4. new( ) Timecard
1.4.5. makeReadable( )
1.4.6. makeW riteable( )
1.4.7. makeDeleteable( )

: Employee

TimecardAccess :
SecurityAccess

Confidential Rational Software, 2003 Page 33 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

Maintain Timecard - Basic Flow (with everything), Part 2


2. // display charge codes( )

:
TimecardForm

3. // enter hours for charge numbers( )


4. // save timecard( )
1. // get charge codes( )
3.1. // update timecard( )
4.1. // save timecard( )

3.1.1. // update timecard( )


: :
: Employee
TimecardController Timecard

4.1. 1. save(Timecard, Employee)

1.1. getChargeNumbers(String)

: : PayrollDBManager
IProjectManagementDatabase

1.1.1. // get charge numbers( )

: Project Management
Database

Confidential Rational Software, 2003 Page 34 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

Maintain Timecard - Basic Flow (with everything)


1.5. // display timecard( )
1.7. // display charge codes( )

: Naming.

: 1.1. lookup(String)
:
TimecardForm IProjectManagementDatabase
1. // open(ISecureUser)
2. // enter hours for charge numbers( ) 1.6.1.1. // get charge numbers( )
3. // save timecard( )
1.2. // create( ) 1.6.1. getChargeNumbers(String)
1.3. // setSession(ISecureUser)
1.4. // get current timecard( )
1.6. // get charge codes( )
2.1. / / updat e t imecard( )
3.1. // save timecard( )
1.4.1. getTimecard(Employee, Date)
: PayrollDBManager
3.1.1. save(Timecard, Employee)
: Employee : Project Management
Database
: :
Timecard ITimecardController 1.4.4. new( )
1.4.5. makeReadable( )
1.4.2. // new( ) 1.4.6. makeWriteable( )
2.1.1. // update timecard( ) 1.4. 7. mak eDeleteable( )

1.4.8. set Access(Timecard, TimecardAc cess)

TimecardAccess :
1.4.3. // add(Timecard)
SecurityAccess

EmployeeSession :
ISecureUser

: Employ ee

Confidential Rational Software, 2003 Page 35 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

Maintain Timecard - VOPC (with everything)


<<Interface>> UnicastRemoteObject
ITimecardController (from Server)
(from Employee Activities)
Remote # UnicastRemoteObject()
+ // get current timecard() + clone()
(from java.rmi)
+ // get charge codes() + exportObject()
+ // update timecard()
+ // setSession()
TimecardController + // create()
is distributed + // save timecard()
1 PayrollDBManager
<<control>>
TimecardController (from ObjectStore Support)
(from Employee Activities)
1 + save()
<<boundary>> 1 + getTimecard()
+ // get current timecard()
TimecardForm 0..*
+ // get charge codes()
(from Employee Activities) <<entity>>
+ // update timecard()
+ // setSession() 0..1 Employee
- // display timecard() + // create() 0..1 (from Payroll Artifacts)
+ // open() + // save timecard() - name
+ // enter hours for charge numbers() 1 - employee id : int
+ // display charge codes() 0..*
+ // save timecard() 1 + // add()
+currentTimecard
+ // get Employee ID()
0..1 <<entity>> + // getTimecard()
+chargeNumSource Timecard 0..*
Naming.
(from java.rmi) (from Payroll Artifacts)
0..1 - hours worked
+ lookup() <<Interface>> <<Interface>> - pay period
IProjectManagementDatabase ISecureUser
(from External System Interfaces) (from Secure Interfaces) + // get timecard info() Serializable
+ // update timecard()
+ // new() (from java.io)
+ getChargeNumbers() + setAccess()
+ getAccess() + // save()
+ getUserId() Timecard must be
+ new() passed between
distributed objects
SecurityAccess
(from Secure Interfaces)
Timecard
needs to be
+ makeReadable() secure
+ makeWriteable()
ISecureData
+ makeDeleteable()
+ new() (from Secure Interfaces)

Confidential Rational Software, 2003 Page 36 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

1.3 Use-Case Realization - Login

1.3.1 Login
Login - Basic Flow

: LoginForm
: Any User

1. // enter username and password( )

1.1. // validate username and password( )

Login - Basic Flow

1.1. / / validate username and password( )

: LoginForm

1. // ent er username and password( )

: Any Us er

Confidential Rational Software, 2003 Page 37 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

Login - VOPC

LoginForm
(from GUI Framework)

+ open()
+ enterUserName()
+ validateUserIDPassword(
+ enterPassword()
+ logInUser()
+ setupSecurityContext()
+ getUserContext()

Confidential Rational Software, 2003 Page 38 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

1.3.2 Login (with Security)


Login - Basic Flow (Employee Login with Security)

: Employee : : LoginForm Employee Session :


MainEmployeeForm IS ecureUser

1. start( )
1.1. open( )

2. enterUserName( )

3. enterPassword( )

4. logInUser( )

4.1. validat eUserIDPassword( )

[ login successfull ]
4.2. setupS ecurityContext( )

4.2.1. new(UserID)

The MainEmployeeForm
1.2. setupSecurityContext( ) ret ains the E mployee's
s ession for later
process ing by the user.
1.2. 1. getUserContext( )

1.3. close( )

1.4. displayAvailOperations( )

Confidential Rational Software, 2003 Page 39 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

Login - Basic Flow (Employee Login with Security)


1.2. setupSecurityContext( )
1.4. displayAvailOperations( )

: MainEmployeeForm
1.1. open( )
1.2.1. getUserContext( )
1.3. close( )
4.1. validateUserIDPassword( )
4.2. setupSecurityContext( )

1. start( ) 4.2.1. new(UserID)


: LoginForm Employee Session :
ISecureUser
2. enterUserName( )
3. enterPassword( )
4. logInUser( )

: Employee

Confidential Rational Software, 2003 Page 40 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

Login - VOPC (with Security)

LoginFor
(from GUI Framework)
MainApplicationFor
(from GUI Framework) + open()
+
+ start() +
+ 1 0..1 +
+ +
+
1 +
0..1

MainEmployeeFor
(from Employee Activities) 0..1 0..1
<<Interface>
+ // maintain ISecureUse
(from Secure Interfaces)

+
+
+
+ new()

[REPEAT56]

Confidential Rational Software, 2003 Page 41 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

1.4 ObjectStore Support


The following diagrams demonstrate the design of the PayrollDBManager class operations. These are included to
supplement the use-case realization diagrams provided above. For the use-case realization diagrams that involve
OODBMS persistency, there are references to the diagrams in this section.
PayrollDBManager - Save Timecard

Any PayrollDB Client : PayrollDBManager : Transaction Passed In : : Map Ret rieved from
Employee Database : Employee

1. save(Timecard, Employee) a read-only transaction to ensure


1.1. begin( ) that the Employee isn't changed
while we're reading it

1.2. / / get Employee ID( )


Returns an
Employee
1.3. get (EmployeeID)
Save the Employee (and
[ Employee does not exist] all associated data,
1.4. put(EmployeeID, Employee) including Timecards) in
the database

[ Employee does exist]


1.5. // add(Timecard)

1.6. commit()
If the Employee already has a Timecard for
that pay period, the existing Timecard is
updated with the given Timecard.

A separate put() to the Map is not necessary


as the get() operation returns a reference to
the Employee and any changes to that
Employee (like adding a Timecard), if made
in the context of a transaction, are
automatically committed to the database
when the transaction is committed.

Confidential Rational Software, 2003 Page 42 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

PayrollDBManager - Get Timecard

Any PayrollDB : : Transaction Passed In : PayrollDB Root Retrieved from the


Client PayrollDBManager Employee : Map database : Employee

1. getTimecard(Employee, Date)
1.1. begin( ) Ret rieve latest
version of the
Employ ee from the
1.2. // get Employee ID( ) database

1.3. get(EmployeeID)

1.4. // getTimecard(Date)

2. commit(RETAIN_HOLLOW)
Retrieve the Timecard with the
specified pay period

Specify the
RETAIN_HOLLOW option
on the commit(), so that the
reference to the retrieved
Timecard can be used
outside of the transaction.

Confidential Rational Software, 2003 Page 43 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

PayrollDBManager - Get Employee

Any PayrollDB Client : PayrollDBManager : Transaction PayrollDB Root


: Map

Ret rieve latest


version of the
1. getEmployee(string) St udent from t he
database
1.1. begin( )

1.2. get(string)

1.3. commit(RETAIN_HOLLOW)

Specify the
RETAIN_HOLLOW option
on the commit(), so that the
reference to the retrieved
Student can be used
outside of the transaction.

Confidential Rational Software, 2003 Page 44 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

PayrollDBManager - Initialize

: Payroll Application : : Session PayrollDB : : Transaction EmployeeMap :


Controller PayrollDBManager Database Map

1. initialize( )
2. create( ) The EmployeeMap is the entry
point into the Database. It is a
"special" data structure. Any
3. join( ) changes to this data structure that
occur within the context of a
transaction will be applied to the
associated ObjectStore Payroll
1.3. creat e( ) Database.

1.4. begin( )
Pass in the
name of the 1.5. new( )
Map, as well
as the Map
itself (the Map 1.6. createRoot("EmployeeMap", EmployeeMap) Creat e t he EmployeeMap
is an Object). that will serve as the
database root .
1.7. commit ()

Initialization must occur before any persistent c lass can be accessed.

Once the session has been c reated and joined, t he PayrollDBManager must open and create the new
database.

To create the database, the Pay rollDBManager creates a new transact ion and creates the "root " of the
database with the "createRoot()" operation. In our example, the root will be the EmployeeMap data
structure. It will c ontain instances of the Employee clas s and all “reachable” classes (including
Timecards and Purchase Orders). Remember, the root is t he entry point into the Payroll Database. It is
a "spec ial" data structure. Any changes to t his data struc ture that occur within the context of a
t ransaction will be applied to the associated Payroll ObjectSt ore Database.

Once the root has been c reated, the transaction is committed

Confidential Rational Software, 2003 Page 45 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

PayrollDBManager - Shutdown

: Payroll Application : PayrollDBManager PayrollDB : : Session


Controller Database

1. shutdown( )

2. close( )

3. terminate( )

To shutdown the database, the PayrollDBManager must close the


database and terminate the session.

PayrollDBManager - Save Paycheck

Any P ayrollDB : : Transaction Passed In : : Map Retrieved from


Client PayrollDBManager Employee Database : Employee

1. save(Paycheck, Employee) a read-only transaction to ensure


1.1. begin( ) that the Employee isn't changed
while we're reading it

1.2. // get Employee ID( ) Returns an


Employee
1.3. get (EmployeeID)
Save the Employee (and
[ Employee does not exist] all associated dat a,
including Paychecks) in
1.4. put(EmployeeID, Employee) the database

[ Employee does exist]

1.5. / / add(Paycheck)

1.6. commit() A separate put() to the Map is not


necessary as the get() operation returns a
reference to the Employee and any changes
to that Employee (like adding a Paycheck),
if made in the context of a transaction, are
automatically committed to the database
when the transaction is committed.

Confidential Rational Software, 2003 Page 46 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

Main
PayrollDBManager

+ initialize()
Operations to access + shutdown()
Timecard and Purchase + newTimecard(forEmployee : Employee) : Timecard
Order were added for ObjectStore
+ delete(theTimecard : Timecard, forEmployee : Employee)
easier design root class
+ update(theTimecard : Timecard, forEmployee : Employee)
incorporation. The + save(theTimecard : Timecard, forEmployee : Employee)
PayrollDBManager + getTimecard(forEmployee : Employee, forWeekEnding : Date) : Timecard <<entity>> <<entity>>
manages the details of + newEmployee() : Employee Employee Timecard
loading the appropriate (f ro m Payro ll Art ifacts) (from Payroll Artifacts)
+ delete(theEmployee : Employee) 1 0..*
Employee (the selected + update(theEmployee : Employee)
root class) before + save(theEmployee : Employee) 1
accessing Timecard and + getEmployee(withID : string) : Employee
Purchase Order. <<entity>>
+ newPO(forEmployee : Commissioned Employee) : PurchaseOrder 0..* Payc heck
+ delete(thePO : PurchaseOrder, forEmployee : Commissioned Employee) (from Payroll Artifacts)
+ update(thePO : PurchaseOrder, forEmployee : Commissioned Employee) <<entity>> <<entity>> - amount
+ save(thePO : PurchaseOrder, forEmployee : Commissioned Employee) SalariedEmployee HourlyEmployee
+ get(forEmployee : Commissioned Employee) : PurchaseOrder (from Payroll Artifacts) (from Payroll Artifacts) + // create with amount()
+ save(thePaycheck : Paycheck, forEmployee : Employee)

1 1 1 1
1
Session
1
(from com.odi)
<<entity>> <<entity>>
1 0..*
CommissionedEmployee PurchaseOrder
(from Payroll Artifacts) (from Payroll Artifacts)
0..*
1 1
1
Map Database Transaction Object Store
(from com.odi) (from com.odi) (f ro m com.o di) (from com.odi)

Session: The class that represents a database session. A session must be created in order to access the database and
any persistent data.

A session is the context in which PSE/PSE Pro databases are created or opened, and transactions can be executed.
Only one transaction at a time can exist in a session.

Map: A persistent map container classes that stores key/value pairs.

Database: The Database class represents an ObjectStore database.

Before you begin creating persistent objects, you must create a database to hold the objects. In subsequent
processes, you open the database to allow the process to read or modify the objects. To create a database, you call
the static create() method on the Database class and specify the database name and an access mode.

Transaction: An ObjectStore transaction. Manages a logical unit of work. All persistent objects must be accessed
within a transaction.

ObjectStore: Defines system-level operations that are not specific to any database.

PayrollDBManager: For the Payroll System, there is one ObjectStore database, the Payroll Database, that contains
employee, timecard, and purchase order information for the company. There is one PayrollDBManager (i.e., this
class is a singleton).

This class is responsible for providing access to the persistent objects in the Payroll Database. It provides a single
entry point into the Payroll Database. It contains operations to access entities in the database.

The PayrollDBManager class contains most of the database-specific code, such as starting and ending transactions.
There are noPayrollDBManager objects stored in the database, which means that the PayrollDBManager class is not
required to be persistence-capable.

The PayrollDBManager class has a static members that keep track of the database that is open. It also has a number
of static methods, each of which executes a transaction in the ObjectStore database.

HourlyEmployee: An employee that is paid by the hour.

Confidential Rational Software, 2003 Page 47 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

SalariedEmployee: An employee that receives a salary.

CommissionedEmployee: An employee that receives a commission.

PurchaseOrder: A record of a sale made by an employee.

Timecard: The timecard contains information regarding the hours worked by an employee for a given time period.

Employee: A person that works for the company.

Paycheck: A record of how much an employee was paid for a given pay period.

Confidential Rational Software, 2003 Page 48 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

2. Exercise: Use-Case Design, Part 2


2.1 Packages and Their Dependencies
Package Dependencies Diagram

Administration Employee Payroll


(from Application) Activities (from Application)
(from Application)
<<subsystem>> <<subsystem>>
BankSystem PrintService
(from Business Services) (from Business Services)

<<subsystem>>
ProjectManagementData
base
(from Business Services)
External System
Interfaces
(from Business Services)

ObjectStore Support
(from Business Services)

Payroll Artifacts
(from Business Services)

Security
(from Business Services)
GUI Framework
When the RDBMS
(from Security) mechanism is incorporated,
the dependency on java.sql
will be added

<<subsystem>>
Secure
Security
Interfaces
Manager java.sql
(from Security)
(from Security) (from Middleware)
java.rmi com.odi
(from Middleware) (from Middleware)
java.awt
(from Middleware)
Server
(from java.rmi) java.lang
(from Middleware)

java.io
(from Middleware)
Base Reuse

global

2.1.1 Package Descriptions


Administration : Contains the design elements that support the Payroll Administrator's applications.

Confidential Rational Software, 2003 Page 49 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

BankSystem Subsystem: Encapsulates the details involved in communicating with external bank systems.

Base Reuse : Basic reusable design elements.

com.odi : The com.odi package contains the design elements that support the OODBMS persistency mechanism.
The name of the package in the model reflects the naming convention for 3rd party Java software. The convention is
to use the reverse of the domain name, so if Rational had a Java package called "util" they’d call it"
com.rational.util". This com.odi has nothing to do with Microsoft COM/DCOM, they are totally separate. There is
nothing COM/DCOM related when using CORBA, RMI, or ObjectStore.

Employee Activities : Contains the design elements that support the Employee's applications.

External System Interfaces : Contains the interfaces that support access to external systems. This is so that the
external system interface classes can be version controlled independently from the subsystems that realize them.

GUI Framework : This package comprises a whole framework for user interface management.

It has a ViewHandler that manages the opening and closing of windows, plus window-to-window communication
so that windows do not need to depend directly upon each other.

This framework is security-aware, it has a login window that will create a server-resident user context object. The
ViewHandler class manages a handle to the user context object.

The ViewHandler also starts up the controller classes for each use case manager.

java.awt : The java.awt package contains the basic GUI design elements for java.

java.io :

java.lang : The package contains some basic java design elements.

java.rmi : The java.rmi package contains the classes that implement the RMI distribution mechanism. This package
is commercially available with most standard JAVA IDEs.

java.sql : The package that contains the design elements that support RDBMS persistency.

ObjectStore Support : Contains the business-specific design elements that support the OODBMS persistency
mechanism. This includes the DBManager. The DBManager class must contain operations for every OODBMS
persistent class.

Payroll : Contains the design elements that support the execution of the payroll processing.

Payroll Artifacts : Contains the core payroll abstractions.

PrintService Subsystem: Provides utilities to produce hard-copy.

ProjectManagementDatabase Subsystem: Encapsulates the interface to the legacy database containing


information regarding projects and charge numbers.

Secure Interfaces : Contains the interfaces that provide clients access to security services.

Security : Contains design elements that implement the security mechanism.

Confidential Rational Software, 2003 Page 50 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

Security Manager Subsystem: Provides the implementation for the core security services.

Server :

Confidential Rational Software, 2003 Page 51 of 52


Mastering OOAD with UML Issue: v2003
Payroll System Use-Case Design Solution Issue Date: February 2003
10uc_designk_solution_rpt.doc

Confidential Rational Software, 2003 Page 52 of 52

You might also like