@Override
    public Set<Resource> fetchWorkflows(Set<String> requestedIds,
        String clusterName, String workflowId) {
      Set<Resource> workflows = new HashSet<>();
      ResultSet rs = null;
      try {
        rs = getResultSet(requestedIds, workflowId);
        while (rs.next()) {
          Resource resource = new ResourceImpl(Resource.Type.Workflow);
          setResourceProperty(resource, WORKFLOW_CLUSTER_NAME_PROPERTY_ID,
              clusterName, requestedIds);
          setString(resource, WORKFLOW_ID_PROPERTY_ID, rs, requestedIds);
          setString(resource, WORKFLOW_NAME_PROPERTY_ID, rs, requestedIds);
          setString(resource, WORKFLOW_USER_NAME_PROPERTY_ID, rs, requestedIds);
          setLong(resource, WORKFLOW_START_TIME_PROPERTY_ID, rs, requestedIds);
          setLong(resource, WORKFLOW_LAST_UPDATE_TIME_PROPERTY_ID, rs,
              requestedIds);
          setLong(resource, WORKFLOW_ELAPSED_TIME_PROPERTY_ID, rs, requestedIds);
          setLong(resource, WORKFLOW_INPUT_BYTES_PROPERTY_ID, rs, requestedIds);
          setLong(resource, WORKFLOW_OUTPUT_BYTES_PROPERTY_ID, rs, requestedIds);
          setInt(resource, WORKFLOW_NUM_JOBS_TOTAL_PROPERTY_ID, rs,
              requestedIds);
          setInt(resource, WORKFLOW_NUM_JOBS_COMPLETED_PROPERTY_ID, rs,
              requestedIds);
          setString(resource, WORKFLOW_PARENT_ID_PROPERTY_ID, rs, requestedIds);
          setString(resource, WORKFLOW_CONTEXT_PROPERTY_ID, rs, requestedIds);
          workflows.add(resource);
        }
      } catch (SQLException e) {
        if (LOG.isDebugEnabled())
          LOG.debug("Caught exception getting resource.", e);
        return Collections.emptySet();
      } finally {
        if (rs != null)
          try {
            rs.close();
          } catch (SQLException e) {
            LOG.error("Exception while closing ResultSet", e);
          }

        close();
      }
      return workflows;
    }
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