Class AttachmentController
java.lang.Object
org.qubership.atp.dataset.service.rest.server.AttachmentController
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<Void> deleteByAttributeIdAndDatasetId(UUID attributeId, UUID datasetId) Delete attachment from parameter.org.springframework.http.ResponseEntity<Void> deleteByParameterId(UUID parameterId) Delete attachment from parameter.org.springframework.http.ResponseEntity<org.springframework.core.io.InputStreamResource> getAttachmentByAttributeIdAndDatasetId(UUID attributeId, UUID datasetId) Download file by attribute and dataset id.org.springframework.http.ResponseEntity<org.springframework.core.io.InputStreamResource> getAttachmentByParameterId(UUID parameterUuid) Download file by parameter id.org.springframework.http.ResponseEntity<FileData> uploadByAttributeIdAndDatasetId(UUID attributeId, UUID datasetId, String contentType, String fileName, List<UUID> attrPathIds, UUID dataSetListId, Long modifiedWhen, InputStream file) Upload file and store it to GridFS.uploadByParameterId(UUID parameterUuid, String contentType, String fileName, InputStream file) Upload file and store it to GridFS.
-
Constructor Details
-
AttachmentController
public AttachmentController()
-
-
Method Details
-
getAttachmentByParameterId
@PreAuthorize("@entityAccess.checkAccess(@parameterServiceImpl.get(#parameterUuid).getDataSet().getDataSetList().getVisibilityArea().getId(),\'READ\')") @GetMapping("/{parameterUuid}") public org.springframework.http.ResponseEntity<org.springframework.core.io.InputStreamResource> getAttachmentByParameterId(@PathVariable("parameterUuid") UUID parameterUuid) Download file by parameter id.- Parameters:
parameterUuid- mapped to file in gridFs.- Returns:
- file;
-
getAttachmentByAttributeIdAndDatasetId
@PreAuthorize("@entityAccess.checkAccess(@dataSetServiceImpl.get(#datasetId).getDataSetList().getVisibilityArea().getId(),\'READ\')") @GetMapping("/attributeId/{attributeId}/dataset/{datasetId}") public org.springframework.http.ResponseEntity<org.springframework.core.io.InputStreamResource> getAttachmentByAttributeIdAndDatasetId(@PathVariable("attributeId") UUID attributeId, @PathVariable("datasetId") UUID datasetId) Download file by attribute and dataset id. -
uploadByParameterId
@PreAuthorize("@entityAccess.checkAccess(@parameterServiceImpl.get(#parameterUuid).getDataSet().getDataSetList().getVisibilityArea().getId(),\'UPDATE\')") @PostMapping("/{parameterUuid}") public FileData uploadByParameterId(@PathVariable("parameterUuid") UUID parameterUuid, @RequestParam("type") String contentType, @RequestParam("fileName") String fileName, InputStream file) throws IOException Upload file and store it to GridFS.- Parameters:
parameterUuid- targetIdentified.getId()contentType- content type in http request formatfileName- target file namefile- InputStream of file- Returns:
- transfer object of
FileData - Throws:
IOException
-
uploadByAttributeIdAndDatasetId
@PreAuthorize("@entityAccess.checkAccess(@dataSetServiceImpl.get(#datasetId).getDataSetList().getVisibilityArea().getId(),\'UPDATE\')") @PostMapping("/attributeId/{attributeId}/dataset/{datasetId}") public org.springframework.http.ResponseEntity<FileData> uploadByAttributeIdAndDatasetId(@PathVariable("attributeId") UUID attributeId, @PathVariable("datasetId") UUID datasetId, @RequestParam("type") String contentType, @RequestParam("fileName") String fileName, @RequestParam(value="attrPath",required=false) List<UUID> attrPathIds, @RequestParam(value="dataSetListId",required=false) UUID dataSetListId, @RequestParam(value="modifiedWhen",required=false) Long modifiedWhen, InputStream file) Upload file and store it to GridFS.- Parameters:
contentType- content type in http request formatfileName- target file namefile- InputStream of file- Returns:
- transfer object of
FileData
-
deleteByParameterId
@PreAuthorize("@entityAccess.checkAccess(@parameterServiceImpl.get(#parameterId).getDataSet().getDataSetList().getVisibilityArea().getId(),\'DELETE\')") @DeleteMapping("/{parameterUuid}") public org.springframework.http.ResponseEntity<Void> deleteByParameterId(@PathVariable("parameterUuid") UUID parameterId) Delete attachment from parameter. -
deleteByAttributeIdAndDatasetId
@PreAuthorize("@entityAccess.checkAccess(@dataSetServiceImpl.get(#datasetId).getDataSetList().getVisibilityArea().getId(),\'DELETE\')") @DeleteMapping("/attributeId/{attributeId}/dataset/{datasetId}") public org.springframework.http.ResponseEntity<Void> deleteByAttributeIdAndDatasetId(@PathVariable("attributeId") UUID attributeId, @PathVariable("datasetId") UUID datasetId) Delete attachment from parameter.
-