Search in sources :

Example 1 with MleData

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

the class ConverterUtil method getMleVOListWhereOEMIsNull.

public static List<MleDetailsEntityVO> getMleVOListWhereOEMIsNull(List<MleData> searchMLE) {
    List<MleDetailsEntityVO> detailsEntityVOs = new ArrayList<MleDetailsEntityVO>();
    for (MleData data : searchMLE) {
        if (data.getOemName() == null || data.getOemName().length() == 0) {
            MleDetailsEntityVO entityVO = new MleDetailsEntityVO();
            entityVO.setMleId(null);
            entityVO.setMleName(data.getName());
            entityVO.setMleVersion(data.getVersion());
            entityVO.setAttestationType(data.getAttestationType());
            entityVO.setMleType(data.getMleType());
            //entityVO.setManifestList(data.getManifestList().toString());
            entityVO.setOsName(data.getOsName());
            entityVO.setOsVersion(data.getOsVersion());
            entityVO.setOemName(data.getOemName());
            detailsEntityVOs.add(entityVO);
        }
    }
    return detailsEntityVOs;
}
Also used : ArrayList(java.util.ArrayList) MleData(com.intel.mtwilson.datatypes.MleData) MleDetailsEntityVO(com.intel.mountwilson.datamodel.MleDetailsEntityVO)

Example 2 with MleData

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

the class ConverterUtil method getMleVOListWhereOEMNotNull.

public static List<MleDetailsEntityVO> getMleVOListWhereOEMNotNull(List<MleData> mleDataList) {
    List<MleDetailsEntityVO> detailsEntityVOs = new ArrayList<MleDetailsEntityVO>();
    for (MleData data : mleDataList) {
        if (data.getOemName() != null && !(data.getOemName().length() == 0)) {
            MleDetailsEntityVO entityVO = new MleDetailsEntityVO();
            entityVO.setMleId(null);
            entityVO.setMleName(data.getName());
            entityVO.setMleVersion(data.getVersion());
            entityVO.setAttestationType(data.getAttestationType());
            entityVO.setMleType(data.getMleType());
            //entityVO.setManifestList(data.getManifestList().toString());
            entityVO.setOsName(data.getOsName());
            entityVO.setOsVersion(data.getOsVersion());
            entityVO.setOemName(data.getOemName());
            detailsEntityVOs.add(entityVO);
        }
    }
    return detailsEntityVOs;
}
Also used : ArrayList(java.util.ArrayList) MleData(com.intel.mtwilson.datatypes.MleData) MleDetailsEntityVO(com.intel.mountwilson.datamodel.MleDetailsEntityVO)

Example 3 with MleData

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

the class ConverterUtil method getMleApiClientObject.

public static MleData getMleApiClientObject(MLEDataVO dataVO) {
    MleData data = new MleData();
    data.setName(dataVO.getMleName());
    data.setVersion(dataVO.getMleVersion());
    data.setMleType(dataVO.getMleType());
    data.setOemName(dataVO.getOemName());
    data.setOsName(dataVO.getOsName());
    data.setOsVersion(dataVO.getOsVersion());
    data.setAttestationType(dataVO.getAttestation_Type());
    data.setDescription(dataVO.getMleDescription());
    data.setManifestList(getApiClientManifestData(dataVO.getManifestList()));
    return data;
}
Also used : MleData(com.intel.mtwilson.datatypes.MleData)

Example 4 with MleData

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

the class MleBO method updateMleSource.

/**
    * Updates an existing MLE with the name of the white list host that was used to modify the white list values.
    * @param mleSourceObj
    * @return 
    */
