/**
   * Get the max number
   *
   * @param entry the entry
   * @return the max number
   */
  public int getMaxNumber(IEntry entry) {
    int nMaxNumber = 1;

    if (entry instanceof fr.paris.lutece.plugins.directory.business.EntryTypeNumbering
        && (entry.getEntryType() != null)
        && (entry.getDirectory() != null)) {
      Plugin pluginDirectory = PluginService.getPlugin(DirectoryPlugin.PLUGIN_NAME);
      nMaxNumber =
          RecordFieldHome.findMaxNumber(
              entry.getIdEntry(), entry.getDirectory().getIdDirectory(), pluginDirectory);
    }

    return nMaxNumber;
  }
  /**
   * Get the number to insert to the entry type numbering.
   *
   * @param entry the entry type numbering
   * @param strNumber the number to insert
   * @return the number
   * @throws DirectoryErrorException exception if the number already exists on an another record
   *     field
   */
  public int getNumber(IEntry entry, String strNumber) throws DirectoryErrorException {
    int nNumber = DirectoryUtils.CONSTANT_ID_NULL;

    if (entry instanceof fr.paris.lutece.plugins.directory.business.EntryTypeNumbering
        && (entry.getFields() != null)
        && (entry.getFields().size() > 0)
        && (entry.getEntryType() != null)
        && (entry.getDirectory() != null)) {
      nNumber = buildNumber(entry, strNumber);

      if (nNumber != DirectoryUtils.CONSTANT_ID_NULL) {
        Plugin pluginDirectory = PluginService.getPlugin(DirectoryPlugin.PLUGIN_NAME);

        if (RecordFieldHome.isNumberOnARecordField(
            entry.getIdEntry(), entry.getDirectory().getIdDirectory(), nNumber, pluginDirectory)) {
          throw new DirectoryErrorException(
              entry.getTitle(),
              "Directory Error - The number already exists in an " + "another record field.");
        }
      }
    }

    return nNumber;
  }
  /**
   * Get the list of record fields from a given Filter
   *
   * @param recordFieldFilter the filter
   * @return a map of (user attribute name, user attribute value)
   */
  public List<RecordField> getRecordFieldByFilter(RecordFieldFilter recordFieldFilter) {
    Plugin plugin = PluginService.getPlugin(DirectoryPlugin.PLUGIN_NAME);

    return RecordFieldHome.getRecordFieldList(recordFieldFilter, plugin);
  }