Interface IOfficerRegistrationService
- All Known Implementing Classes:
OfficerRegistrationService
This interface provides methods for officers to request registration to projects, for managers to review these requests, and for querying registration status and details. The officer registration process is a key part of the authorization system, determining which officers can work with which projects.
Key responsibilities include:- Enabling officers to request association with specific projects
- Supporting manager approval/rejection of registration requests
- Providing registration status information for authorization checks
- Retrieving lists of registrations by various criteria
-
Method Summary
Modifier and TypeMethodDescriptionint
getPendingRegistrationCountForProject
(String projectId) Gets the count of pending registration requests for a specific project.Gets all pending registration requests across all projects.getPendingRegistrationsForProject
(String projectId) Gets all pending registration requests for a specific project.getRegistrationsByOfficer
(String officerNric) Gets all registration records for a specific officer.getRegistrationsByProject
(String projectId) Gets all registration records for a specific project.getRegistrationStatus
(HDBOfficer officer, String projectId) Gets the registration status of an officer for a specific project.requestProjectRegistration
(HDBOfficer officer, String projectId) Requests registration of an HDB officer to a project.boolean
reviewRegistration
(HDBManager manager, String registrationId, boolean approve) Reviews (approves or rejects) an officer's registration request.
-
Method Details
-
requestProjectRegistration
OfficerRegistration requestProjectRegistration(HDBOfficer officer, String projectId) throws RegistrationException Requests registration of an HDB officer to a project.This is the first step in the registration process, where an officer requests to be associated with a project. The registration starts in PENDING status and requires manager approval.
- Parameters:
officer
- The HDB officer requesting registrationprojectId
- The ID of the project the officer wants to register for- Returns:
- The created registration record
- Throws:
RegistrationException
- if the registration request fails (e.g., officer is not eligible)
-
reviewRegistration
boolean reviewRegistration(HDBManager manager, String registrationId, boolean approve) throws RegistrationException Reviews (approves or rejects) an officer's registration request.This method allows a project manager to decide whether to approve or reject an officer's request to be associated with their project.
- Parameters:
manager
- The manager reviewing the registration requestregistrationId
- The ID of the registration to reviewapprove
- True to approve, false to reject- Returns:
- True if the review was successful
- Throws:
RegistrationException
- if the review fails (e.g., unauthorized manager)
-
getRegistrationStatus
Gets the registration status of an officer for a specific project.This method is primarily used for authorization checks to determine if an officer is approved to work on a specific project.
- Parameters:
officer
- The officer whose status should be checkedprojectId
- The ID of the project to check- Returns:
- The registration status, or null if no registration exists
-
getPendingRegistrations
List<OfficerRegistration> getPendingRegistrations()Gets all pending registration requests across all projects.This method is typically used by managers to view all pending registration requests that need their attention.
- Returns:
- A list of all pending registration requests
-
getPendingRegistrationsForProject
Gets all pending registration requests for a specific project.This method allows project managers to view registration requests specifically for their projects.
- Parameters:
projectId
- The ID of the project to check- Returns:
- A list of pending registration requests for the specified project
-
getPendingRegistrationCountForProject
Gets the count of pending registration requests for a specific project.This method provides a quick way to check how many pending registration requests exist for a project without retrieving the full details.
- Parameters:
projectId
- The ID of the project to check- Returns:
- The number of pending registration requests for the project
-
getRegistrationsByProject
Gets all registration records for a specific project.This method retrieves all officer registrations associated with a project, regardless of their status.
- Parameters:
projectId
- The ID of the project- Returns:
- A list of all registration records for the project
-
getRegistrationsByOfficer
Gets all registration records for a specific officer.This method retrieves all project registrations associated with an officer, regardless of their status.
- Parameters:
officerNric
- The NRIC of the officer- Returns:
- A list of all registration records for the officer
-