java.lang.Object
leave.manager.LeaveManager
- All Implemented Interfaces:
LeaveManagement
Manages leave-related operations.
This class provides methods for approving, rejecting, and retrieving leave records,
as well as managing leave balances.
Utilizes interfaces
LeaveDataService, and LeaveManagement for data access and management.
Available methods:
approveLeave(String)rejectLeave(String, int, String, int)getLeaveRecord(String)getLeaveRecord_List(int)getLeaveRecord_List()getAllLeaveRecords()addLeaveRecord(LeaveRecord, LeaveBalanceRecord)getLeaveBalanceRecord(int)getLeaveBalance_OfType(int, String)getLeaveBalance_OfType(LeaveBalanceRecord, String)updateLeaveBalance(LeaveBalanceRecord, String, int)
-
Constructor Summary
ConstructorsConstructorDescriptionLeaveManager(LeaveDataService leaveDataService, LeaveBalanceDataService leaveBalanceDataService) Constructs a LeaveManager object with the specified LeaveDataService and LeaveBalanceDataService. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLeaveRecord(LeaveRecord newLeaveRecord, LeaveBalanceRecord leaveBalanceRecord) Adds a new leave record and updates the leave balance.voidapproveLeave(String leaveID) Approves leave with the specified leave ID.Retrieves a list of all leave records.intgetLeaveBalance_OfType(int employeeID, String leaveType) Retrieves the leave balance of the specified leave type for the employee with the given ID.intgetLeaveBalance_OfType(LeaveBalanceRecord leaveBalance, String leaveType) Retrieves the leave balance of the specified leave type from the provided LeaveBalanceRecord.getLeaveBalanceRecord(int employeeID) Retrieves the leave balance record associated with the specified employee ID.getLeaveRecord(String leaveID) Retrieves the leave record with the specified leave ID.Retrieves a list of all leave records.getLeaveRecord_List(int employeeID) Retrieves a list of leave records associated with the specified employee ID.voidrejectLeave(String leaveID, int employeeID, String leaveType, int duration) Rejects leave with the specified leave ID, employee ID, leave type, and duration.voidupdateLeaveBalance(LeaveBalanceRecord leaveBalanceRecord, String leaveType, int newBalance) Updates the leave balance record with the new balance for the specified leave type.
-
Constructor Details
-
LeaveManager
public LeaveManager(LeaveDataService leaveDataService, LeaveBalanceDataService leaveBalanceDataService) Constructs a LeaveManager object with the specified LeaveDataService and LeaveBalanceDataService.- Parameters:
leaveDataService- the data service for leave recordsleaveBalanceDataService- the data service for leave balance records
-
-
Method Details
-
approveLeave
Approves leave with the specified leave ID.- Specified by:
approveLeavein interfaceLeaveManagement- Parameters:
leaveID- the ID of the leave to approve
-
rejectLeave
Rejects leave with the specified leave ID, employee ID, leave type, and duration.- Specified by:
rejectLeavein interfaceLeaveManagement- Parameters:
leaveID- the ID of the leave to rejectemployeeID- the ID of the employee associated with the leaveleaveType- the type of leave to rejectduration- the duration of the leave to reject
-
getLeaveRecord
Retrieves the leave record with the specified leave ID.- Specified by:
getLeaveRecordin interfaceLeaveManagement- Parameters:
leaveID- the ID of the leave record to retrieve- Returns:
- the leave record
-
getLeaveRecord_List
Retrieves a list of leave records associated with the specified employee ID.- Specified by:
getLeaveRecord_Listin interfaceLeaveManagement- Parameters:
employeeID- the ID of the employee- Returns:
- a list of leave records
-
getLeaveRecord_List
Retrieves a list of all leave records.- Specified by:
getLeaveRecord_Listin interfaceLeaveManagement- Returns:
- a list of all leave records
-
getAllLeaveRecords
Retrieves a list of all leave records.- Specified by:
getAllLeaveRecordsin interfaceLeaveManagement- Returns:
- a list of all leave records
-
addLeaveRecord
public void addLeaveRecord(LeaveRecord newLeaveRecord, LeaveBalanceRecord leaveBalanceRecord) throws LeaveException Adds a new leave record and updates the leave balance.- Specified by:
addLeaveRecordin interfaceLeaveManagement- Parameters:
newLeaveRecord- the new leave record to addleaveBalanceRecord- the leave balance record to update- Throws:
LeaveException- if an error occurs while adding the leave record
-
getLeaveBalanceRecord
Retrieves the leave balance record associated with the specified employee ID.- Specified by:
getLeaveBalanceRecordin interfaceLeaveManagement- Parameters:
employeeID- the ID of the employee- Returns:
- the leave balance record
-
getLeaveBalance_OfType
Retrieves the leave balance of the specified leave type for the employee with the given ID.- Specified by:
getLeaveBalance_OfTypein interfaceLeaveManagement- Parameters:
employeeID- the ID of the employeeleaveType- the type of leave- Returns:
- the leave balance of the specified leave type
-
getLeaveBalance_OfType
Retrieves the leave balance of the specified leave type from the provided LeaveBalanceRecord.- Specified by:
getLeaveBalance_OfTypein interfaceLeaveManagement- Parameters:
leaveBalance- the LeaveBalanceRecord containing leave balancesleaveType- the type of leave- Returns:
- the leave balance of the specified leave type
-
updateLeaveBalance
public void updateLeaveBalance(LeaveBalanceRecord leaveBalanceRecord, String leaveType, int newBalance) Updates the leave balance record with the new balance for the specified leave type.- Specified by:
updateLeaveBalancein interfaceLeaveManagement- Parameters:
leaveBalanceRecord- the leave balance record to updateleaveType- the type of leavenewBalance- the new balance for the specified leave type
-