com.metaeffekt.mirror.query.EpssIndexQuery Maven / Gradle / Ivy
The newest version!
package com.metaeffekt.mirror.query;
import com.metaeffekt.mirror.contents.epss.EpssData;
import com.metaeffekt.mirror.contents.vulnerability.Vulnerability;
import com.metaeffekt.mirror.index.IndexSearch;
import com.metaeffekt.mirror.index.other.EpssIndex;
import java.io.File;
import java.util.Optional;
public class EpssIndexQuery extends IndexQuery {
public EpssIndexQuery(EpssIndex index) {
super(index);
}
public EpssIndexQuery(File baseMirrorDirectory) {
super(baseMirrorDirectory, EpssIndex.class);
}
public Optional getEpssData(Vulnerability vulnerability) {
return findEpssData(vulnerability);
}
public Optional findEpssData(Vulnerability vulnerability) {
return super.index.findDocuments(new IndexSearch().fieldEquals("vulnerability", vulnerability.getId())).stream()
.findFirst().map(EpssData::fromDocument);
}
public Optional findEpssData(String vulnerabilityId) {
return super.index.findDocuments(new IndexSearch().fieldEquals("vulnerability", vulnerabilityId)).stream()
.findFirst().map(EpssData::fromDocument);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy