Search in sources :

Example 6 with ManifestData

use of com.intel.mtwilson.datatypes.ManifestData in project OpenAttestation by OpenAttestation.

the class MleBO method createMleDataFromDatabaseRecord.

/**
         * 
         * @param tblMle
         * @param addManifest
         * @return 
         */
public MleData createMleDataFromDatabaseRecord(TblMle tblMle, boolean addManifest) {
    List<ManifestData> manifestList = null;
    if (addManifest) {
        manifestList = new ArrayList<ManifestData>();
        for (TblPcrManifest pcrManifest : tblMle.getTblPcrManifestCollection()) {
            manifestList.add(new ManifestData(pcrManifest.getName(), pcrManifest.getValue()));
        }
    }
    String osName = (tblMle.getOsId() == null) ? null : tblMle.getOsId().getName();
    String osVersion = (tblMle.getOsId() == null) ? null : tblMle.getOsId().getVersion();
    String oemName = (tblMle.getOemId() == null) ? null : tblMle.getOemId().getName();
    MleData s = new MleData(tblMle.getName(), tblMle.getVersion(), MleData.MleType.valueOf(tblMle.getMLEType()), MleData.AttestationType.valueOf(tblMle.getAttestationType()), manifestList, tblMle.getDescription(), osName, osVersion, oemName);
    return s;
}
Also used : MleData(com.intel.mtwilson.datatypes.MleData) TblPcrManifest(com.intel.mtwilson.as.data.TblPcrManifest) ManifestData(com.intel.mtwilson.datatypes.ManifestData)

Aggregations

ManifestData (com.intel.mtwilson.datatypes.ManifestData)6 TblMle (com.intel.mtwilson.as.data.TblMle)3 TblPcrManifest (com.intel.mtwilson.as.data.TblPcrManifest)3 MleData (com.intel.mtwilson.datatypes.MleData)3 ArrayList (java.util.ArrayList)3 Test (org.junit.Test)2 Matchers.anyString (org.mockito.Matchers.anyString)2 ASException (com.intel.mountwilson.as.common.ASException)1 ASDataException (com.intel.mtwilson.as.controller.exceptions.ASDataException)1 IllegalOrphanException (com.intel.mtwilson.as.controller.exceptions.IllegalOrphanException)1 NonexistentEntityException (com.intel.mtwilson.as.controller.exceptions.NonexistentEntityException)1 TblOem (com.intel.mtwilson.as.data.TblOem)1 TblOs (com.intel.mtwilson.as.data.TblOs)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 NoResultException (javax.persistence.NoResultException)1 MultivaluedMap (javax.ws.rs.core.MultivaluedMap)1