@RequiresSession
  public List<HostRoleCommandEntity> findByStatus(
      Collection<HostRoleStatus> statuses) {
    TypedQuery<HostRoleCommandEntity> query = entityManagerProvider.get().createNamedQuery(
        "HostRoleCommandEntity.findByCommandStatuses",
        HostRoleCommandEntity.class);

    query.setParameter("statuses", statuses);
    return daoUtils.selectList(query);
  }
Gets the commands in a particular status.

@param statuses
         the statuses to include (not {@code null}).
@return the commands in the given set of statuses.
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java