Class OrganizationRepositoryImpl

java.lang.Object
org.example.crmedu.infrastructure.repository.organization.OrganizationRepositoryImpl
All Implemented Interfaces:
OrganizationRepository

@Component public class OrganizationRepositoryImpl extends Object implements OrganizationRepository
Implementation of the OrganizationRepository interface. Provides methods for managing Organization entities in the database.
  • Constructor Details

    • OrganizationRepositoryImpl

      public OrganizationRepositoryImpl()
  • Method Details

    • save

      public Organization save(Organization organization)
      Description copied from interface: OrganizationRepository
      Saves a new organization or updates an existing one.
      Specified by:
      save in interface OrganizationRepository
      Parameters:
      organization - the organization to save
      Returns:
      the saved Organization entity
    • existsByName

      public boolean existsByName(Organization organization)
      Description copied from interface: OrganizationRepository
      Checks whether an organization with the same name already exists.
      Specified by:
      existsByName in interface OrganizationRepository
      Parameters:
      organization - the organization to check
      Returns:
      true if an organization with the same name exists, otherwise false
    • existsByEmail

      public boolean existsByEmail(Organization organization)
      Description copied from interface: OrganizationRepository
      Checks whether an organization with the same email already exists.
      Specified by:
      existsByEmail in interface OrganizationRepository
      Parameters:
      organization - the organization to check
      Returns:
      true if an organization with the same email exists, otherwise false
    • existsByPhone

      public boolean existsByPhone(Organization organization)
      Description copied from interface: OrganizationRepository
      Checks whether an organization with the same phone already exists.
      Specified by:
      existsByPhone in interface OrganizationRepository
      Parameters:
      organization - the organization to check
      Returns:
      true if an organization with the same phone exists, otherwise false
    • existsById

      public boolean existsById(Long id)
      Description copied from interface: OrganizationRepository
      Checks whether an organization with this identifier exists.
      Specified by:
      existsById in interface OrganizationRepository
      Parameters:
      id - the unique identifier to check
      Returns:
      true if an organization with id exists, otherwise false
    • findById

      public Optional<Organization> findById(Long id)
      Description copied from interface: OrganizationRepository
      Retrieves an organization by its unique identifier.
      Specified by:
      findById in interface OrganizationRepository
      Parameters:
      id - the unique identifier of the organization
      Returns:
      an Optional containing the organization if fount, otherwise empty
    • findAll

      public Page<Organization> findAll(int pageNumber, int pageSize)
      Description copied from interface: OrganizationRepository
      Retrieves a paginated list of organizations.
      Specified by:
      findAll in interface OrganizationRepository
      Parameters:
      pageNumber - the page number (starting from 0)
      pageSize - the number of organizations per page
      Returns:
      a Page containing the requested organizations
    • update

      public void update(Organization organization)
      Description copied from interface: OrganizationRepository
      Updates an existing organization.
      Specified by:
      update in interface OrganizationRepository
      Parameters:
      organization - the organization entity with updated information
    • delete

      public void delete(Long id)
      Description copied from interface: OrganizationRepository
      Delete an organization by its unique identifier.
      Specified by:
      delete in interface OrganizationRepository
      Parameters:
      id - the unique identifier of the organization to delete