Class OrganizationRepositoryImpl
java.lang.Object
org.example.crmedu.infrastructure.repository.organization.OrganizationRepositoryImpl
- All Implemented Interfaces:
OrganizationRepository
Implementation of the
OrganizationRepository
interface. Provides methods for managing Organization
entities in the database.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Delete an organization by its unique identifier.boolean
existsByEmail
(Organization organization) Checks whether an organization with the same email already exists.boolean
existsById
(Long id) Checks whether an organization with this identifier exists.boolean
existsByName
(Organization organization) Checks whether an organization with the same name already exists.boolean
existsByPhone
(Organization organization) Checks whether an organization with the same phone already exists.findAll
(int pageNumber, int pageSize) Retrieves a paginated list of organizations.Retrieves an organization by its unique identifier.save
(Organization organization) Saves a new organization or updates an existing one.void
update
(Organization organization) Updates an existing organization.
-
Constructor Details
-
OrganizationRepositoryImpl
public OrganizationRepositoryImpl()
-
-
Method Details
-
save
Description copied from interface:OrganizationRepository
Saves a new organization or updates an existing one.- Specified by:
save
in interfaceOrganizationRepository
- Parameters:
organization
- the organization to save- Returns:
- the saved
Organization
entity
-
existsByName
Description copied from interface:OrganizationRepository
Checks whether an organization with the same name already exists.- Specified by:
existsByName
in interfaceOrganizationRepository
- Parameters:
organization
- the organization to check- Returns:
true
if an organization with the same name exists, otherwisefalse
-
existsByEmail
Description copied from interface:OrganizationRepository
Checks whether an organization with the same email already exists.- Specified by:
existsByEmail
in interfaceOrganizationRepository
- Parameters:
organization
- the organization to check- Returns:
true
if an organization with the same email exists, otherwisefalse
-
existsByPhone
Description copied from interface:OrganizationRepository
Checks whether an organization with the same phone already exists.- Specified by:
existsByPhone
in interfaceOrganizationRepository
- Parameters:
organization
- the organization to check- Returns:
true
if an organization with the same phone exists, otherwisefalse
-
existsById
Description copied from interface:OrganizationRepository
Checks whether an organization with this identifier exists.- Specified by:
existsById
in interfaceOrganizationRepository
- Parameters:
id
- the unique identifier to check- Returns:
true
if an organization with id exists, otherwisefalse
-
findById
Description copied from interface:OrganizationRepository
Retrieves an organization by its unique identifier.- Specified by:
findById
in interfaceOrganizationRepository
- Parameters:
id
- the unique identifier of the organization- Returns:
- an
Optional
containing the organization if fount, otherwise empty
-
findAll
Description copied from interface:OrganizationRepository
Retrieves a paginated list of organizations.- Specified by:
findAll
in interfaceOrganizationRepository
- Parameters:
pageNumber
- the page number (starting from 0)pageSize
- the number of organizations per page- Returns:
- a
Page
containing the requested organizations
-
update
Description copied from interface:OrganizationRepository
Updates an existing organization.- Specified by:
update
in interfaceOrganizationRepository
- Parameters:
organization
- the organization entity with updated information
-
delete
Description copied from interface:OrganizationRepository
Delete an organization by its unique identifier.- Specified by:
delete
in interfaceOrganizationRepository
- Parameters:
id
- the unique identifier of the organization to delete
-