DM-504: re-add includeSoftDeleted flag #149

Merged
kresnadi.budisantoso merged 1 commits from DM-504 into master 2023-09-29 22:14:50 +02:00
5 changed files with 19 additions and 8 deletions

View File

@ -7,7 +7,6 @@ import static com.iqser.red.service.persistence.service.v2.api.external.resource
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import org.springframework.web.bind.annotation.PathVariable;

View File

@ -49,11 +49,13 @@ public class DossierControllerV2 implements DossierResource {
}
public Dossier getDossier(@PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId, @PathVariable(DOSSIER_ID_PARAM) String dossierId) {
public Dossier getDossier(@PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
@PathVariable(DOSSIER_ID_PARAM) String dossierId,
@RequestParam(name = INCLUDE_SOFT_DELETED_PARAM, defaultValue = "false", required = false) boolean includeSoftDeleted) {
dossierTemplateController.getDossierTemplate(dossierTemplateId);
return dossierController.getDossier(dossierId, true, true);
return dossierController.getDossier(dossierId, true, includeSoftDeleted);
}

View File

@ -24,6 +24,7 @@ import com.iqser.red.persistence.service.v1.external.api.impl.controller.FileAtt
import com.iqser.red.persistence.service.v1.external.api.impl.controller.FileManagementController;
import com.iqser.red.persistence.service.v1.external.api.impl.controller.StatusController;
import com.iqser.red.persistence.service.v1.external.api.impl.controller.UploadController;
import com.iqser.red.service.persistence.management.v1.processor.exception.NotFoundException;
import com.iqser.red.service.persistence.service.v1.api.shared.model.FileAttributes;
import com.iqser.red.service.persistence.service.v1.api.shared.model.FileStatus;
import com.iqser.red.service.persistence.service.v1.api.shared.model.FileUploadResult;
@ -86,13 +87,20 @@ public class FileControllerV2 implements FileResource {
public FileStatus getFileStatus(@PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
@PathVariable(DOSSIER_ID_PARAM) String dossierId,
@PathVariable(FILE_ID_PARAM) String fileId) {
@PathVariable(FILE_ID_PARAM) String fileId,
@RequestParam(name = INCLUDE_SOFT_DELETED_PARAM, defaultValue = "false", required = false) boolean includeSoftDeleted) {
dossierTemplateController.getDossierTemplate(dossierTemplateId);
dossierController.getDossier(dossierId, true, true);
dossierController.getDossier(dossierId, true, includeSoftDeleted);
return statusController.getFileStatus(dossierId, fileId);
var status = statusController.getFileStatus(dossierId, fileId);
if (!includeSoftDeleted && status.getSoftDeletedTime() != null) {
throw new NotFoundException("The requested file does not exist.");
}
return status;
}

View File

@ -55,7 +55,8 @@ public interface DossierResource {
@Operation(summary = "Gets an existing dossier.", description = "By default, the requested dossier will be returned only if it is active. This behavior can be changed by using and combining the respective toggle parameters.")
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "404", description = "Not found")})
Dossier getDossier(@Parameter(name = DOSSIER_TEMPLATE_ID_PARAM, description = "The identifier of the dossier template that is used for the dossier.", required = true) @PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
@Parameter(name = DOSSIER_ID_PARAM, description = "The identifier of the dossier to retrieve.", required = true) @PathVariable(DOSSIER_ID_PARAM) String dossierId);
@Parameter(name = DOSSIER_ID_PARAM, description = "The identifier of the dossier to retrieve.", required = true) @PathVariable(DOSSIER_ID_PARAM) String dossierId,
@Parameter(name = INCLUDE_SOFT_DELETED_PARAM, description = "A Toggle to return a soft-deleted dossier: If `true` the dossier will be returned if it has been soft-deleted, i.e. the dossier can still be restored.") @RequestParam(name = INCLUDE_SOFT_DELETED_PARAM, defaultValue = "false", required = false) boolean includeSoftDeleted);
@ResponseBody

View File

@ -79,7 +79,8 @@ public interface FileResource {
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "404", description = "Not found")})
FileStatus getFileStatus(@Parameter(name = DOSSIER_TEMPLATE_ID_PARAM, description = "The identifier of the dossier template that is used for the dossier.", required = true) @PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
@Parameter(name = DOSSIER_ID_PARAM, description = "The identifier of the dossier containing the file of which the status is requested.", required = true) @PathVariable(DOSSIER_ID_PARAM) String dossierId,
@Parameter(name = FILE_ID_PARAM, description = "The identifier of the file of which the status is requested.", required = true) @PathVariable(FILE_ID_PARAM) String fileId);
@Parameter(name = FILE_ID_PARAM, description = "The identifier of the file of which the status is requested.", required = true) @PathVariable(FILE_ID_PARAM) String fileId,
@Parameter(name = INCLUDE_SOFT_DELETED_PARAM, description = "A Toggle to include soft-deleted dossiers and files: If `true` the response contains the status of files that have been soft-deleted, i.e. the files can still be restored.") @RequestParam(name = INCLUDE_SOFT_DELETED_PARAM, defaultValue = "false", required = false) boolean includeSoftDeleted);
@ResponseStatus(value = HttpStatus.NO_CONTENT)