protected void addAttributesToLookupCriteria(LookupView view, DataObjectEntry dataObjectEntry) {
    AttributeDefinition activeAttribute = null;
    for (AttributeDefinition attr : dataObjectEntry.getAttributes()) {
      // Check if we have been told not to display this attribute here
      boolean dontDisplay =
          hasHintOfType(attr.getDataObjectAttribute(), UifDisplayHintType.NO_LOOKUP_CRITERIA);
      dontDisplay |= (attr.getControlField() instanceof HiddenControl);

      if (dontDisplay) {
        continue;
      }
      if (attr.getName().equals(KRADPropertyConstants.ACTIVE)) {
        activeAttribute = attr;
        continue; // leave until the end of the lookup criteria
      }
      LookupInputField field = ComponentFactory.getLookupCriteriaInputField();
      field.setPropertyName(attr.getName());
      field.setLabel(attr.getLabel());
      view.getCriteriaFields().add(field);
    }
    // If there was one, add the active attribute at the end
    if (activeAttribute != null) {
      LookupInputField field = ComponentFactory.getLookupCriteriaInputField();
      field.setPropertyName(activeAttribute.getName());
      field.setLabel(activeAttribute.getLabel());
      view.getCriteriaFields().add(field);
    }
  }
  /** @see org.kuali.rice.krad.service.DataDictionaryService#getAttributeLabel(java.lang.String) */
  public String getAttributeLabel(String entryName, String attributeName) {
    String label = "";

    AttributeDefinition attributeDefinition = getAttributeDefinition(entryName, attributeName);
    if (attributeDefinition != null) {
      // KULRICE-4445 prevent NullPointerException by ensuring a label is set
      label = attributeDefinition.getLabel();
      if (!StringUtils.isEmpty(attributeDefinition.getDisplayLabelAttribute())) {
        attributeDefinition =
            getAttributeDefinition(entryName, attributeDefinition.getDisplayLabelAttribute());
        if (attributeDefinition != null) {
          label = attributeDefinition.getLabel();
        }
      }
    }

    return label;
  }
  @SuppressWarnings("unchecked")
  protected void addAttributeSectionsToInquiryView(
      InquiryView view, DataObjectEntry dataObjectEntry) {
    // Set up data structures to manage the creation of sections
    Map<String, Group> inquirySectionsById = new HashMap<String, Group>();
    Group currentGroup = createInquirySection("default", dataObjectEntry.getObjectLabel());
    inquirySectionsById.put(currentGroup.getId(), currentGroup);
    ((List<Group>) view.getItems()).add(currentGroup);

    // Loop over the attributes on the data object, adding them into the inquiry
    // If we have an @Section notation, switch to the section, creating if the ID is unknown
    List<Component> items =
        (List<Component>) currentGroup.getItems(); // needed to deal with generics issue
    for (AttributeDefinition attr : dataObjectEntry.getAttributes()) {
      boolean dontDisplay =
          hasHintOfType(attr.getDataObjectAttribute(), UifDisplayHintType.NO_INQUIRY);
      dontDisplay |= (attr.getControlField() instanceof HiddenControl);
      // Check for a section hint
      // Create or retrieve existing section as determined by the ID on the annotation
      UifDisplayHint sectionHint =
          getHintOfType(attr.getDataObjectAttribute(), UifDisplayHintType.SECTION);
      if (sectionHint != null) {
        if (StringUtils.isNotBlank(sectionHint.id())) {
          currentGroup = inquirySectionsById.get(sectionHint.id());
          if (currentGroup == null) {
            String sectionLabel = sectionHint.label();
            if (StringUtils.isBlank(sectionLabel)) {
              sectionLabel = deriveHumanFriendlyNameFromPropertyName(sectionHint.id());
            }

            currentGroup = createInquirySection(sectionHint.id(), sectionHint.label());
            inquirySectionsById.put(currentGroup.getId(), currentGroup);
            ((List<Group>) view.getItems()).add(currentGroup);
          }
        } else {
          LOG.warn("SECTION UifDisplayHint given without an ID - assuming 'default'");
          currentGroup = inquirySectionsById.get("default");
        }
        items = (List<Component>) currentGroup.getItems();
      }

      // This is checked after the section test, since the @Section annotation
      // would be on the FK field
      if (dontDisplay) {
        continue;
      }

      DataField dataField = ComponentFactory.getDataField();
      dataField.setPropertyName(attr.getName());
      dataField.setLabel(attr.getLabel());
      items.add(dataField);
    }
  }
  /**
   * Override of InputField copy to setup properties necessary to make the field usable for
   * inputting search criteria.
   *
   * <p>Note super is not being called because we don't want to add restirctions that can cause
   * problems with the use of wildcard {@inheritDoc}
   */
  @Override
  public void copyFromAttributeDefinition(AttributeDefinition attributeDefinition) {
    // label
    if (StringUtils.isEmpty(getLabel())) {
      setLabel(attributeDefinition.getLabel());
    }

    // short label
    if (StringUtils.isEmpty(getShortLabel())) {
      setShortLabel(attributeDefinition.getShortLabel());
    }

    // security
    if ((attributeDefinition.getAttributeSecurity() != null)
        && ((getDataFieldSecurity() == null)
            || (getDataFieldSecurity().getAttributeSecurity() == null))) {
      initializeComponentSecurity();

      getDataFieldSecurity().setAttributeSecurity(attributeDefinition.getAttributeSecurity());
    }

    // options
    if (getOptionsFinder() == null) {
      setOptionsFinder(attributeDefinition.getOptionsFinder());
    }

    // use control from dictionary if not specified and convert for searching
    if (getControl() == null) {
      Control control = convertControlToLookupControl(attributeDefinition);
      setControl(control);
    }

    // overwrite maxLength to allow for wildcards and ranges; set a minimum max length unless it is
    // greater than 100
    setMaxLength(100);
    if (attributeDefinition.getMaxLength() != null && (attributeDefinition.getMaxLength() > 100)) {
      setMaxLength(attributeDefinition.getMaxLength());
    }

    // set default value for active field to true
    if (getDefaultValue() == null
        || (getDefaultValue() instanceof String
            && StringUtils.isEmpty((String) getDefaultValue()))) {
      if ((StringUtils.equals(getPropertyName(), KRADPropertyConstants.ACTIVE))) {
        setDefaultValue(KRADConstants.YES_INDICATOR_VALUE);
      }
    }
  }