Search in sources :

Example 1 with ResultSetReader

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);
    }
}
Also used : ResultSetReader(org.apache.oozie.util.db.SqlStatement.ResultSetReader) SQLException(java.sql.SQLException) WorkflowException(org.apache.oozie.workflow.WorkflowException)

Aggregations

SQLException (java.sql.SQLException)1 ResultSetReader (org.apache.oozie.util.db.SqlStatement.ResultSetReader)1 WorkflowException (org.apache.oozie.workflow.WorkflowException)1