mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-13 08:26:15 +00:00
Implented an alternate mechanism for determining document/object id. If the node has a HighlightedTextMarkup object, we will use its object id, otherwise we use the Content id.
This commit is contained in:
parent
60ab0a1188
commit
8b55bcde1d
@ -252,29 +252,16 @@ public class ExtractedContentViewer implements DataContentViewer {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the correct document id for the given node. If the node contains a
|
* Get the correct document id for the given node. If the node contains a
|
||||||
* keyword hit blackboard artifact that contains a TSK_ASSOCIATED_ARTIFACT
|
* HighlightedTextMarkup object, its object id will have been set.
|
||||||
* attribute, the document id is the artifact id of the associated artifact.
|
|
||||||
* Otherwise the document id is obtained from the Content object.
|
* Otherwise the document id is obtained from the Content object.
|
||||||
* @param node
|
* @param node
|
||||||
* @return Either the artifact id, file id or 0.
|
* @return Either the artifact id, file id or 0.
|
||||||
*/
|
*/
|
||||||
private Long getDocumentId(Node node) {
|
private Long getDocumentId(Node node) {
|
||||||
BlackboardArtifact art = node.getLookup().lookup(BlackboardArtifact.class);
|
HighlightedTextMarkup markup = node.getLookup().lookup(HighlightedTextMarkup.class);
|
||||||
|
|
||||||
try {
|
if (markup != null) {
|
||||||
// If this is a keyword hit artifact with an associated artifact it
|
return markup.getObjectId();
|
||||||
// implies that the keyword hit is for an artifact instead of a file.
|
|
||||||
// In that case we mask the original artifact id with 0x8000000000000000L
|
|
||||||
// to come up with the document id to use in the Solr query.
|
|
||||||
if (art != null && art.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()) {
|
|
||||||
for (BlackboardAttribute attribute : art.getAttributes()) {
|
|
||||||
if (attribute.getAttributeTypeID() == ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT.getTypeID())
|
|
||||||
return attribute.getValueLong() + 0x8000000000000000L;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (TskCoreException ex) {
|
|
||||||
logger.log(Level.WARNING, "Failed to retrieve attributes for artifact.", ex); //NON-NLS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Content content = node.getLookup().lookup(Content.class);
|
Content content = node.getLookup().lookup(Content.class);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user