Klasse ProductManager

java.lang.Object
de.dlr.proseo.ingestor.rest.ProductManager

@Component public class ProductManager extends Object
Service methods required to create, modify and delete products in the prosEO database, and to query the database about such products
Autor:
Dr. Thomas Bassler
  • Felddetails

  • Konstruktordetails

    • ProductManager

      public ProductManager()
  • Methodendetails

    • deleteProductById

      @Transactional(isolation=REPEATABLE_READ) public void deleteProductById(Long id) throws javax.persistence.EntityNotFoundException, IllegalStateException, SecurityException, RuntimeException
      Delete a product by ID
      Parameter:
      id - the ID of the product to delete
      Löst aus:
      javax.persistence.EntityNotFoundException - if the product to delete does not exist in the database
      IllegalStateException - if the product to delete still as files at some Processing Facility
      SecurityException - if a cross-mission data access was attempted
      RuntimeException - if the deletion was not performed as expected
    • getProducts

      @Transactional(isolation=REPEATABLE_READ, readOnly=true) public 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, Long jobStepId, String[] orderBy) throws javax.persistence.NoResultException, SecurityException
      List of all products filtered by mission, product class, , production mode, file class, quality and time ranges
      Parameter:
      mission - the mission code (will be set to logged in mission, if not given; otherwise must match logged in mission)
      productClass - an array of product types
      mode - the processing mode
      fileClass - the file class
      quality - the quality
      startTimeFrom - earliest sensing start time
      startTimeTo - latest sensing start time
      genTimeFrom - earliest generation time
      genTimeTo - latest generation time
      recordFrom - first record of filtered and ordered result to return
      recordTo - last record of filtered and ordered result to return
      jobStepId - get input products of job step
      orderBy - an array of strings containing a column name and an optional sort direction (ASC/DESC), separated by white space
      Gibt zurück:
      a list of products
      Löst aus:
      javax.persistence.NoResultException - if no products matching the given search criteria could be found
      SecurityException - if a cross-mission data access was attempted
    • countProducts

      @Transactional(isolation=REPEATABLE_READ, readOnly=true) public String countProducts(String mission, String[] productClass, String mode, String fileClass, String quality, String startTimeFrom, String startTimeTo, String genTimeFrom, String genTimeTo, Long jobStepId) throws SecurityException
      Get the number of products available, possibly filtered by mission, product class, production mode, file class, quality and time ranges
      Parameter:
      mission - the mission code (will be set to logged in mission, if not given; otherwise must match logged in mission)
      productClass - an array of product types
      mode - the processing mode
      fileClass - the file class
      quality - the quality
      startTimeFrom - earliest sensing start time
      startTimeTo - latest sensing start time
      genTimeFrom - earliest generation time
      genTimeTo - latest generation time
      jobStepId - get input products of job step
      Gibt zurück:
      the number of products found as string
      Löst aus:
      SecurityException - if a cross-mission data access was attempted
    • createProduct

      @Transactional(isolation=REPEATABLE_READ) public RestProduct createProduct(RestProduct product) throws IllegalArgumentException, SecurityException
      Create a product from the given Json object (does NOT create associated product files!)
      Parameter:
      product - the Json object to create the product from
      Gibt zurück:
      a Json object corresponding to the product after persistence (with ID and version for all contained objects)
      Löst aus:
      IllegalArgumentException - if any of the input data was invalid
      SecurityException - if a cross-mission data access was attempted
    • findEquivalentProduct

      public Product findEquivalentProduct(RestProduct product)
      Find any product equivalent to the given product (i. e. fulfilling the Product::equals() conditions).
      Parameter:
      product - the product example to search for
      Gibt zurück:
      a product with the same characteristics or null, if no such product can be found
    • getProductById

      @Transactional(isolation=REPEATABLE_READ, readOnly=true) public RestProduct getProductById(Long id) throws IllegalArgumentException, javax.persistence.NoResultException, SecurityException
      Find the product with the given ID
      Parameter:
      id - the ID to look for
      Gibt zurück:
      a Json object corresponding to the product found
      Löst aus:
      IllegalArgumentException - if no product ID was given
      javax.persistence.NoResultException - if no product with the given ID exists
      SecurityException - if a cross-mission data access was attempted
    • modifyProduct

      @Transactional(isolation=REPEATABLE_READ) public RestProduct modifyProduct(Long id, RestProduct product) throws javax.persistence.EntityNotFoundException, IllegalArgumentException, ConcurrentModificationException, SecurityException
      Update the product with the given ID with the attribute values of the given Json object. This method will NOT modify associated product files.
      Parameter:
      id - the ID of the product to update
      product - a Json object containing the modified (and unmodified) attributes
      Gibt zurück:
      a Json object corresponding to the product after modification (with ID and version for all contained objects)
      Löst aus:
      javax.persistence.EntityNotFoundException - if no product with the given ID exists
      IllegalArgumentException - if any of the input data was invalid
      ConcurrentModificationException - if the product has been modified since retrieval by the client
      SecurityException - if a cross-mission data access was attempted
    • getProductByUuid

      @Transactional(isolation=REPEATABLE_READ, readOnly=true) public RestProduct getProductByUuid(String uuid) throws IllegalArgumentException, javax.persistence.NoResultException, SecurityException
      Find the product with the given universally unique product identifier
      Parameter:
      uuid - the UUID to look for
      Gibt zurück:
      a Json object corresponding to the product found
      Löst aus:
      IllegalArgumentException - if no or an invalid product UUID was given
      javax.persistence.NoResultException - if no product with the given UUID exists
      SecurityException - if a cross-mission data access was attempted
    • downloadProductById

      @Transactional(isolation=REPEATABLE_READ, readOnly=true) public String downloadProductById(Long id, Long fromByte, Long toByte) throws IllegalArgumentException, javax.persistence.NoResultException, SecurityException
      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
      Parameter:
      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)
      Gibt zurück:
      a redirect URL for the HTTP Location header
      Löst aus:
      IllegalArgumentException - if no product ID was given
      javax.persistence.NoResultException - if no product with the given ID exists or if it does not have a data file
      SecurityException - if a cross-mission data access was attempted
    • getDownloadTokenById

      @Transactional(isolation=REPEATABLE_READ) public String getDownloadTokenById(Long id, String fileName) throws IllegalArgumentException, javax.persistence.NoResultException, SecurityException
      Get a JSON Web Token for creating a download link to a Storage Manager
      Parameter:
      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)
      Gibt zurück:
      the signed JSON Web Token (JWS) as per RFC 7515 and RFC 7519
      Löst aus:
      IllegalArgumentException - if no product ID was given
      javax.persistence.NoResultException - if no product with the given ID or no file with the given name exists
      SecurityException - if a cross-mission data access was attempted