Class ProjectImageDBService

java.lang.Object
org.trustdeck.service.ProjectImageDBService

@Service public class ProjectImageDBService extends Object
This class encapsulates the database access for project objects.
  • Constructor Details

    • ProjectImageDBService

      public ProjectImageDBService()
  • Method Details

    • createProjectImage

      @Transactional public ProjectImageDTO createProjectImage(ProjectImageDTO projectImage, jakarta.servlet.http.HttpServletRequest request)
      Create a new project image.
      Parameters:
      projectImage - the DTO containing projectId, imageBytes, mimeType
      request - the http request object containing information necessary for the audit trail
      Returns:
      the created image record as a DTO, or null on error
    • getProjectImageByProjectId

      @Transactional public ProjectImageDTO getProjectImageByProjectId(int projectId, jakarta.servlet.http.HttpServletRequest request)
      Retrieve a project image by its projectId.
      Parameters:
      projectId - the owning project's ID
      request - the http request object containing information necessary for the audit trail
      Returns:
      the project image, or null when unsuccessful
    • updateProjectImage

      @Transactional public ProjectImageDTO updateProjectImage(int projectId, ProjectImageDTO newImage, jakarta.servlet.http.HttpServletRequest request)
      Method to uUpdate the project image.
      Parameters:
      projectId - the owning project's ID
      newImage - the DTO containing the updated information
      request - the http request object containing information necessary for the audit trail
      Returns:
      the updated image as it is represented in the database after the update when successful, null otherwise
    • deleteProjectImage

      @Transactional public boolean deleteProjectImage(int projectId, jakarta.servlet.http.HttpServletRequest request) throws UnexpectedResultSizeException
      Method to remove a project image from the database.
      Parameters:
      projectId - the owning project's ID
      request - the http request object containing information necessary for the audit trail
      Returns:
      true when the deletion was successful, false otherwise
      Throws:
      UnexpectedResultSizeException