i2p.susi.dns

## Class AddressbookBean

- java.lang.Object
- - i2p.susi.dns.BaseBean
  - - i2p.susi.dns.AddressbookBean

- Direct Known Subclasses:
    NamingServiceBean

      public class AddressbookBean
      extends BaseBean

  Bean for managing I2P address books. Provides functionality for loading, filtering, and managing address entries.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `beginIndex` Beginning index for pagination
    `protected String` | `book` The address book name
    `protected String` | `category` The category filter string
    `protected LinkedList<String>` | `deletionMarks` List of entries marked for deletion
    `protected String` | `destination` The destination
    `protected int` | `endIndex` Ending index for pagination
    `protected AddressBean[]` | `entries` Array of address entries
    `protected String` | `filter` The filter string
    `protected String` | `hostname` The hostname
    `protected String` | `search` The search string
    `protected static Comparator<AddressBean>` | `sorter` Comparator for sorting addresses

    - ### Fields inherited from class i2p.susi.dns.BaseBean

      `_context, action, lastSerial, method, PROP_PW_ENABLE, properties, serial`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AddressbookBean()` Default constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected String` | `generateLoadMessage()` Format a message about filtered addressbook size, and the number of displayed entries addressbook.jsp catches the case where the whole book is empty.
    `String` | `getBegin()` Returns the beginning index as string.
    `protected int` | `getBeginInt()` Returns the beginning index as integer.
    `String` | `getBook()` This always returns a valid book, non-null.
    `String` | `getCategoryFilter()` Returns the category filter string.
    `String` | `getDestination()` Returns the destination string.
    `String` | `getDisplayName()` Returns the display name for the address book.
    `String` | `getEnd()` Returns the ending index as string.
    `protected int` | `getEndInt()` Returns the ending index as integer.
    `AddressBean[]` | `getEntries()` Returns the address entries.
    `String` | `getFileName()` Returns the file name for the address book.
    `String` | `getFilter()` Returns the filter string.
    `String` | `getHostname()` Returns the hostname string.
    `String` | `getLoadBookMessages()` Load addressbook and apply filter, returning messages about this.
    `String` | `getMessages()` Perform actions, returning messages about this.
    `int` | `getPageBegin()` Gets the beginning index into results for display purposes.
    `String` | `getResultBegin()` Gets the beginning index into results.
    `String` | `getResultEnd()` Gets ending index into results.
    `String` | `getSearch()` Returns the search string.
    `protected int` | `getTotalFilteredCount()` Gets the total count of filtered results for pagination display.
    `int` | `getTrClass()` Gets the table row class.
    `boolean` | `isHasFilter()` Returns whether a filter is active.
    `boolean` | `isIsEmpty()` Returns whether the address book is empty.
    `boolean` | `isNotEmpty()` Returns whether the address book is not empty.
    `protected boolean` | `isPrefiltered()` Checks if entries are pre-filtered.
    `boolean` | `isValidBook()` Because the following from addressbook.jsp fails parsing in the new EL: javax.el.ELException: Failed to parse the expression Can't figure out why, so just replace it with book.validBook:
    `protected int` | `resultSize()` Gets the size of the lookup result.
    `void` | `setBegin(String s)` Sets the beginning index.
    `void` | `setBook(String book)` Sets the book name.
    `void` | `setDestination(String destination)` Sets the destination string.
    `void` | `setEnd(String s)` Sets the ending index.
    `void` | `setFilter(String filter)` Sets the filter string.
    `void` | `setHostname(String hostname)` Sets the hostname string.
    `void` | `setMarkedForDeletion(String name)` Marks an entry for deletion.
    `void` | `setResetDeletionMarks(String dummy)` Resets the deletion marks.
    `void` | `setSearch(String s)` Sets the search string.
    `void` | `setTrClass(int trClass)` Sets the table row class.
    `protected int` | `totalSize()` Gets the total size of the address book.

    - ### Methods inherited from class i2p.susi.dns.BaseBean

      `_t, _t, _t, addressbookDir, configFile, debug, getAction, getSerial, getTheme, getThemeName, getThemes, isOverrideCssActive, loadConfig, ngettext, reload, setAction, setSerial, storeMethod, useSoraFont, warn`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### beginIndex

          protected int beginIndex

      Beginning index for pagination

    - #### book

          protected String book

      The address book name

    - #### category

          protected String category

      The category filter string

    - #### deletionMarks

          protected final LinkedList<String> deletionMarks

      List of entries marked for deletion

    - #### destination

          protected String destination

      The destination

    - #### endIndex

          protected int endIndex

      Ending index for pagination

    - #### entries

          protected AddressBean[] entries

      Array of address entries

    - #### filter

          protected String filter

      The filter string

    - #### hostname

          protected String hostname

      The hostname

    - #### search

          protected String search

      The search string

    - #### sorter

          protected static final Comparator<AddressBean> sorter

      Comparator for sorting addresses

  - ### Constructor Detail

    - #### AddressbookBean

          public AddressbookBean()

      Default constructor.

  - ### Method Detail

    - #### generateLoadMessage

          protected String generateLoadMessage()

      Format a message about filtered addressbook size, and the number of displayed entries addressbook.jsp catches the case where the whole book is empty.
      Returns:
        message about loading

    - #### getBegin

          public String getBegin()

      Returns the beginning index as string.
      Returns:
        the beginning index as string

    - #### getBeginInt

          protected int getBeginInt()

      Returns the beginning index as integer.
      Returns:
        the beginning index

    - #### getBook

          public String getBook()

      This always returns a valid book, non-null.
      Returns:
        the book name

    - #### getCategoryFilter

          public String getCategoryFilter()

      Returns the category filter string.
      Returns:
        the category filter string

    - #### getDestination

          public String getDestination()

      Returns the destination string.
      Returns:
        the destination string

    - #### getDisplayName

          public String getDisplayName()

      Returns the display name for the address book.
      Returns:
        the display name

    - #### getEnd

          public String getEnd()

      Returns the ending index as string.
      Returns:
        the ending index as string

    - #### getEndInt

          protected int getEndInt()

      Returns the ending index as integer.
      Returns:
        the ending index

    - #### getEntries

          public AddressBean[] getEntries()

      Returns the address entries.
      Returns:
        the address entries

    - #### getFileName

          public String getFileName()

      Returns the file name for the address book.
      Returns:
        the file name

    - #### getFilter

          public String getFilter()

      Returns the filter string.
      Returns:
        the filter string

    - #### getHostname

          public String getHostname()

      Returns the hostname string.
      Returns:
        the hostname string

    - #### getLoadBookMessages

          public String getLoadBookMessages()

      Load addressbook and apply filter, returning messages about this.
      Returns:
        messages about loading the address book

    - #### getMessages

          public String getMessages()

      Perform actions, returning messages about this.
      Returns:
        messages about the performed actions

    - #### getPageBegin

          public int getPageBegin()

      Gets the beginning index into results for display purposes. Returns the actual page start index, not clamped to resultSize().
      Returns:
        the page start index (0-based)

    - #### getResultBegin

          public String getResultBegin()

      Gets the beginning index into results.
      Returns:
        beginning index into results

    - #### getResultEnd

          public String getResultEnd()

      Gets ending index into results.
      Returns:
        ending index into results

    - #### getSearch

          public String getSearch()

      Returns the search string.
      Returns:
        the search string

    - #### getTotalFilteredCount

          protected int getTotalFilteredCount()

      Gets the total count of filtered results for pagination display. Subclasses can override to return the count before manual pagination.
      Returns:
        the total count of filtered results

    - #### getTrClass

          public int getTrClass()

      Gets the table row class.
      Returns:
        the table row class

    - #### isHasFilter

          public boolean isHasFilter()

      Returns whether a filter is active.
      Returns:
        true if a filter is active

    - #### isIsEmpty

          public boolean isIsEmpty()

      Returns whether the address book is empty.
      Returns:
        true if the address book is empty

    - #### isNotEmpty

          public boolean isNotEmpty()

      Returns whether the address book is not empty.
      Returns:
        true if the address book is not empty

    - #### isPrefiltered

          protected boolean isPrefiltered()

      Checks if entries are pre-filtered.
      Returns:
        true if pre-filtered

    - #### isValidBook

          public boolean isValidBook()

      Because the following from addressbook.jsp fails parsing in the new EL: javax.el.ELException: Failed to parse the expression Can't figure out why, so just replace it with book.validBook:

          <c:if test="${book.master || book.router || book.published || book.private}">

      This always returns true anyway, because getBook() always returns a valid book.
      Returns:
        true

    - #### resultSize

          protected int resultSize()

      Gets the size of the lookup result.
      Returns:
        the size of the lookup result

    - #### setBegin

          public void setBegin(String s)

      Sets the beginning index.
      Parameters:
        `s` - the beginning index as string

    - #### setBook

          public void setBook(String book)

      Sets the book name.
      Parameters:
        `book` - the book name to set

    - #### setDestination

          public void setDestination(String destination)

      Sets the destination string.
      Parameters:
        `destination` - the destination string to set

    - #### setEnd

          public void setEnd(String s)

      Sets the ending index.
      Parameters:
        `s` - the ending index as string

    - #### setFilter

          public void setFilter(String filter)

      Sets the filter string.
      Parameters:
        `filter` - filter string to set

    - #### setHostname

          public void setHostname(String hostname)

      Sets the hostname string.
      Parameters:
        `hostname` - the hostname to set

    - #### setMarkedForDeletion

          public void setMarkedForDeletion(String name)

      Marks an entry for deletion.
      Parameters:
        `name` - the name to mark for deletion

    - #### setResetDeletionMarks

          public void setResetDeletionMarks(String dummy)

      Resets the deletion marks.
      Parameters:
        `dummy` - dummy parameter

    - #### setSearch

          public void setSearch(String s)

      Sets the search string.
      Parameters:
        `s` - the search string to set

    - #### setTrClass

          public void setTrClass(int trClass)

      Sets the table row class.
      Parameters:
        `trClass` - table row class

    - #### totalSize

          protected int totalSize()

      Gets the total size of the address book.
      Returns:
        the total size of the address book