Package de.dlr.proseo.planner.util
Class OrderUtil
java.lang.Object
de.dlr.proseo.planner.util.OrderUtil
Handle processing orders
- Author:
- Ernst Melchinger
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) ProductionPlannerConfigurationPlanner configuration(package private) org.springframework.boot.web.client.RestTemplateBuilderREST template builder -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapprove(ProcessingOrder order) Approve the processing order and it jobs and job steps.cancel(ProcessingOrder orderX) Cancel the processing order and it jobs and job steps.checkAutoClose(ProcessingOrder order) If the order is in systematic processing and the mission has an order retention period, the order is automatically closed after completion and the eviction time is set.checkFinish(Long orderId) Check whether the processing order and it jobs and job steps are finished.voidLook for next order in state PLANNING, RELEASING and SUSPENDING to restart.Close the processing order and it jobs and job steps.delete(ProcessingOrder order) Delete the processing order and it jobs and job steps.getProcessingFacilities(long id) Get the processing facility(-ies) processing the order At the moment there is normally only one facility to do so.voidlogOrderState(ProcessingOrder order) Log the order state (currently a dummy method)Plan the processing order and it jobs and job steps.prepareSuspend(long id, Boolean force) Prepare the suspend of the processing order.reset(ProcessingOrder order) Reset the processing order and it jobs and job steps.voidrestartReleasingOrder(long id) Restart the thread corresponding to release the order with the given ID.voidrestartSuspendingOrder(long id) Restart the thread corresponding to suspend the order with the given ID.resume(ProcessingOrder order, Boolean wait, String user, String pw) Resume the processing order and it jobs and job steps.retry(ProcessingOrder order) Retry the processing order and it jobs and job steps.sendNotification(ProcessingOrder order) Sends a notification for the given processing order.voidsetHasFailedJobSteps(ProcessingOrder order, Boolean failed) Set the failed job steps flag in the order on failurevoidsetOrderHistory(ProcessingOrder order) Set the order state and time of an order history object.voidSet the deletion time of an order history object.voidsetStateMessage(ProcessingOrder order, String stateMessage) Set the state message of the order.voidsetTimes(ProcessingOrder order) Set the actual completion time and the estimated completion time if it is null.startOrder(ProcessingOrder order) Start the processing order and it jobs and job steps.Suspend the processing order and its jobs and job steps.
-
Field Details
-
config
Planner configuration -
rtb
@Autowired org.springframework.boot.web.client.RestTemplateBuilder rtbREST template builder
-
-
Constructor Details
-
OrderUtil
public OrderUtil()
-
-
Method Details
-
cancel
@Transactional(isolation=REPEATABLE_READ) public PlannerResultMessage cancel(ProcessingOrder orderX) Cancel the processing order and it jobs and job steps.- Parameters:
orderX- The processing order- Returns:
- Result message
-
reset
Reset the processing order and it jobs and job steps.- Parameters:
order- The processing order- Returns:
- Result message
-
delete
Delete the processing order and it jobs and job steps.- Parameters:
order- The processing order- Returns:
- Result message
-
approve
@Transactional(isolation=REPEATABLE_READ) public PlannerResultMessage approve(ProcessingOrder order) Approve the processing order and it jobs and job steps.- Parameters:
order- The processing order- Returns:
- Result message
-
plan
Plan the processing order and it jobs and job steps.- Parameters:
id- The processing order IDfacilityId- The database ID of the processing facility to run the orderwait- indicates whether to wait for the order planning to complete- Returns:
- Result message
-
resume
Resume the processing order and it jobs and job steps.- Parameters:
order- The processing orderwait- indicates whether to wait for the order releasing to completeuser- the username for calling other prosEO services (e. g. AIP Client)pw- the password for calling other prosEO services (e. g. AIP Client)- Returns:
- Result message
-
startOrder
@Transactional(isolation=REPEATABLE_READ) public PlannerResultMessage startOrder(ProcessingOrder order) Start the processing order and it jobs and job steps.- Parameters:
order- The processing order- Returns:
- Result message
-
suspend
Suspend the processing order and its jobs and job steps.- Parameters:
id- The processing order IDforce- The flag to force kill of currently running job steps on processing facility- Returns:
- Result message
-
prepareSuspend
Prepare the suspend of the processing order. All jobs are set to state ON_HOLD first to avoid start of further job steps.- Parameters:
id- The processing order IDforce- The flag to force kill of currently running job steps on processing facility- Returns:
- Result message
-
retry
Retry the processing order and it jobs and job steps.- Parameters:
order- The processing order- Returns:
- Result message
-
close
Close the processing order and it jobs and job steps.- Parameters:
orderId- The processing order ID- Returns:
- Result message
-
checkFinish
Check whether the processing order and it jobs and job steps are finished.- Parameters:
orderId- The processing order ID- Returns:
- true after success
-
checkAutoClose
If the order is in systematic processing and the mission has an order retention period, the order is automatically closed after completion and the eviction time is set.- Parameters:
order- The processing order- Returns:
- true if closed
-
setTimes
Set the actual completion time and the estimated completion time if it is null.- Parameters:
order- The processing order
-
setStateMessage
@Transactional(isolation=REPEATABLE_READ) public void setStateMessage(ProcessingOrder order, String stateMessage) Set the state message of the order.- Parameters:
order- The processing order
-
setOrderHistory
Set the order state and time of an order history object. The time setting depends on the current order state.- Parameters:
order- The processing order
-
setOrderHistoryOrderDeleted
@Transactional(isolation=REPEATABLE_READ) public void setOrderHistoryOrderDeleted(ProcessingOrder order) Set the deletion time of an order history object.- Parameters:
order- The processing order
-
sendNotification
Sends a notification for the given processing order. This method sends a notification to the specified endpoint regarding the processing order. It constructs a message containing relevant information such as product details, order ID, and notification date, and then sends it to the configured notification service endpoint.- Parameters:
order- The processing order for which the notification is to be sent.- Returns:
- true if the notification is successfully sent; false otherwise.
-
getProcessingFacilities
@Transactional(isolation=REPEATABLE_READ) public List<ProcessingFacility> getProcessingFacilities(long id) Get the processing facility(-ies) processing the order At the moment there is normally only one facility to do so.- Parameters:
id- The processing order ID- Returns:
- List of processinig facilities
-
setHasFailedJobSteps
@Transactional(isolation=REPEATABLE_READ) public void setHasFailedJobSteps(ProcessingOrder order, Boolean failed) Set the failed job steps flag in the order on failure- Parameters:
order- the order to updatefailed- indicates whether a job step has failed
-
logOrderState
Log the order state (currently a dummy method)- Parameters:
order- The order for which to log the state
-
checkNextForRestart
public void checkNextForRestart()Look for next order in state PLANNING, RELEASING and SUSPENDING to restart. -
restartReleasingOrder
public void restartReleasingOrder(long id) Restart the thread corresponding to release the order with the given ID.- Parameters:
id- The order ID
-
restartSuspendingOrder
public void restartSuspendingOrder(long id) Restart the thread corresponding to suspend the order with the given ID.- Parameters:
id- The order ID
-