@Override
    public Set<Resource> fetchJobDetails(Set<String> requestedIds,
        String clusterName, String workflowId, String jobId) {
      Set<Resource> jobs = new HashSet<>();
      ResultSet rs = null;
      try {
        rs = getResultSet(requestedIds, workflowId, jobId);
        while (rs.next()) {
          Resource resource = new ResourceImpl(Resource.Type.Job);
          setResourceProperty(resource, JOB_CLUSTER_NAME_PROPERTY_ID,
              clusterName, requestedIds);
          setString(resource, JOB_ID_PROPERTY_ID, rs, requestedIds);
          setString(resource, JOB_NAME_PROPERTY_ID, rs, requestedIds);
          setString(resource, JOB_STATUS_PROPERTY_ID, rs, requestedIds);
          setString(resource, JOB_USER_NAME_PROPERTY_ID, rs, requestedIds);
          if (requestedIds.contains(JOB_SUBMIT_TIME_PROPERTY_ID)
              || requestedIds.contains(JOB_ELAPSED_TIME_PROPERTY_ID)) {
            long submitTime = rs.getLong(JobFields.SUBMITTIME.toString());
            if (requestedIds.contains(JOB_SUBMIT_TIME_PROPERTY_ID))
              setResourceProperty(resource, JOB_SUBMIT_TIME_PROPERTY_ID,
                  submitTime, requestedIds);
            if (requestedIds.contains(JOB_ELAPSED_TIME_PROPERTY_ID)) {
              long finishTime = rs.getLong(JobFields.FINISHTIME.toString());
              if (finishTime > submitTime)
                setResourceProperty(resource, JOB_ELAPSED_TIME_PROPERTY_ID,
                    finishTime - submitTime, requestedIds);
              else
                setResourceProperty(resource, JOB_ELAPSED_TIME_PROPERTY_ID, 0l,
                    requestedIds);
            }
          }
          setInt(resource, JOB_MAPS_PROPERTY_ID, rs, requestedIds);
          setInt(resource, JOB_REDUCES_PROPERTY_ID, rs, requestedIds);
          setLong(resource, JOB_INPUT_BYTES_PROPERTY_ID, rs, requestedIds);
          setLong(resource, JOB_OUTPUT_BYTES_PROPERTY_ID, rs, requestedIds);
          setString(resource, JOB_CONF_PATH_PROPERTY_ID, rs, requestedIds);
          setString(resource, JOB_WORKFLOW_ID_PROPERTY_ID, rs, requestedIds);
          setString(resource, JOB_WORKFLOW_ENTITY_NAME_PROPERTY_ID, rs,
              requestedIds);
          jobs.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 jobs;
    }
Create a postgres job fetcher that uses a given connection factory.

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