use of com.intel.mtwilson.as.data.TblModuleManifestLog in project OpenAttestation by OpenAttestation.
the class ReportsBO method addManifestLogs.
private void addManifestLogs(Integer hostId, PcrLogReport manifest, TblTaLog log, Boolean failureOnly, TblPcrManifest tblPcrManifest) throws IOException {
HashMap<String, ModuleLogReport> moduleReports = new HashMap<>();
if (log.getTblModuleManifestLogCollection() != null) {
logger.debug("addManifestLogs - This is module based attestation with {} of modules.", log.getTblModuleManifestLogCollection().size());
for (TblModuleManifestLog moduleManifestLog : log.getTblModuleManifestLogCollection()) {
moduleReports.put(moduleManifestLog.getName(), new ModuleLogReport(moduleManifestLog.getName(), moduleManifestLog.getValue(), moduleManifestLog.getWhitelistValue(), 0));
}
}
if (!failureOnly) {
logger.debug("FailureOnly flag is false. Adding all manifests.");
for (TblModuleManifest moduleManifest : tblPcrManifest.getMleId().getTblModuleManifestCollection()) {
if (moduleManifest.getExtendedToPCR().equalsIgnoreCase(tblPcrManifest.getName()) && !moduleReports.containsKey(moduleManifest.getComponentName())) {
if (moduleManifest.getUseHostSpecificDigestValue() != null && moduleManifest.getUseHostSpecificDigestValue().booleanValue()) {
// For open source we used to have multiple module manifests for the same hosts. So, the below query by hostID was returning multiple results.
//String hostSpecificDigestValue = new TblHostSpecificManifestJpaController(getEntityManagerFactory()).findByHostID(hostId).getDigestValue();
//String hostSpecificDigestValue = My.jpa().mwHostSpecificManifest().findByModuleAndHostID(hostId, moduleManifest.getId()).getDigestValue();
TblHostSpecificManifestJpaController tblHostSpecificManifestJpaController = getTblHostSpecificManifestJpaController();
String hostSpecificDigestValue = tblHostSpecificManifestJpaController.findByModuleAndHostID(hostId, moduleManifest.getId()).getDigestValue();
moduleReports.put(moduleManifest.getComponentName(), new ModuleLogReport(moduleManifest.getComponentName(), hostSpecificDigestValue, hostSpecificDigestValue, 1));
} else {
moduleReports.put(moduleManifest.getComponentName(), new ModuleLogReport(moduleManifest.getComponentName(), moduleManifest.getDigestValue(), moduleManifest.getDigestValue(), 1));
}
}
}
}
manifest.getModuleLogs().addAll(moduleReports.values());
}
Aggregations