use of com.intel.mtwilson.as.controller.TblOemJpaController in project OpenAttestation by OpenAttestation.
the class MleBO method addMLe.
/**
* For VMM, the OS Name and OS Version in the new MLE must ALREADY be in the
* database, or this method will throw an error.
*
* @param mleData
* @return
*/
public String addMLe(MleData mleData, String mleUuid) {
String osOemUuid = null;
try {
TblMle tblMle = getMleDetails(mleData.getName(), mleData.getVersion(), mleData.getOsName(), mleData.getOsVersion(), mleData.getOemName());
if (tblMle != null) {
throw new ASException(ErrorCode.WS_MLE_ALREADY_EXISTS, mleData.getName());
}
if (mleData.getName().toUpperCase().contains("ESX")) {
String version = getUpperCase(mleData.getVersion()).substring(0, 2);
if (!version.equals("51") && !version.equals("50")) {
throw new ASException(ErrorCode.WS_ESX_MLE_NOT_SUPPORTED);
}
}
if (mleData.getMleType().equals("VMM")) {
TblOs osObj = new TblOsJpaController(getEntityManagerFactory()).findTblOsByNameVersion(mleData.getOsName(), mleData.getOsVersion());
//TblOs osObj = My.jpa().mwOs().findTblOsByNameVersion(mleData.getOsName(), mleData.getOsVersion());
osOemUuid = osObj.getUuid_hex();
} else if (mleData.getMleType().equals("BIOS")) {
TblOem oemObj = new TblOemJpaController(getEntityManagerFactory()).findTblOemByName(mleData.getOemName());
//TblOem oemObj = My.jpa().mwOem().findTblOemByName(mleData.getOemName());
osOemUuid = oemObj.getUuid_hex();
}
/*
if (mleData.getMleType().equalsIgnoreCase("BIOS")){
if (mleData.getManifestList() != null){
for (ManifestData manifestData : mleData.getManifestList()) {
if (Integer.valueOf(manifestData.getName()).intValue() > 5 || Integer.valueOf(manifestData.getName()).intValue() < 0) {
throw new ASException(ErrorCode.WS_MLE_PCR_NOT_VALID, manifestData.getName());
}
}
}
}
if (mleData.getMleType().equalsIgnoreCase("VMM")){
if (mleData.getManifestList() != null){
for (ManifestData manifestData : mleData.getManifestList()) {
if (Integer.valueOf(manifestData.getName()).intValue() > 20 || Integer.valueOf(manifestData.getName()).intValue() < 17) {
throw new ASException(ErrorCode.WS_MLE_PCR_NOT_VALID, manifestData.getName());
}
}
}
}*/
tblMle = getTblMle(mleData, mleUuid, osOemUuid);
mleJpaController.create(tblMle);
addPcrManifest(tblMle, mleData.getManifestList());
} catch (ASException ase) {
throw ase;
} catch (Exception e) {
throw new ASException(e);
}
return "true";
}
Aggregations