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.Hashget_hash()Get the _hash of the "object lookup" pojo used for indexing it.inthashCode()Default implementation of the java hashCode() method used by HashMap and HashSet.voidset_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, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface tenapull.data.entity.template.DbPojo
_prepare, getId, setId, toJsonNode, toJsonStringMethods inherited from interface tenapull.data.entity.template.HashLookupPojo
_match, _set, compareTo
-
Constructor Details
-
HashLookupTemplate
public HashLookupTemplate()
-
-
Method Details
-
get_hash
Description copied from interface:HashLookupPojoGet the _hash of the "object lookup" pojo used for indexing it.- Specified by:
get_hashin interfaceHashLookupPojo<POJO extends HashLookupTemplate<POJO>>- Returns:
- the Hash of the object lookup
-
set_hash
Description copied from interface:HashLookupPojoSet the _hash of the pojo used for indexing it- Specified by:
set_hashin 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:GeneratedIdPojoConvenience 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:
__setin 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:HashLookupPojoShortcut 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:
_isHashCalculatedin 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:ExtensibleJsonPojoConvienence 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:
__preparein classExtensibleJsonPojo
-
hashCode
public int hashCode()Description copied from class:GeneratedIdPojoDefault 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:
hashCodein classGeneratedIdPojo- Returns:
- a java hash code to uniquely identify and match this pojo with other pojos representing the same DB record
-