com.metaeffekt.mirror.query.KevIndexQuery Maven / Gradle / Ivy
The newest version!
package com.metaeffekt.mirror.query;
import com.metaeffekt.mirror.contents.kev.KevData;
import com.metaeffekt.mirror.index.IndexSearch;
import com.metaeffekt.mirror.index.other.KevIndex;
import java.io.File;
import java.util.Optional;
public class KevIndexQuery extends IndexQuery{
public KevIndexQuery(File baseMirrorDirectory) {
super(baseMirrorDirectory, KevIndex.class);
}
public KevIndexQuery(KevIndex index) {
super(index);
}
public boolean isPartOfKev(String vulnerability){
return super.index.findDocuments(new IndexSearch().fieldEquals("vulnerability", vulnerability)).stream()
.findFirst().isPresent();
}
public Optional findKevDataForVulnerability(String vulnerability){
return super.index.findDocuments(new IndexSearch().fieldEquals("vulnerability", vulnerability)).stream()
.findFirst().map(KevData::fromDocument);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy