コード例 #1
0
  public ActionForward search(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    ReportTrackingLookupForm lookupForm = (ReportTrackingLookupForm) form;

    Lookupable kualiLookupable = lookupForm.getLookupable();
    if (kualiLookupable == null) {
      LOG.error("Lookupable is null.");
      throw new RuntimeException("Lookupable is null.");
    }

    // validate search parameters
    kualiLookupable.validateSearchParameters(lookupForm.getFields());

    if (lookupForm.isViewRawResults()) {
      return super.search(mapping, lookupForm, request, response);
    } else {
      LookupUtils.preProcessRangeFields(lookupForm.getFields());
      List<ReportTracking> groupedResults =
          getReportTrackingDao()
              .getResultsGroupedBy(
                  lookupForm.getFields(),
                  lookupForm.getGroupedByFields(),
                  lookupForm.getGroupedByDisplayFields());
      lookupForm.setGroupedByResults(groupedResults);
      return mapping.findForward(Constants.MAPPING_BASIC);
    }
  }
コード例 #2
0
  public ActionForward moveGroupByColumns(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    ReportTrackingLookupForm lookupForm = (ReportTrackingLookupForm) form;
    String fieldName = lookupForm.getMoveField();
    Integer newIndex = lookupForm.getNewColumnIndex() - 1;
    Integer oldIndex = lookupForm.getGroupedByDisplayFields().indexOf(fieldName);
    if (newIndex >= 0 && oldIndex >= 0) {
      lookupForm.getGroupedByDisplayFields().remove(fieldName);
      if (newIndex > oldIndex) {
        newIndex--;
      }
      lookupForm.getGroupedByDisplayFields().add(newIndex, fieldName);

      String origItem = lookupForm.getGroupedByFields().get(oldIndex);
      lookupForm.getGroupedByFields().remove(origItem);
      lookupForm.getGroupedByFields().add(newIndex, origItem);
    }

    return mapping.findForward(Constants.MAPPING_BASIC);
  }