Package de.dlr.proseo.ingestor.rest
Class ProductControllerImpl
java.lang.Object
de.dlr.proseo.ingestor.rest.ProductControllerImpl
- All Implemented Interfaces:
ProductController
Spring MVC controller for the prosEO Ingestor; implements the services
required to ingest products from pickup points into the prosEO database, and
to query the database about such products
- Author:
- Dr. Thomas Bassler
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<?> countProducts(String mission, String[] productClass, String mode, String fileClass, String quality, String startTimeFrom, String startTimeTo, String genTimeFrom, String genTimeTo, Boolean onlyWithFile, Long jobStepId, Long id, org.springframework.http.HttpHeaders httpHeaders) Number of products available, possibly filtered by mission, product class and time rangeorg.springframework.http.ResponseEntity<RestProduct> createProduct(@Valid RestProduct product, org.springframework.http.HttpHeaders httpHeaders) Create a product from the given Json object (does NOT create associated product files!)org.springframework.http.ResponseEntity<?> deleteProductById(Long id, org.springframework.http.HttpHeaders httpHeaders) Delete a product by IDorg.springframework.http.ResponseEntity<?> downloadProductById(Long id, Long fromByte, Long toByte, org.springframework.http.HttpHeaders httpHeaders) Get the primary data file (or ZIP file, if available) for the product as data stream (optionally range-restricted), returns a redirection link to the Storage Manager of a random Processing Facilityorg.springframework.http.ResponseEntity<?> getDownloadTokenById(Long id, String fileName, org.springframework.http.HttpHeaders httpHeaders) Get a JSON Web Token for creating a download link to a Storage Managerorg.springframework.http.ResponseEntity<RestProduct> getProductById(Long id, org.springframework.http.HttpHeaders httpHeaders) Find the product with the given IDorg.springframework.http.ResponseEntity<RestProduct> getProductByUuid(@Pattern(regexp="^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$") String uuid, org.springframework.http.HttpHeaders httpHeaders) Get a product by UUIDorg.springframework.http.ResponseEntity<List<RestProduct>> getProducts(String mission, String[] productClass, String mode, String fileClass, String quality, String startTimeFrom, String startTimeTo, String genTimeFrom, String genTimeTo, Integer recordFrom, Integer recordTo, Boolean onlyWithFile, Long jobStepId, String[] orderBy, org.springframework.http.HttpHeaders httpHeaders) List of all products filtered by mission, product class, start time range; the output will be ordered by the columns given in orderBy, and the resulting product list will only contain the records in the given rangeorg.springframework.http.ResponseEntity<RestProduct> modifyProduct(Long id, RestProduct product, org.springframework.http.HttpHeaders httpHeaders) Update the product with the given ID with the attribute values of the given Json object.
-
Constructor Details
-
ProductControllerImpl
public ProductControllerImpl()
-
-
Method Details
-
deleteProductById
public org.springframework.http.ResponseEntity<?> deleteProductById(Long id, org.springframework.http.HttpHeaders httpHeaders) Delete a product by ID- Specified by:
deleteProductByIdin interfaceProductController- Parameters:
id- the ID of the product to deletehttpHeaders- HTTP Authentication header- Returns:
- a response entity with HTTP status "NO_CONTENT", if the deletion was successful, or HTTP status "NOT_FOUND", if the product did not exist, or HTTP status "BAD_REQUEST", if the product still has files at some Processing Facility, or HTTP status "FORBIDDEN" and an error message, if a cross-mission data access was attempted, or HTTP status "NOT_MODIFIED", if the deletion was unsuccessful
-
getProducts
public org.springframework.http.ResponseEntity<List<RestProduct>> getProducts(String mission, String[] productClass, String mode, String fileClass, String quality, String startTimeFrom, String startTimeTo, String genTimeFrom, String genTimeTo, Integer recordFrom, Integer recordTo, Boolean onlyWithFile, Long jobStepId, String[] orderBy, org.springframework.http.HttpHeaders httpHeaders) List of all products filtered by mission, product class, start time range; the output will be ordered by the columns given in orderBy, and the resulting product list will only contain the records in the given range- Specified by:
getProductsin interfaceProductController- Parameters:
mission- the mission codeproductClass- an array of product typesmode- processing mode as defined for the missionfileClass- one of the file classes defined for the missionquality- indicator for the suitability of this product for general usestartTimeFrom- earliest sensing start timestartTimeTo- latest sensing start timegenTimeFrom- product generation time, earliestgenTimeTo- product generation time, latestrecordFrom- the first product to retrieverecordTo- the last product to retrievejobStepId- job step that produced the products (if any)orderBy- an array of strings containing a column name and an optional sort direction (ASC/DESC), separated by white spacehttpHeaders- HTTP Authentication header- Returns:
- HTTP status "OK" and a list of products or HTTP status "FORBIDDEN" and an error message, if a cross-mission data access was attempted, or HTTP status "NOT_FOUND" and an error message, if no products matching the search criteria were found HTTP status "TOO MANY REQUESTS" if the result list exceeds a configured maximum
-
countProducts
public org.springframework.http.ResponseEntity<?> countProducts(String mission, String[] productClass, String mode, String fileClass, String quality, String startTimeFrom, String startTimeTo, String genTimeFrom, String genTimeTo, Boolean onlyWithFile, Long jobStepId, Long id, org.springframework.http.HttpHeaders httpHeaders) Number of products available, possibly filtered by mission, product class and time range- Specified by:
countProductsin interfaceProductController- Parameters:
mission- the mission codeproductClass- an array of product typesmode- processing mode as defined for the missionfileClass- one of the file classes defined for the missionquality- indicator for the suitability of this product for general usestartTimeFrom- earliest sensing start timestartTimeTo- latest sensing start timegenTimeFrom- product generation time, earliestgenTimeTo- product generation time, latestjobStepId- job step that produced the products (if any)httpHeaders- HTTP Authentication header- Returns:
- HTTP status "OK" and the number of products found (may be zero) or HTTP status "FORBIDDEN" and an error message, if a cross-mission data access was attempted
-
createProduct
public org.springframework.http.ResponseEntity<RestProduct> createProduct(@Valid RestProduct product, org.springframework.http.HttpHeaders httpHeaders) Create a product from the given Json object (does NOT create associated product files!)- Specified by:
createProductin interfaceProductController- Parameters:
product- the Json object to create the product fromhttpHeaders- HTTP Authentication header- Returns:
- HTTP status "CREATED" and a response containing a Json object corresponding to the product after persistence (with ID and version for all contained objects) or HTTP status "FORBIDDEN" and an error message, if a cross-mission data access was attempted, or HTTP status "BAD_REQUEST", if any of the input data was invalid
-
getProductById
public org.springframework.http.ResponseEntity<RestProduct> getProductById(Long id, org.springframework.http.HttpHeaders httpHeaders) Find the product with the given ID- Specified by:
getProductByIdin interfaceProductController- Parameters:
id- the ID to look forhttpHeaders- HTTP Authentication header- Returns:
- HTTP status "OK" and a Json object corresponding to the product found or HTTP status "BAD_REQUEST" and an error message, if no product ID was given, or HTTP status "FORBIDDEN" and an error message, if a cross-mission data access was attempted, or HTTP status "NOT_FOUND" and an error message, if no product with the given ID exists
-
modifyProduct
public org.springframework.http.ResponseEntity<RestProduct> modifyProduct(Long id, RestProduct product, org.springframework.http.HttpHeaders httpHeaders) Update the product with the given ID with the attribute values of the given Json object. This method will NOT modify associated product files.- Specified by:
modifyProductin interfaceProductController- Parameters:
id- the ID of the product to updateproduct- a Json object containing the modified (and unmodified) attributeshttpHeaders- HTTP Authentication header- Returns:
- HTTP status "OK" and a response containing a Json object corresponding to the product after modification (with ID and version for all contained objects) or HTTP status "NOT_MODIFIED" and the unchanged product, if no attributes were actually changed, or HTTP status "NOT_FOUND" and an error message, if no product with the given ID exists, or HTTP status "BAD_REQUEST" and an error message, if any of the input data was invalid, or HTTP status "FORBIDDEN" and an error message, if a cross-mission data access was attempted, or HTTP status "CONFLICT"and an error message, if the product has been modified since retrieval by the client
-
getProductByUuid
public org.springframework.http.ResponseEntity<RestProduct> getProductByUuid(@Pattern(regexp="^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$") @Pattern(regexp="^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$") String uuid, org.springframework.http.HttpHeaders httpHeaders) Get a product by UUID- Specified by:
getProductByUuidin interfaceProductController- Parameters:
uuid- the universally unique product identifierhttpHeaders- HTTP Authentication header- Returns:
- HTTP status "OK" and a Json object corresponding to the product found or HTTP status "BAD_REQUEST" and an error message, if no or an invalid product UUID was given, or HTTP status "FORBIDDEN" and an error message, if a cross-mission data access was attempted, or HTTP status "NOT_FOUND" and an error message, if no product with the given UUID exists
-
downloadProductById
public org.springframework.http.ResponseEntity<?> downloadProductById(Long id, Long fromByte, Long toByte, org.springframework.http.HttpHeaders httpHeaders) Get the primary data file (or ZIP file, if available) for the product as data stream (optionally range-restricted), returns a redirection link to the Storage Manager of a random Processing Facility- Specified by:
downloadProductByIdin interfaceProductController- Parameters:
id- the ID of the product to downloadfromByte- the first byte of the data stream to download (optional, default is file start, i.e. byte 0)toByte- the last byte of the data stream to download (optional, default is file end, i.e. file size - 1)httpHeaders- HTTP Authentication header- Returns:
- HTTP status "TEMPORARY_REDIRECT" and a redirect URL in the HTTP Location header, or HTTP status "BAD_REQUEST" and an error message, if no or an invalid product ID was given, or HTTP status "FORBIDDEN" and an error message, if a cross-mission data access was attempted, or HTTP status "NOT_FOUND" and an error message, if no product with the given ID exists or if it does not have a data file
-
getDownloadTokenById
public org.springframework.http.ResponseEntity<?> getDownloadTokenById(Long id, String fileName, org.springframework.http.HttpHeaders httpHeaders) Get a JSON Web Token for creating a download link to a Storage Manager- Specified by:
getDownloadTokenByIdin interfaceProductController- Parameters:
id- the ID of the product to downloadfileName- the name of the file to download (default primary data file or ZIP file, if available)httpHeaders- HTTP Authentication header- Returns:
- HTTP status "OK" and the signed JSON Web Token (JWS) as per RFC 7515 and RFC 7519, or HTTP status "BAD_REQUEST" and an error message, if no or an invalid product ID was given, or HTTP status "FORBIDDEN" and an error message, if a cross-mission data access was attempted, or HTTP status "NOT_FOUND" and an error message, if no product with the given ID or no file with the given name exists
-