Package ghidra.features.bsim.gui.filters
Class BSimFilterType
java.lang.Object
ghidra.features.bsim.gui.filters.BSimFilterType
- All Implemented Interfaces:
Comparable<BSimFilterType>
- Direct Known Subclasses:
ArchitectureBSimFilterType
,BlankBSimFilterType
,CompilerBSimFilterType
,DateBSimFilterType
,ExecutableCategoryBSimFilterType
,ExecutableNameBSimFilterType
,FunctionTagBSimFilterType
,HasNamedChildBSimFilterType
,Md5BSimFilterType
,NotArchitectureBSimFilterType
,NotCompilerBSimFilterType
,NotExecutableCategoryBSimFilterType
,NotExecutableNameBSimFilterType
,NotMd5BSimFilterType
,PathStartsBSimFilterType
The base class for BSim filter types. Each filter type represents a different filter criteria
that can be applied to a BSim Search query. They have a human readable description and a way
to convert string values for the filter into SQL queries.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildElasticCombinedClause
(List<String> subClauses) Given (multiple) clauses for a single filter type, combine into a single elasticsearch script conditionalbuildSQLCombinedClause
(List<String> subClauses) Given (multiple) clauses for a single filter type, combine into a single SQL where clauseint
compareTo
(BSimFilterType op2) boolean
abstract boolean
evaluate
(ExecutableRecord rec, String value) Evaluate this filter for a specific ExecutableRecord and a specific filter -value-abstract void
gatherElasticEffect
(ElasticEffects effect, FilterAtom atom, IDElasticResolution resolution) Gather pieces necessary to emit this filter as part of an elasticsearch query documentabstract void
gatherSQLEffect
(SQLEffects effect, FilterAtom atom, IDSQLResolution resolution) Gather all pieces to successfully convert this filter element into an SQL clausestatic List
<BSimFilterType> generateBsimFilters
(DatabaseInformation info, boolean includeChildFilter) Generate a possibly restricted/extended set of FilterTemplatesConstruct a record describing the document id's that might be needed before this filter element can be converted to an Elasticsearch filter script clauseabstract IDSQLResolution
Construct a record describing the column id's that might need to be recovered before this filter element can be converted to an SQL clausestatic List
<BSimFilterType> static BSimFilterType
getBlank()
getHint()
getLabel()
int
hashCode()
boolean
isBlank()
boolean
boolean
isLocal()
boolean
boolean
isValidValue
(String value) Tests if the given string is a valid value for this filter type.static BSimFilterType
nameToType
(XmlElement el) Convenience function for deserializing FilterTemplatesnormalizeValue
(String value) Returns a normalized version of the given value for this filter.boolean
void
Save XML attributes corresponding to this templatetoString()
-
Field Details
-
BLANK
-
label
-
xmlval
-
hint
-
-
Constructor Details
-
BSimFilterType
- Parameters:
label
- is the name used for displayxmlval
- is the name used for XML serializationhint
- is the pop-up menu hint
-
-
Method Details
-
toString
-
hashCode
public int hashCode() -
equals
-
compareTo
- Specified by:
compareTo
in interfaceComparable<BSimFilterType>
-
getXmlValue
- Returns:
- the tag name for serialization
-
getHint
- Returns:
- the hint text
-
isChildFilter
public boolean isChildFilter()- Returns:
- true if this is a filter element based on callgraph information of functions
-
isBlank
public boolean isBlank()- Returns:
- true if this is a "blank" filter (i.e. an unused element within a gui)
-
isLocal
public boolean isLocal()- Returns:
- true if any id's relevant to this filter must be resolved relative to the local ColumnDatabase
-
isMultipleEntryAllowed
public boolean isMultipleEntryAllowed()- Returns:
- true if multiple filters of this type are allowed.
-
orMultipleEntries
public boolean orMultipleEntries()- Returns:
- true if multiple filters of this type should be OR'd. AND them otherwise.
-
saveXml
Save XML attributes corresponding to this template- Parameters:
fwrite
- is the output stream- Throws:
IOException
- for problems writing to the stream
-
generateIDSQLResolution
Construct a record describing the column id's that might need to be recovered before this filter element can be converted to an SQL clause- Parameters:
atom
- is the specific FilterAtom to generate the record for- Returns:
- the IDSQLResolution record or null if no ids need to be recovered
-
generateIDElasticResolution
Construct a record describing the document id's that might be needed before this filter element can be converted to an Elasticsearch filter script clause- Parameters:
atom
- is the specific FilterAtom to generate the record for- Returns:
- the record or null if no ids need to be recovered
-
gatherSQLEffect
public abstract void gatherSQLEffect(SQLEffects effect, FilterAtom atom, IDSQLResolution resolution) throws SQLException Gather all pieces to successfully convert this filter element into an SQL clause- Parameters:
effect
- is SQLEffects container for this filter elements pieces and othersatom
- holds the values for a particular instantiation of this filter elementresolution
- is the IDResolution containing relevant row ids for the filter, which must have been precalculated- Throws:
SQLException
- for errors building the SQL clause
-
gatherElasticEffect
public abstract void gatherElasticEffect(ElasticEffects effect, FilterAtom atom, IDElasticResolution resolution) throws ElasticException Gather pieces necessary to emit this filter as part of an elasticsearch query document- Parameters:
effect
- is the ElasticEffects container holding the piecesatom
- holds the values for a particular instantiation of this filter elementresolution
- contains relevant ids for the filter, which must have been precalculated- Throws:
ElasticException
- for errors building the JSON subdocument
-
buildSQLCombinedClause
Given (multiple) clauses for a single filter type, combine into a single SQL where clause- Parameters:
subClauses
- is the list of SQL clauses- Returns:
- the combined clause
-
buildElasticCombinedClause
Given (multiple) clauses for a single filter type, combine into a single elasticsearch script conditional- Parameters:
subClauses
- is the list of script clauses- Returns:
- the combined clause
-
getEditor
-
evaluate
Evaluate this filter for a specific ExecutableRecord and a specific filter -value-- Parameters:
rec
- is the ExecutableRecord to filter againstvalue
- is the String value for an instantiated filter- Returns:
- true if this element would allow the ExecutableRecord to pass the filter
-
isValidValue
Tests if the given string is a valid value for this filter type.- Parameters:
value
- the value to test- Returns:
- true if the given string is valid for this filter
-
normalizeValue
Returns a normalized version of the given value for this filter.- Parameters:
value
- the value to be normalized- Returns:
- a normalized version of the given value for this filter
-
getBlank
- Returns:
- the Blank FilterTemplate
-
getBaseFilters
-
nameToType
Convenience function for deserializing FilterTemplates- Parameters:
el
- is the tag to deserialize- Returns:
- the deserialized FilterTemplate
-
generateBsimFilters
public static List<BSimFilterType> generateBsimFilters(DatabaseInformation info, boolean includeChildFilter) Generate a possibly restricted/extended set of FilterTemplates- Parameters:
info
- is database information which informs about which filters to createincludeChildFilter
- toggles whether or not ChildFilters should be included in this particular set- Returns:
- the list of filter templates
-
getLabel
-