use of org.apache.oozie.util.db.SqlStatement.ResultSetReader in project oozie by apache.
the class DBLiteWorkflowLib method get.
/**
* Loads the Workflow instance with the given ID.
*
* @param id
* @return pInstance returns a workflow instance with the given ID
* @throws WorkflowException
*/
@Override
public WorkflowInstance get(String id) throws WorkflowException {
ParamChecker.notNull(id, "id");
try {
ResultSetReader rs = SqlStatement.parse(SqlStatement.selectColumns(OozieColumn.PI_state).where(SqlStatement.isEqual(OozieColumn.PI_wfId, ParamChecker.notNull(id, "id"))).prepareAndSetValues(connection).executeQuery());
rs.next();
LiteWorkflowInstance pInstance = WritableUtils.fromByteArray(rs.getByteArray(OozieColumn.PI_state), LiteWorkflowInstance.class);
return pInstance;
} catch (SQLException e) {
throw new WorkflowException(ErrorCode.E0713, e.getMessage(), e);
}
}
Aggregations