Search in sources :

Example 1 with AttestationService

use of com.intel.mtwilson.AttestationService in project OpenAttestation by OpenAttestation.

the class DemoPortalServicesImpl method getHostTrustReport.

@Override
public List<HostReportTypeVO> getHostTrustReport(List<String> hostNames, ApiClient client) throws DemoPortalException {
    AttestationService service = (AttestationService) client;
    HostsTrustReportType report = null;
    List<HostReportTypeVO> hostReportTypeVO = new ArrayList<HostReportTypeVO>();
    try {
        List<Hostname> hostList = new ArrayList<Hostname>();
        for (String host : hostNames) {
            hostList.add(new Hostname(host));
        }
        report = service.getHostTrustReport(hostList);
    } catch (Exception e) {
        log.error(e.getMessage());
        throw ConnectionUtil.handleException(e);
    }
    List<HostType> list = report.getHost();
    for (HostType hostType : list) {
        HostReportTypeVO vo = new HostReportTypeVO();
        vo.setHostName(hostType.getHostName());
        vo.setMleInfo(hostType.getMLEInfo());
        vo.setCreatedOn("");
        vo.setTrustStatus(hostType.getTrustStatus());
        vo.setVerifiedOn(formatter.format(hostType.getVerifiedOn().toGregorianCalendar().getTime()));
        hostReportTypeVO.add(vo);
    }
    return hostReportTypeVO;
}
Also used : HostType(com.intel.mountwilson.as.hosttrustreport.data.HostType) AttestationService(com.intel.mtwilson.AttestationService) HostsTrustReportType(com.intel.mountwilson.as.hosttrustreport.data.HostsTrustReportType) ArrayList(java.util.ArrayList) Hostname(com.intel.mtwilson.util.net.Hostname) HostReportTypeVO(com.intel.mountwilson.datamodel.HostReportTypeVO) ApiException(com.intel.mtwilson.ApiException) SignatureException(java.security.SignatureException) IOException(java.io.IOException) DemoPortalException(com.intel.mountwilson.common.DemoPortalException)

Aggregations

HostType (com.intel.mountwilson.as.hosttrustreport.data.HostType)1 HostsTrustReportType (com.intel.mountwilson.as.hosttrustreport.data.HostsTrustReportType)1 DemoPortalException (com.intel.mountwilson.common.DemoPortalException)1 HostReportTypeVO (com.intel.mountwilson.datamodel.HostReportTypeVO)1 ApiException (com.intel.mtwilson.ApiException)1 AttestationService (com.intel.mtwilson.AttestationService)1 Hostname (com.intel.mtwilson.util.net.Hostname)1 IOException (java.io.IOException)1 SignatureException (java.security.SignatureException)1 ArrayList (java.util.ArrayList)1