Class SimpleStringLookupPojo<POJO extends SimpleStringLookupPojo<POJO>>

java.lang.Object
tenapull.data.entity.template.SimpleStringLookupPojo<POJO>
Type Parameters:
POJO - The class implementing SimpleStringLookupPojo
All Implemented Interfaces:
java.lang.Comparable<POJO>, DbPojo, StringLookupPojo<POJO>
Direct Known Subclasses:
CvssTemporalVector, CvssVector, HostFqdn, HostIp, Hostname, HostNetbiosName, PluginFamily, PluginName, PluginRefValue, PluginRiskFactor, PluginSeeAlso, PolicyTemplateUuid, Scanner, ScanOwner, ScanPolicy, ScanScheduleType, ScanStatus, ScanType, ScanUuid, Timezone, Url, VulnerabilityScore

@MappedSuperclass
public abstract class SimpleStringLookupPojo<POJO extends SimpleStringLookupPojo<POJO>>
extends java.lang.Object
implements StringLookupPojo<POJO>
Abstract super class for all simple string lookup entities. Unlike the StringHashLookupPojo entities, these entities have strings which all fit into 255 or less characters, so can be indexed by MySQL. Most have a varchar(255) field, although some lookups known to have consistently short text strings may be shorter than this to improve DB indexing efficiency
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static java.lang.String FIELD_NAME
    The name of the field containing the lookup string
  • Constructor Summary

    Constructors 
    Constructor Description
    SimpleStringLookupPojo()  
  • Method Summary

    Modifier and Type Method Description
    void _prepare()
    Prepares this entity for saving/inserting into the DB
    int compareTo​(POJO other)
    For sorting the lookups in "ASCII-betical" order on the basis of their value string
    boolean equals​(java.lang.Object o)
    Returns true if and only if the compared object is of the same class and they share the same lookup value
    int getId()
    Get the surrogate primary key id for the lookup
    java.lang.String getValue()
    Get the string lookup value this record represents
    int hashCode()
    Create java hashCode using the value string, for use in a HashMap or HashSet
    void setId​(int id)
    Set the surrogate primary key id for the lookup
    void setValue​(java.lang.String value)
    Sets the string lookup value this record represents, after doing an immutability check
    com.fasterxml.jackson.databind.JsonNode toJsonNode()
    Converts this lookup entity into a JSON TextNode
    java.lang.String toJsonString()
    Converts this lookup entity's value into a JSON-escaped String
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • getId

      public int getId()
      Get the surrogate primary key id for the lookup
      Specified by:
      getId in interface DbPojo
      Returns:
      the id
    • setId

      public void setId​(int id)
      Set the surrogate primary key id for the lookup
      Specified by:
      setId in interface DbPojo
      Parameters:
      id - the id
    • getValue

      public java.lang.String getValue()
      Get the string lookup value this record represents
      Specified by:
      getValue in interface StringLookupPojo<POJO extends SimpleStringLookupPojo<POJO>>
      Returns:
      the string lookup value
    • setValue

      public void setValue​(java.lang.String value)
      Sets the string lookup value this record represents, after doing an immutability check
      Specified by:
      setValue in interface StringLookupPojo<POJO extends SimpleStringLookupPojo<POJO>>
      Parameters:
      value - the string lookup value to set
      Throws:
      java.lang.IllegalStateException - if the value field has already been set and the value being set does not match a pre-existing value. These record are meant to be immutable in the DB once created
    • toJsonNode

      public com.fasterxml.jackson.databind.JsonNode toJsonNode()
      Converts this lookup entity into a JSON TextNode
      Specified by:
      toJsonNode in interface DbPojo
      Returns:
      a JSON TextNode representing the string value of this entity
    • toJsonString

      public java.lang.String toJsonString() throws com.fasterxml.jackson.core.JsonProcessingException
      Converts this lookup entity's value into a JSON-escaped String
      Specified by:
      toJsonString in interface DbPojo
      Returns:
      the lookup string value as a JSON-escaped String
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
      Returns:
      the lookup value of this entity
    • equals

      public boolean equals​(java.lang.Object o)
      Returns true if and only if the compared object is of the same class and they share the same lookup value
      Overrides:
      equals in class java.lang.Object
      Parameters:
      o -
      Returns:
    • _prepare

      public void _prepare()
      Prepares this entity for saving/inserting into the DB
      Specified by:
      _prepare in interface DbPojo
    • hashCode

      public int hashCode()
      Create java hashCode using the value string, for use in a HashMap or HashSet
      Overrides:
      hashCode in class java.lang.Object
      Returns:
    • compareTo

      public int compareTo​(POJO other)
      For sorting the lookups in "ASCII-betical" order on the basis of their value string
      Specified by:
      compareTo in interface java.lang.Comparable<POJO extends SimpleStringLookupPojo<POJO>>
      Parameters:
      other - the other lookup to compare against
      Returns: