Package tenapull.data.entity.template
Class HashLookupTemplate<POJO extends HashLookupTemplate<POJO>>
java.lang.Object
tenapull.data.entity.template.ExtensibleJsonPojo
tenapull.data.entity.template.GeneratedIdPojo
tenapull.data.entity.template.HashLookupTemplate<POJO>
- 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 Summary
Constructors Constructor Description HashLookupTemplate()
-
Method Summary
Modifier and Type Method Description void
__prepare()
Convienence method for subclass implementations to invoke from their _prepare() method (note the difference in number of underscores), which performs DB preparations on the ExtraJsonprotected void
__set(GeneratedIdPojo other)
Convenience method for any subclasses which wish to implement one of the lookup interfaces (MapLookup or HashLookup).boolean
_isHashCalculated()
Shortcut for the StringHashLookupDao to determine what approach to most efficiently use to find a matching value for this lookup.Hash
get_hash()
Get the _hash of the "object lookup" pojo used for indexing it.int
hashCode()
Default implementation of the java hashCode() method used by HashMap and HashSet.void
set_hash(Hash hash)
Set the _hash of the pojo used for indexing itMethods inherited from class tenapull.data.entity.template.ExtensibleJsonPojo
getExtraJson, getExtraJson, getExtraJsonMap, putExtraJson, setExtraJson, toJsonNode, toJsonString, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface tenapull.data.entity.template.DbPojo
_prepare, getId, setId, toJsonNode, toJsonString
Methods inherited from interface tenapull.data.entity.template.HashLookupPojo
_match, _set, compareTo
-
Constructor Details
-
HashLookupTemplate
public HashLookupTemplate()
-
-
Method Details
-
get_hash
Description copied from interface:HashLookupPojo
Get the _hash of the "object lookup" pojo used for indexing it.- Specified by:
get_hash
in interfaceHashLookupPojo<POJO extends HashLookupTemplate<POJO>>
- Returns:
- the Hash of the object lookup
-
set_hash
Description copied from interface:HashLookupPojo
Set the _hash of the pojo used for indexing it- Specified by:
set_hash
in interfaceHashLookupPojo<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
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 classGeneratedIdPojo
- 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 interfaceHashLookupPojo<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 classExtensibleJsonPojo
-
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 classGeneratedIdPojo
- Returns:
- a java hash code to uniquely identify and match this pojo with other pojos representing the same DB record
-