use of com.intel.mountwilson.as.hostmanifestreport.data.ManifestType in project OpenAttestation by OpenAttestation.
the class ReportsBO method getReportManifest.
public HostManifestReportType getReportManifest(Hostname hostName) {
// datatype.Hostname
HostManifestReportType hostManifestReportType = new HostManifestReportType();
/*
* if (hostName == null || hostName.isEmpty()) { throw new
* ASException(ErrorCode.VALIDATION_ERROR, "Input Hostname " + hostName
* + " is empty."); }
*
*/
TblHosts tblHosts = null;
try {
// datatype.Hostname
tblHosts = getTblHostsJpaController().findByName(hostName.toString());
} catch (CryptographyException e) {
throw new ASException(e, ErrorCode.AS_ENCRYPTION_ERROR, e.getCause() == null ? e.getMessage() : e.getCause().getMessage());
}
if (tblHosts == null) {
throw new ASException(ErrorCode.AS_HOST_NOT_FOUND, hostName.toString());
}
Date lastStatusTs = getTblTaLogJpaController().findLastStatusTs(tblHosts.getId());
if (lastStatusTs != null) {
List<TblTaLog> logs = getTblTaLogJpaController().findLogsByHostId(tblHosts.getId(), lastStatusTs);
com.intel.mountwilson.as.hostmanifestreport.data.HostType hostType = new com.intel.mountwilson.as.hostmanifestreport.data.HostType();
// datatype.Hostname
hostType.setName(hostName.toString());
if (logs != null) {
for (TblTaLog log : logs) {
ManifestType manifest = new ManifestType();
manifest.setName(Integer.parseInt(log.getManifestName()));
manifest.setValue(log.getManifestValue());
manifest.setVerifiedOn(Util.getCalendar(log.getUpdatedOn()));
manifest.setTrustStatus(getTrustStatus(log.getTrustStatus()));
hostType.getManifest().add(manifest);
}
}
hostManifestReportType.setHost(hostType);
}
return hostManifestReportType;
}
Aggregations