Package org.trustdeck.service
Class ProjectImageDBService
java.lang.Object
org.trustdeck.service.ProjectImageDBService
This class encapsulates the database access for project objects.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateProjectImage(ProjectImageDTO projectImage, jakarta.servlet.http.HttpServletRequest request) Create a new project image.booleandeleteProjectImage(int projectId, jakarta.servlet.http.HttpServletRequest request) Method to remove a project image from the database.getProjectImageByProjectId(int projectId, jakarta.servlet.http.HttpServletRequest request) Retrieve a project image by its projectId.updateProjectImage(int projectId, ProjectImageDTO newImage, jakarta.servlet.http.HttpServletRequest request) Method to uUpdate the project image.
-
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, mimeTyperequest- the http request object containing information necessary for the audit trail- Returns:
- the created image record as a DTO, or
nullon 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 IDrequest- the http request object containing information necessary for the audit trail- Returns:
- the project image, or
nullwhen 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 IDnewImage- the DTO containing the updated informationrequest- 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,
nullotherwise
-
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 IDrequest- the http request object containing information necessary for the audit trail- Returns:
truewhen the deletion was successful,falseotherwise- Throws:
UnexpectedResultSizeException
-