Package de.dlr.proseo.ordermgr.rest
Class OrderTemplateMgr
java.lang.Object
de.dlr.proseo.ordermgr.rest.OrderTemplateMgr
Service methods required to create, modify and delete order template in the prosEO database, and to query the database about
such order templates
- Author:
- Ernst Melchinger
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) org.springframework.boot.web.client.RestTemplateBuilderREST template builder -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncountOrderTemplates(String mission, String name, String[] requestedProductClasses, Long recordFrom, Long recordTo, String[] orderBy) Calculate the amount of orders satisfying the selection parameters.createOrderTemplate(RestOrderTemplate restOrderTemplate) Create an order from the given Json objectvoidDelete an order by IDFind the oder with the given IDgetOrderTemplates(String mission, String name, String[] requestedProductClasses, Long recordFrom, Long recordTo, String[] orderBy) Retrieve a list of orders satisfying the selection parameters.getOrderTemplatesToDel(String mission, String name, String[] requestedProductClasses, String startTimeFrom, String startTimeTo, String executionTimeFrom, String executionTimeTo) List of all orders filtered by mission, name, product class, execution time range; selection is restricted to the mission the current user is logged in tomodifyOrderTemplate(Long id, RestOrderTemplate restOrderTemplate) Update the order with the given ID with the attribute values of the given Json object.
-
Field Details
-
rtb
@Autowired org.springframework.boot.web.client.RestTemplateBuilder rtbREST template builder
-
-
Constructor Details
-
OrderTemplateMgr
public OrderTemplateMgr()
-
-
Method Details
-
createOrderTemplate
@Transactional(isolation=REPEATABLE_READ) public RestOrderTemplate createOrderTemplate(RestOrderTemplate restOrderTemplate) 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 invalidSecurityException- if a cross-mission data access was attempted
-
deleteOrderTemplateById
@Transactional(isolation=REPEATABLE_READ) public void deleteOrderTemplateById(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 databaseSecurityException- if a cross-mission data access was attemptedRuntimeException- if the deletion was not performed as expected
-
getOrderTemplateById
@Transactional(isolation=REPEATABLE_READ, readOnly=true) public RestOrderTemplate getOrderTemplateById(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 givenjakarta.persistence.NoResultException- if no order with the given ID existsSecurityException- if a cross-mission data access was attempted
-
modifyOrderTemplate
@Transactional(isolation=REPEATABLE_READ) public RestOrderTemplate modifyOrderTemplate(Long id, RestOrderTemplate restOrderTemplate) 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 updaterestOrderTemplate- 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 existsIllegalArgumentException- if any of the input data was invalidSecurityException- if a cross-mission data access was attemptedConcurrentModificationException- if the order has been modified since retrieval by the client
-
getOrderTemplatesToDel
@Transactional(isolation=REPEATABLE_READ, readOnly=true) public List<RestOrderTemplate> getOrderTemplatesToDel(String mission, String name, String[] requestedProductClasses, String startTimeFrom, String startTimeTo, String executionTimeFrom, String executionTimeTo) throws jakarta.persistence.NoResultException, SecurityException List of all orders filtered by mission, name, product class, execution time range; selection is restricted to the mission the current user is logged in to- Parameters:
mission- the mission codename- the order namerequestedProductClasses- an array of product typesstartTimeFrom- earliest sensing start timestartTimeTo- latest sensing start timeexecutionTimeFrom- earliest order execution timeexecutionTimeTo- latest order execution time- Returns:
- a list of orders
- Throws:
jakarta.persistence.NoResultException- if no orders matching the given search criteria could be foundSecurityException- if a cross-mission data access was attempted
-
getOrderTemplates
@Transactional(isolation=REPEATABLE_READ, readOnly=true) public List<RestOrderTemplate> getOrderTemplates(String mission, String name, String[] requestedProductClasses, Long recordFrom, Long recordTo, String[] orderBy) Retrieve a list of orders satisfying the selection parameters. Mission code is mandatory.- Parameters:
mission- the mission codename- the order name patternrequestedProductClasses- an array of product typesrecordFrom- first record of filtered and ordered result to returnrecordTo- last record of filtered and ordered result to returnorderBy- an array of strings containing a column name and an optional sort direction (ASC/DESC), separated by white spacestate- an array of statesstartTimeFrom- earliest sensing start timestartTimeTo- latest sensing start time- Returns:
- The result list
-
countOrderTemplates
@Transactional(isolation=REPEATABLE_READ, readOnly=true) public String countOrderTemplates(String mission, String name, String[] requestedProductClasses, Long recordFrom, Long recordTo, String[] orderBy) Calculate the amount of orders satisfying the selection parameters. Mission code is mandatory.- Parameters:
mission- the mission codename- the order name patternrequestedProductClasses- an array of product typesrecordFrom- first record of filtered and ordered result to returnrecordTo- last record of filtered and ordered result to returnorderBy- an array of strings containing a column name and an optional sort direction (ASC/DESC),state- an array of statesstartTimeFrom- earliest sensing start timestartTimeTo- latest sensing start time- Returns:
- The order count
-