Class HashLookupTemplate<POJO extends HashLookupTemplate<POJO>>

java.lang.Object
Type Parameters:
POJO - the POJO type implementing HashLookupTemplate and HashLookupPojo
All Implemented Interfaces:
java.lang.Comparable<POJO>, DbPojo, HashLookupPojo<POJO>
Direct Known Subclasses:
Acl, PluginAttributes, PluginInformation, PluginRefInformation, PluginRiskInformation, PluginVulnInformation

@MappedSuperclass
public abstract class HashLookupTemplate<POJO extends HashLookupTemplate<POJO>>
extends GeneratedIdPojo
implements HashLookupPojo<POJO>
The standard implementation of the HashLookupPojo interface. This is used by the majority of HashLookupPojos, although a handful do not use it because it inherits extra json functionality from ExtensibleJsonPojo
  • Constructor Details

  • Method Details

    • get_hash

      public Hash get_hash()
      Description copied from interface: HashLookupPojo
      Get the _hash of the "object lookup" pojo used for indexing it.
      Specified by:
      get_hash in interface HashLookupPojo<POJO extends HashLookupTemplate<POJO>>
      Returns:
      the Hash of the object lookup
    • set_hash

      public void set_hash​(Hash hash) throws java.lang.IllegalStateException
      Description copied from interface: HashLookupPojo
      Set the _hash of the pojo used for indexing it
      Specified by:
      set_hash in interface HashLookupPojo<POJO extends HashLookupTemplate<POJO>>
      Parameters:
      hash - the hash to set
      Throws:
      java.lang.IllegalStateException - if the hash is being changed to a value different than previously set. All values including the hash are intended to be immutable once a lookup record is created
    • __set

      protected void __set​(GeneratedIdPojo other)
      Description copied from class: GeneratedIdPojo
      Convenience method for any subclasses which wish to implement one of the lookup interfaces (MapLookup or HashLookup). This can be invoked to synchronize the ExtraJson between two pojos representing the same DB record. Unlike the NaturalIdPojo, __set here does NOT set the id, because it is a surrogate key and not a natural part of the Nessus API response
      Overrides:
      __set in class GeneratedIdPojo
      Parameters:
      other - the other pojo which also represents the same DB record, to synchronize this pojo's extraJson with
    • _isHashCalculated

      public boolean _isHashCalculated()
      Description copied from interface: HashLookupPojo
      Shortcut for the StringHashLookupDao to determine what approach to most efficiently use to find a matching value for this lookup. If the hash is already calculated, it is most efficient to use the hash. If it is not, it may be more efficient to use the _match method
      Specified by:
      _isHashCalculated in interface HashLookupPojo<POJO extends HashLookupTemplate<POJO>>
      Returns:
      true if the hash has already been calculated, false if not
    • __prepare

      public void __prepare()
      Description copied from class: ExtensibleJsonPojo
      Convienence method for subclass implementations to invoke from their _prepare() method (note the difference in number of underscores), which performs DB preparations on the ExtraJson
      Overrides:
      __prepare in class ExtensibleJsonPojo
    • hashCode

      public int hashCode()
      Description copied from class: GeneratedIdPojo
      Default implementation of the java hashCode() method used by HashMap and HashSet. Performs a bitwise XOR on the hashCode of the implementing type's .class object, and the id of the pojo.
      Overrides:
      hashCode in class GeneratedIdPojo
      Returns:
      a java hash code to uniquely identify and match this pojo with other pojos representing the same DB record