Package de.dlr.proseo.procmgr.rest
Class WorkflowMgr
java.lang.Object
de.dlr.proseo.procmgr.rest.WorkflowMgr
Service methods required to create, modify and delete workflows in the prosEO database, and to query the database about such
workflows
- Author:
- Katharina Bassler
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) ProcessorManagerConfigurationThe processor manager configuration(package private) org.springframework.boot.web.client.RestTemplateBuilderREST template builder -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncountWorkflows(String missionCode, String workflowName, String workflowVersion, String inputProductClass, String configuredProcessor, Boolean enabled) Count the workflows matching the specified workflowName, workflowVersion, inputProductClass, or configured processor.createWorkflow(RestWorkflow restWorkflow) Create a new workflowvoidDelete a workflow by IDgetWorkflowById(Long id) Get a workflow by IDgetWorkflows(String missionCode, String workflowName, String workflowVersion, String inputProductClass, String configuredProcessor, Boolean enabled, Integer recordFrom, Integer recordTo, String[] orderBy) Get workflows by mission, name and version (user-defined version, not database version)modifyWorkflow(Long id, RestWorkflow restWorkflow) Update a workflow by ID
-
Field Details
-
rtb
@Autowired org.springframework.boot.web.client.RestTemplateBuilder rtbREST template builder -
config
The processor manager configuration
-
-
Constructor Details
-
WorkflowMgr
public WorkflowMgr()
-
-
Method Details
-
countWorkflows
public String countWorkflows(String missionCode, String workflowName, String workflowVersion, String inputProductClass, String configuredProcessor, Boolean enabled) Count the workflows matching the specified workflowName, workflowVersion, inputProductClass, or configured processor.- Parameters:
missionCode- the mission codeworkflowName- the workflow nameworkflowVersion- the workflow versioninputProductClass- the input product classconfiguredProcessor- the configured processorenabled- whether the workflow is enabled- Returns:
- the number of workflows found as string
- Throws:
SecurityException- if a cross-mission data access was attempted
-
createWorkflow
public RestWorkflow createWorkflow(RestWorkflow restWorkflow) throws IllegalArgumentException, SecurityException Create a new workflow- Parameters:
restWorkflow- a Json representation of the new workflow- Returns:
- a Json representation of the workflow after creation (with ID and version number)
- Throws:
IllegalArgumentException- if any of the input data was invalidSecurityException- if a cross-mission data access was attempted
-
deleteWorkflowById
public void deleteWorkflowById(Long id) throws jakarta.persistence.EntityNotFoundException, SecurityException, IllegalArgumentException, RuntimeException Delete a workflow by ID- Parameters:
id- the ID of the workflow to delete- Throws:
jakarta.persistence.EntityNotFoundException- if the workflow to delete does not exist in the databaseRuntimeException- if the deletion was not performed as expectedIllegalArgumentException- if the ID of the workflow to delete was not given, or if dependent objects existSecurityException- if a cross-mission data access was attempted
-
getWorkflowById
public RestWorkflow getWorkflowById(Long id) throws IllegalArgumentException, jakarta.persistence.NoResultException, SecurityException Get a workflow by ID- Parameters:
id- the workflow ID- Returns:
- a Json object corresponding to the workflow found
- Throws:
IllegalArgumentException- if no workflow ID was givenjakarta.persistence.NoResultException- if no workflow with the given ID existsSecurityException- if a cross-mission data access was attempted
-
modifyWorkflow
public RestWorkflow modifyWorkflow(Long id, RestWorkflow restWorkflow) throws jakarta.persistence.EntityNotFoundException, IllegalArgumentException, SecurityException, ConcurrentModificationException Update a workflow by ID- Parameters:
id- the ID of the workflow to updaterestWorkflow- a Json object containing the modified (and unmodified) attributes- Returns:
- a response containing a Json object corresponding to the workflow after modification (with ID and version for all contained objects)
- Throws:
jakarta.persistence.EntityNotFoundException- if no workflow with the given ID existsIllegalArgumentException- if any of the input data was invalidSecurityException- if a cross-mission data access was attemptedConcurrentModificationException- if the workflow has been modified since retrieval by the client
-
getWorkflows
public List<RestWorkflow> getWorkflows(String missionCode, String workflowName, String workflowVersion, String inputProductClass, String configuredProcessor, Boolean enabled, Integer recordFrom, Integer recordTo, String[] orderBy) throws jakarta.persistence.NoResultException, SecurityException Get workflows by mission, name and version (user-defined version, not database version)- Parameters:
missionCode- the mission codeworkflowName- the name of the workflow (class)workflowVersion- the workflow versioninputProductClass- the input product classconfiguredProcessor- the configured processorenabled- whether the workflow is enabledrecordFrom- 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 space- Returns:
- a list of Json objects representing workflows satisfying the search criteria
- Throws:
jakarta.persistence.NoResultException- if no workflows matching the given search criteria could be foundSecurityException- if a cross-mission data access was attempted
-