Exemplo n.º 1
0
  public List<CustomField> getCustomCriteriaSearchFields(int limit) {

    User user = getSessionUser();

    String query =
        "SELECT field FROM CustomField field "
            + "WHERE field.criteriaSearch = true "
            + "AND field.enterprise = :enterprise "
            + "AND field.position < :limit order by field.position asc";

    Enterprise enterprise = user.getEnterprise();
    enterprise =
        enterprise.getParentEnterprise() != null ? enterprise.getParentEnterprise() : enterprise;

    return (List<CustomField>)
        entityManager
            .createQuery(query)
            .setParameter("enterprise", enterprise)
            .setParameter("limit", limit)
            .getResultList();
  }
Exemplo n.º 2
0
 public List<CustomField> getCustomFields() {
   User user = getSessionUser();
   return user != null ? getCustomFields(user.getEnterprise()) : null;
 }