Class ProcessingOrderMgr

java.lang.Object
de.dlr.proseo.ordermgr.rest.ProcessingOrderMgr

@Component public class ProcessingOrderMgr extends Object
Service methods required to create, modify and delete processing order in the prosEO database, and to query the database about such orders
Author:
Ranjitha Vignesh
  • Field Details

    • rtb

      @Autowired org.springframework.boot.web.client.RestTemplateBuilder rtb
      REST template builder
  • Constructor Details

    • ProcessingOrderMgr

      public ProcessingOrderMgr()
  • Method Details

    • createOrder

      @Transactional(isolation=REPEATABLE_READ) public RestOrder createOrder(RestOrder order) throws IllegalArgumentException, SecurityException
      Create an order from the given Json object
      Parameters:
      order - the Json object to create the order from
      Returns:
      a Json object corresponding to the order after persistence (with ID and version for all contained objects)
      Throws:
      IllegalArgumentException - if any of the input data was invalid
      SecurityException - if a cross-mission data access was attempted
    • deleteOrderById

      @Transactional(isolation=REPEATABLE_READ) public void deleteOrderById(Long id) throws jakarta.persistence.EntityNotFoundException, SecurityException, RuntimeException
      Delete an order by ID
      Parameters:
      id - the ID of the order to delete
      Throws:
      jakarta.persistence.EntityNotFoundException - if the order to delete does not exist in the database
      SecurityException - if a cross-mission data access was attempted
      RuntimeException - if the deletion was not performed as expected
    • deleteExpiredOrderById

      @Transactional(isolation=REPEATABLE_READ) public void deleteExpiredOrderById(Long id, Instant evictionTime) throws jakarta.persistence.EntityNotFoundException, SecurityException, RuntimeException
      Delete an expired order by ID without cross-mission access check
      Parameters:
      id - the ID of the order to delete
      evictionTime - the relevant cutoff time for the eviction of orders
      Throws:
      jakarta.persistence.EntityNotFoundException - if the order to delete does not exist in the database
      SecurityException - if a cross-mission data access was attempted
      RuntimeException - if the deletion was not performed as expected
    • deleteOrdersWithEvictionTimeLessThan

      @Deprecated public void deleteOrdersWithEvictionTimeLessThan(Instant t)
      Deprecated.
      Find all orders of state CLOSED and eviction time less than t and delete them
      Parameters:
      t - the time to compare to
    • findOrdersWithEvictionTimeLessThan

      @Transactional(isolation=REPEATABLE_READ, readOnly=true) public List<Long> findOrdersWithEvictionTimeLessThan(Instant evictionTime)
      Find all orders of state CLOSED and eviction time less than t and return a list of their DB IDs
      Parameters:
      evictionTime - the time to compare to
      Returns:
      a list of database IDs for evictable orders
    • getOrderById

      @Transactional(isolation=REPEATABLE_READ, readOnly=true) public RestOrder getOrderById(Long id) throws IllegalArgumentException, jakarta.persistence.NoResultException, SecurityException
      Find the oder with the given ID
      Parameters:
      id - the ID to look for
      Returns:
      a Json object corresponding to the order found
      Throws:
      IllegalArgumentException - if no order ID was given
      jakarta.persistence.NoResultException - if no order with the given ID exists
      SecurityException - if a cross-mission data access was attempted
    • modifyOrder

      @Transactional(isolation=REPEATABLE_READ) public RestOrder modifyOrder(Long id, RestOrder order) throws jakarta.persistence.EntityNotFoundException, IllegalArgumentException, SecurityException, ConcurrentModificationException
      Update the order with the given ID with the attribute values of the given Json object. Orders may only be changed while they are in state "INITIAL". The only state modification allowed here is from INITIAL to APPROVED.
      Parameters:
      id - the ID of the product to update
      order - a Json object containing the modified (and unmodified) attributes
      Returns:
      a Json object corresponding to the product after modification (with ID and version for all contained objects)
      Throws:
      jakarta.persistence.EntityNotFoundException - if no product with the given ID exists
      IllegalArgumentException - if any of the input data was invalid
      SecurityException - if a cross-mission data access was attempted
      ConcurrentModificationException - if the order has been modified since retrieval by the client
    • getOrders

      @Transactional(isolation=REPEATABLE_READ, readOnly=true) public List<RestOrder> getOrders(String mission, String identifier, String[] requestedProductClasses, String startTimeFrom, String startTimeTo, String executionTimeFrom, String executionTimeTo) throws jakarta.persistence.NoResultException, SecurityException
      List of all orders filtered by mission, identifier, product class, execution time range; selection is restricted to the mission the current user is logged in to
      Parameters:
      mission - the mission code
      identifier - the order identifier
      requestedProductClasses - an array of product types
      startTimeFrom - earliest sensing start time
      startTimeTo - latest sensing start time
      executionTimeFrom - earliest order execution time
      executionTimeTo - latest order execution time
      Returns:
      a list of orders
      Throws:
      jakarta.persistence.NoResultException - if no orders matching the given search criteria could be found
      SecurityException - if a cross-mission data access was attempted
    • getAndSelectOrders

      @Transactional(isolation=REPEATABLE_READ, readOnly=true) public List<RestOrder> getAndSelectOrders(String mission, String identifier, String[] state, String[] requestedProductClasses, String startTimeFrom, String startTimeTo, Long recordFrom, Long recordTo, String[] orderBy)
      Retrieve a list of orders satisfying the selection parameters. Mission code is mandatory.
      Parameters:
      mission - the mission code
      identifier - the order identifier pattern
      state - an array of states
      requestedProductClasses - an array of product types
      startTimeFrom - earliest sensing start time
      startTimeTo - latest sensing start time
      recordFrom - first record of filtered and ordered result to return
      recordTo - last record of filtered and ordered result to return
      orderBy - an array of strings containing a column name and an optional sort direction (ASC/DESC), separated by white space
      Returns:
      The result list
    • countSelectOrders

      @Transactional(isolation=REPEATABLE_READ, readOnly=true) public String countSelectOrders(String mission, String identifier, String[] state, String[] requestedProductClasses, String startTimeFrom, String startTimeTo, Long recordFrom, Long recordTo, String[] orderBy)
      Calculate the amount of orders satisfying the selection parameters. Mission code is mandatory.
      Parameters:
      mission - the mission code
      identifier - the order identifier pattern
      state - an array of states
      requestedProductClasses - an array of product types
      startTimeFrom - earliest sensing start time
      startTimeTo - latest sensing start time
      recordFrom - first record of filtered and ordered result to return
      recordTo - last record of filtered and ordered result to return
      orderBy - an array of strings containing a column name and an optional sort direction (ASC/DESC),
      Returns:
      The order count