@RequiresSession
  public String findRequestContext(long requestId) {
    TypedQuery<String> query = entityManagerProvider.get().createQuery(
      "SELECT stage.requestContext " + "FROM StageEntity stage " +
        "WHERE stage.requestId=?1", String.class);
    String result =  daoUtils.selectOne(query, requestId);
    if (result != null) {
      return result;
    }
    else {
      return ""; // Since it is defined as empty string in the StageEntity
    }
  }
Finds the first stage matching any of the specified statuses for every
request. For example, to find the first {@link HostRoleStatus#IN_PROGRESS}
stage for every request, pass in
{@link HostRoleStatus#IN_PROGRESS_STATUSES}.

@param statuses
         {@link HostRoleStatus}
@return the list of the first matching stage for the given statuses for
        every request.
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/StageDAO.java