protected ResultSet getResultSet(Set<String> requestedIds, String workflowId)
        throws SQLException {
      db = null;
      ps = null;
      db = connectionFactory.getConnection();
      if (workflowId == null) {
        ps = db.prepareStatement("SELECT " + getDBFieldString(requestedIds)
            + " FROM " + WORKFLOW_TABLE_NAME);
      } else {
        ps = db.prepareStatement("SELECT " + getDBFieldString(requestedIds)
            + " FROM " + WORKFLOW_TABLE_NAME + " WHERE "
            + WorkflowFields.WORKFLOWID + " = ?");
        ps.setString(1, workflowId);
      }
      return ps.executeQuery();
    }
Create a postgres workflow fetcher that uses a given connection factory.

@param connectionFactory
         a connection factory
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WorkflowResourceProvider.java