/** * Removes the workflow from the data store. * * @param workflowId the id of the workflow to be removed * @param archiveWorkflow if true, the workflow will be archived in the {@link IndexDAO} after removal from {@link ExecutionDAO} */ public void removeWorkflow(String workflowId, boolean archiveWorkflow) { try { Workflow workflow = getWorkflowById(workflowId, true); // remove workflow from ES if (archiveWorkflow) { //Add to elasticsearch indexDAO.updateWorkflow(workflowId, new String[]{RAW_JSON_FIELD, ARCHIVED_FIELD}, new Object[]{objectMapper.writeValueAsString(workflow), true}); } else { // Not archiving, also remove workflowId from index indexDAO.removeWorkflow(workflowId); } // remove workflow from DAO try { executionDAO.removeWorkflow(workflowId); } catch (Exception ex) { Monitors.recordDaoError("executionDao", "removeWorkflow"); throw ex; } } catch (Exception e) { throw new ApplicationException(ApplicationException.Code.BACKEND_ERROR, "Error removing workflow: " + workflowId, e); } }
/** * Removes the workflow from the data store. * * @param workflowId the id of the workflow to be removed * @param archiveWorkflow if true, the workflow will be archived in the {@link IndexDAO} after removal from {@link ExecutionDAO} */ public void removeWorkflow(String workflowId, boolean archiveWorkflow) { try { Workflow workflow = getWorkflowById(workflowId, true); // remove workflow from ES if (archiveWorkflow) { //Add to elasticsearch indexDAO.updateWorkflow(workflowId, new String[]{RAW_JSON_FIELD, ARCHIVED_FIELD}, new Object[]{objectMapper.writeValueAsString(workflow), true}); } else { // Not archiving, also remove workflowId from index indexDAO.removeWorkflow(workflowId); } // remove workflow from DAO try { executionDAO.removeWorkflow(workflowId); } catch (Exception ex) { Monitors.recordDaoError("executionDao", "removeWorkflow"); throw ex; } } catch (Exception e) { throw new ApplicationException(ApplicationException.Code.BACKEND_ERROR, "Error removing workflow: " + workflowId, e); } }