Interface OrganizationRepository
- All Known Implementing Classes:
OrganizationRepositoryImpl
public interface OrganizationRepository
Repository class for managing
Organization
entities. Defines methods for CRUD operations and querying subjects.-
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.
-
Method Details
-
save
Saves a new organization or updates an existing one.- Parameters:
organization
- the organization to save- Returns:
- the saved
Organization
entity
-
existsByName
Checks whether an organization with the same name already exists.- Parameters:
organization
- the organization to check- Returns:
true
if an organization with the same name exists, otherwisefalse
-
existsByEmail
Checks whether an organization with the same email already exists.- Parameters:
organization
- the organization to check- Returns:
true
if an organization with the same email exists, otherwisefalse
-
existsByPhone
Checks whether an organization with the same phone already exists.- Parameters:
organization
- the organization to check- Returns:
true
if an organization with the same phone exists, otherwisefalse
-
existsById
Checks whether an organization with this identifier exists.- Parameters:
id
- the unique identifier to check- Returns:
true
if an organization with id exists, otherwisefalse
-
findById
Retrieves an organization by its unique identifier.- Parameters:
id
- the unique identifier of the organization- Returns:
- an
Optional
containing the organization if fount, otherwise empty
-
findAll
Retrieves a paginated list of organizations.- Parameters:
pageNumber
- the page number (starting from 0)pageSize
- the number of organizations per page- Returns:
- a
Page
containing the requested organizations
-
update
Updates an existing organization.- Parameters:
organization
- the organization entity with updated information
-
delete
Delete an organization by its unique identifier.- Parameters:
id
- the unique identifier of the organization to delete
-