19 package org.sleuthkit.autopsy.discovery.search;
21 import com.google.common.cache.CacheLoader;
22 import java.util.ArrayList;
23 import java.util.HashMap;
24 import java.util.List;
29 import org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE;
36 public class DomainSearchArtifactsLoader extends CacheLoader<DomainSearchArtifactsCache.ArtifactCacheKey, Map<String, List<BlackboardArtifact>>> {
38 private static final BlackboardAttribute.Type
TSK_DOMAIN =
new BlackboardAttribute.
Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DOMAIN);
42 final SleuthkitCase caseDb = artifactKey.getSleuthkitCase();
43 final ARTIFACT_TYPE type = artifactKey.getType();
44 List<BlackboardArtifact> artifacts = caseDb.getBlackboardArtifacts(type);
46 Map<String, List<BlackboardArtifact>> artifactsByDomain =
new HashMap<>();
49 for (BlackboardArtifact artifact : artifacts) {
50 if(Thread.currentThread().isInterrupted()) {
51 throw new InterruptedException();
53 final BlackboardAttribute tskDomain = artifact.getAttribute(
TSK_DOMAIN);
54 if (tskDomain != null) {
55 final String normalizedDomain = tskDomain.getValueString().trim().toLowerCase();
56 List<BlackboardArtifact> artifactsWithDomain = artifactsByDomain.getOrDefault(normalizedDomain,
new ArrayList<>());
57 artifactsWithDomain.add(artifact);
58 artifactsByDomain.put(normalizedDomain, artifactsWithDomain);
62 return artifactsByDomain;
static final BlackboardAttribute.Type TSK_DOMAIN
Type(int value, String displayName, Collection< String > mediaTypes, Collection< BlackboardArtifact.ARTIFACT_TYPE > artifactTypes)
Map< String, List< BlackboardArtifact > > load(DomainSearchArtifactsCache.ArtifactCacheKey artifactKey)