public String updateMleSource(MleSource mleSourceObj) {
    TblMle tblMle;
    MleData mleData = null;
    try {
        try {
            mleData = mleSourceObj.getMleData();
            // Verify if the MLE exists in the system.
            tblMle = getMleDetails(mleData.getName(), mleData.getVersion(), mleData.getOsName(), mleData.getOsVersion(), mleData.getOemName());
        } catch (NoResultException nre) {
            throw new ASException(nre, ErrorCode.WS_MLE_DOES_NOT_EXIST, mleData.getName(), mleData.getVersion());
        }
        MwMleSourceJpaController mleSourceJpaController = new MwMleSourceJpaController(getEntityManagerFactory());
        // If the mapping does not exist already in the db, then we need to return back error.
        MwMleSource mwMleSource = mleSourceJpaController.findByMleId(tblMle.getId());
        if (mwMleSource == null) {
            throw new ASException(ErrorCode.WS_MLE_SOURCE_MAPPING_DOES_NOT_EXIST, mleData.getName());
        }
        mwMleSource.setHostName(mleSourceObj.getHostName());
        mleSourceJpaController.edit(mwMleSource);
    } catch (ASException ase) {
        throw ase;
    } catch (Exception e) {
        throw new ASException(e);
    }
    return "true";
}
Also used : MwMleSourceJpaController(com.intel.mtwilson.as.controller.MwMleSourceJpaController) TblMle(com.intel.mtwilson.as.data.TblMle) MleData(com.intel.mtwilson.datatypes.MleData) NoResultException(javax.persistence.NoResultException) MwMleSource(com.intel.mtwilson.as.data.MwMleSource) ASException(com.intel.mountwilson.as.common.ASException) ASException(com.intel.mountwilson.as.common.ASException) NoResultException(javax.persistence.NoResultException) ASDataException(com.intel.mtwilson.as.controller.exceptions.ASDataException) NonexistentEntityException(com.intel.mtwilson.as.controller.exceptions.NonexistentEntityException) IllegalOrphanException(com.intel.mtwilson.as.controller.exceptions.IllegalOrphanException)

Example 5 with MleData

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

the class MleBO method findMle.

/**
    * 
    * @param mleName
    * @param mleVersion
    * @param osName
    * @param osVersion
    * @param oemName
    * @return 
    */
public MleData findMle(String mleName, String mleVersion, String osName, String osVersion, String oemName) {
    try {
        TblMle tblMle = getMleDetails(mleName, mleVersion, osName, osVersion, oemName);
        if (tblMle == null) {
            throw new ASException(ErrorCode.WS_MLE_DOES_NOT_EXIST, mleName, mleVersion);
        }
        MleData mleData = createMleDataFromDatabaseRecord(tblMle, true);
        return mleData;
    } catch (ASException ase) {
        throw ase;
    } catch (Exception e) {
        throw new ASException(e);
    }
}
Also used : TblMle(com.intel.mtwilson.as.data.TblMle) MleData(com.intel.mtwilson.datatypes.MleData) ASException(com.intel.mountwilson.as.common.ASException) ASException(com.intel.mountwilson.as.common.ASException) NoResultException(javax.persistence.NoResultException) ASDataException(com.intel.mtwilson.as.controller.exceptions.ASDataException) NonexistentEntityException(com.intel.mtwilson.as.controller.exceptions.NonexistentEntityException) IllegalOrphanException(com.intel.mtwilson.as.controller.exceptions.IllegalOrphanException)

Aggregations

MleData (com.intel.mtwilson.datatypes.MleData)11 TblMle (com.intel.mtwilson.as.data.TblMle)6 ASException (com.intel.mountwilson.as.common.ASException)4 ASDataException (com.intel.mtwilson.as.controller.exceptions.ASDataException)4 IllegalOrphanException (com.intel.mtwilson.as.controller.exceptions.IllegalOrphanException)4 NonexistentEntityException (com.intel.mtwilson.as.controller.exceptions.NonexistentEntityException)4 ArrayList (java.util.ArrayList)4 NoResultException (javax.persistence.NoResultException)4 ManifestData (com.intel.mtwilson.datatypes.ManifestData)3 MleDetailsEntityVO (com.intel.mountwilson.datamodel.MleDetailsEntityVO)2 MwMleSourceJpaController (com.intel.mtwilson.as.controller.MwMleSourceJpaController)2 MwMleSource (com.intel.mtwilson.as.data.MwMleSource)2 Test (org.junit.Test)2 Matchers.anyString (org.mockito.Matchers.anyString)2 WLMPortalException (com.intel.mountwilson.common.WLMPortalException)1 TblOem (com.intel.mtwilson.as.data.TblOem)1 TblOs (com.intel.mtwilson.as.data.TblOs)1 TblPcrManifest (com.intel.mtwilson.as.data.TblPcrManifest)1