Class ProductControllerImpl

java.lang.Object
de.dlr.proseo.ingestor.rest.ProductControllerImpl
All Implemented Interfaces:
ProductController

@Component public class ProductControllerImpl extends Object implements 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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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
    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!)
    org.springframework.http.ResponseEntity<?>
    deleteProductById(Long id, org.springframework.http.HttpHeaders httpHeaders)
    Delete a product by ID
    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
    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
    org.springframework.http.ResponseEntity<RestProduct>
    getProductById(Long id, org.springframework.http.HttpHeaders httpHeaders)
    Find the product with the given ID
    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}$") String uuid, org.springframework.http.HttpHeaders httpHeaders)
    Get a product by UUID
    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
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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:
      deleteProductById in interface ProductController
      Parameters:
      id - the ID of the product to delete
      httpHeaders - 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:
      getProducts in interface ProductController
      Parameters:
      mission - the mission code
      productClass - an array of product types
      mode - processing mode as defined for the mission
      fileClass - one of the file classes defined for the mission
      quality - indicator for the suitability of this product for general use
      startTimeFrom - earliest sensing start time
      startTimeTo - latest sensing start time
      genTimeFrom - product generation time, earliest
      genTimeTo - product generation time, latest
      recordFrom - the first product to retrieve
      recordTo - the last product to retrieve
      jobStepId - 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 space
      httpHeaders - 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:
      countProducts in interface ProductController
      Parameters:
      mission - the mission code
      productClass - an array of product types
      mode - processing mode as defined for the mission
      fileClass - one of the file classes defined for the mission
      quality - indicator for the suitability of this product for general use
      startTimeFrom - earliest sensing start time
      startTimeTo - latest sensing start time
      genTimeFrom - product generation time, earliest
      genTimeTo - product generation time, latest
      jobStepId - 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:
      createProduct in interface ProductController
      Parameters:
      product - the Json object to create the product from
      httpHeaders - 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:
      getProductById in interface ProductController
      Parameters:
      id - the ID to look for
      httpHeaders - 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:
      modifyProduct in interface ProductController
      Parameters:
      id - the ID of the product to update
      product - a Json object containing the modified (and unmodified) attributes
      httpHeaders - 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:
      getProductByUuid in interface ProductController
      Parameters:
      uuid - the universally unique product identifier
      httpHeaders - 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:
      downloadProductById in interface ProductController
      Parameters:
      id - the ID of the product to download
      fromByte - 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:
      getDownloadTokenById in interface ProductController
      Parameters:
      id - the ID of the product to download
      fileName - 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