Exemplo n.º 1
0
  public static Integer getMaximumCountInCompoundQuery(Queriable queryToExecute) throws Exception {
    Integer count = null;
    if (queryToExecute instanceof CompoundQuery) {
      CompoundQuery compoundQuery = (CompoundQuery) queryToExecute;
      if (compoundQuery.getInstitutionCriteria() != null) {
        AddConstrainsToQueriesHelper helper = new AddConstrainsToQueriesHelper();
        compoundQuery =
            helper.constrainQueryWithInstitution(
                compoundQuery, compoundQuery.getInstitutionCriteria());
      }
      count = CompoundQueryProcessor.getMaxCount(compoundQuery);
    }

    return count;
  }
Exemplo n.º 2
0
  public static CompoundResultSet executeCompoundQuery(Queriable queryToExecute) throws Exception {
    CompoundResultSet compoundResultset = null;
    if (queryToExecute instanceof CompoundQuery) {
      CompoundQuery compoundQuery = (CompoundQuery) queryToExecute;
      if (compoundQuery.getInstitutionCriteria() != null) {
        AddConstrainsToQueriesHelper helper = new AddConstrainsToQueriesHelper();
        compoundQuery =
            helper.constrainQueryWithInstitution(
                compoundQuery, compoundQuery.getInstitutionCriteria());
      }
      // Get query count first
      // Integer count = getMaximumCountInCompoundQuery(compoundQuery);
      compoundResultset = CompoundQueryProcessor.execute(compoundQuery);
      if (compoundResultset != null & compoundResultset.getResults() != null) {
        Integer count = compoundResultset.getResults().size();
        if (count > RembrandtConstants.QUERY_LIMIT) {
          throw new Exception(RembrandtConstants.QUERY_OVER_LIMIT);
        }
      }
    }

    return compoundResultset;
  }