/**
   * Handles exporting the BusinessObject for this Inquiry to XML if it has a custom XML exporter
   * available.
   */
  @RequestMapping(params = "methodToCall=export")
  public ModelAndView export(
      @ModelAttribute("KualiForm") UifFormBase form,
      BindingResult result,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    InquiryForm inquiryForm = (InquiryForm) form;

    Object dataObject = inquiryForm.getDataObject();
    if (dataObject != null) {
      DataObjectEntry dataObjectEntry =
          KRADServiceLocatorWeb.getDataDictionaryService()
              .getDataDictionary()
              .getDataObjectEntry(inquiryForm.getDataObjectClassName());

      Class<? extends Exporter> exporterClass = dataObjectEntry.getExporterClass();
      if (exporterClass != null) {
        Exporter exporter = exporterClass.newInstance();

        response.setContentType(KRADConstants.XML_MIME_TYPE);
        response.setHeader("Content-disposition", "attachment; filename=export.xml");
        exporter.export(
            dataObjectEntry.getDataObjectClass(),
            Collections.singletonList(dataObject),
            KRADConstants.XML_FORMAT,
            response.getOutputStream());
      }
    }

    return null;
  }
  /**
   * @see
   *     org.kuali.rice.krad.uif.service.UifDefaultingService#deriveLookupViewFromMetadata(org.kuali.rice.krad.datadictionary.DataObjectEntry)
   */
  @Override
  public LookupView deriveLookupViewFromMetadata(DataObjectEntry dataObjectEntry) {
    LookupView view = ComponentFactory.getLookupView();
    view.setHeaderText(dataObjectEntry.getObjectLabel() + " Lookup");
    view.setDataObjectClass(dataObjectEntry.getDataObjectClass());
    view.setCriteriaFields(new ArrayList<Component>());
    view.setResultFields(new ArrayList<Component>());
    view.setDefaultSortAttributeNames(dataObjectEntry.getPrimaryKeys());

    addAttributesToLookupCriteria(view, dataObjectEntry);
    addAttributesToLookupResults(view, dataObjectEntry);

    return view;
  }
  /**
   * @see
   *     org.kuali.rice.krad.uif.service.UifDefaultingService#deriveInquiryViewFromMetadata(org.kuali.rice.krad.datadictionary.DataObjectEntry)
   */
  @Override
  public InquiryView deriveInquiryViewFromMetadata(DataObjectEntry dataObjectEntry) {
    // Create the main view object and set the title and BO class
    InquiryView view = ComponentFactory.getInquiryView();
    view.setHeaderText(dataObjectEntry.getObjectLabel());
    view.setDataObjectClassName(dataObjectEntry.getDataObjectClass());

    addAttributeSectionsToInquiryView(view, dataObjectEntry);

    // TODO: if there are updatable reference objects, include sections for them

    // If there are collections on the object, include sections for them
    addCollectionSectionsToInquiryView(view, dataObjectEntry);

    return view;
  }