use of com.netflix.conductor.util.Constants.WORKFLOW_DEFINITION_KEY in project conductor by Netflix.
the class CassandraMetadataDAO method getWorkflowDef.
@Override
public Optional<WorkflowDef> getWorkflowDef(String name, int version) {
try {
recordCassandraDaoRequests("getWorkflowDef");
ResultSet resultSet = session.execute(selectWorkflowDefStatement.bind(name, version));
WorkflowDef workflowDef = Optional.ofNullable(resultSet.one()).map(row -> readValue(row.getString(WORKFLOW_DEFINITION_KEY), WorkflowDef.class)).orElse(null);
return Optional.ofNullable(workflowDef);
} catch (Exception e) {
Monitors.error(CLASS_NAME, "getTaskDef");
String errorMsg = String.format("Error fetching workflow def: %s/%d", name, version);
LOGGER.error(errorMsg, e);
throw new ApplicationException(Code.BACKEND_ERROR, errorMsg, e);
}
}
use of com.netflix.conductor.util.Constants.WORKFLOW_DEFINITION_KEY in project conductor by Netflix.
the class CassandraMetadataDAO method getAllWorkflowDefVersions.
private List<WorkflowDef> getAllWorkflowDefVersions(String name) {
try {
ResultSet resultSet = session.execute(selectAllWorkflowDefVersionsByNameStatement.bind(name));
recordCassandraDaoRequests("getAllWorkflowDefVersions", "n/a", name);
List<Row> rows = resultSet.all();
if (rows.size() == 0) {
LOGGER.info("Not workflow definitions were found for : {}", name);
return null;
}
return rows.stream().map(row -> readValue(row.getString(WORKFLOW_DEFINITION_KEY), WorkflowDef.class)).collect(Collectors.toList());
} catch (Exception e) {
Monitors.error(CLASS_NAME, "getAllWorkflowDefVersions");
String errorMsg = String.format("Failed to get workflows defs for : %s", name);
LOGGER.error(errorMsg, e);
throw new ApplicationException(Code.BACKEND_ERROR, errorMsg, e);
}
}
Aggregations