Search in sources :

Example 1 with MleDetailsEntityVO

use of com.intel.mountwilson.datamodel.MleDetailsEntityVO in project OpenAttestation by OpenAttestation.

the class DemoPortalServicesImpl method getOSAndVMMInfo.

/**
	 * This method is used to Get All OS details from REST Services.
	 * 
	 * @param client (Object of ApiClient)
	 * @return
	 * @throws DemoPortalException
	 */
@Override
public Map<String, Boolean> getOSAndVMMInfo(ApiClient client) throws DemoPortalException {
    List<MleDetailsEntityVO> mleList = null;
    //This is a MAP of OS/VMM name and boolean variable which denote about current os/vmm info is VMWare type or not. 
    Map<String, Boolean> maps = new HashMap<String, Boolean>();
    WhitelistService service = (WhitelistService) client;
    try {
        //Call to REST Services to get all details of MLE, will extract all MLE from that data where OEM info is null.
        mleList = ConverterUtil.getMleVOListWhereOEMIsNull(service.searchMLE(""));
        for (MleDetailsEntityVO mleDetailsEntityVO : mleList) {
            maps.put(ConverterUtil.getOSAndVMMInfoString(mleDetailsEntityVO), mleDetailsEntityVO.getOsName().toLowerCase().contains(HelperConstant.OS_IMAGE_VMWARE.toLowerCase()) ? true : false);
        }
    } catch (Exception e) {
        throw ConnectionUtil.handleException(e);
    }
    return maps;
}
Also used : WhitelistService(com.intel.mtwilson.WhitelistService) HashMap(java.util.HashMap) MleDetailsEntityVO(com.intel.mountwilson.datamodel.MleDetailsEntityVO) ApiException(com.intel.mtwilson.ApiException) SignatureException(java.security.SignatureException) IOException(java.io.IOException) DemoPortalException(com.intel.mountwilson.common.DemoPortalException)

Example 2 with MleDetailsEntityVO

use of com.intel.mountwilson.datamodel.MleDetailsEntityVO 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 3 with MleDetailsEntityVO

use of com.intel.mountwilson.datamodel.MleDetailsEntityVO 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 4 with MleDetailsEntityVO

use of com.intel.mountwilson.datamodel.MleDetailsEntityVO in project OpenAttestation by OpenAttestation.

the class DemoPortalServicesImpl method getAllOemInfo.

/**
	 * This method is used to get all OEM details from REST Services.
	 * Call to searchMLE method present in ApiClient class by passing empty string as parameter. this Method will return all MLE from services.
	 * 
	 * @param client (Object of ApiClient)
	 * @return
	 * @throws DemoPortalException
	 */
@Override
public Map<String, List<Map<String, String>>> getAllOemInfo(ApiClient client) throws DemoPortalException {
    Map<String, List<Map<String, String>>> map = new HashMap<String, List<Map<String, String>>>();
    List<MleDetailsEntityVO> mleList = null;
    List<Map<String, String>> list = new ArrayList<Map<String, String>>();
    try {
        WhitelistService service = (WhitelistService) client;
        //This statement will get all MLE information from REST services, will get only OEM information from that list.
        mleList = ConverterUtil.getMleVOListWhereOEMNotNull(service.searchMLE(""));
        //convert data into a MAP of Strings which is used in UI (JQuery) to display on screen.
        if (mleList != null && mleList.size() > 0) {
            for (MleDetailsEntityVO mleDetailsEntityVO : mleList) {
                if (map.get(mleDetailsEntityVO.getOemName()) == null) {
                    list = new ArrayList<Map<String, String>>();
                    map.put(mleDetailsEntityVO.getOemName(), list);
                } else {
                    list = map.get(mleDetailsEntityVO.getOemName());
                }
                Map<String, String> oemInfo = new HashMap<String, String>();
                oemInfo.put(mleDetailsEntityVO.getMleName(), mleDetailsEntityVO.getMleVersion());
                list.add(oemInfo);
            }
        } else {
            throw new DemoPortalException("Currently no MLEs are configured in the system.");
        }
    } catch (Exception e) {
        throw ConnectionUtil.handleException(e);
    }
    return map;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ApiException(com.intel.mtwilson.ApiException) SignatureException(java.security.SignatureException) IOException(java.io.IOException) DemoPortalException(com.intel.mountwilson.common.DemoPortalException) WhitelistService(com.intel.mtwilson.WhitelistService) ArrayList(java.util.ArrayList) List(java.util.List) DemoPortalException(com.intel.mountwilson.common.DemoPortalException) MleDetailsEntityVO(com.intel.mountwilson.datamodel.MleDetailsEntityVO) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

MleDetailsEntityVO (com.intel.mountwilson.datamodel.MleDetailsEntityVO)4 ArrayList (java.util.ArrayList)3 DemoPortalException (com.intel.mountwilson.common.DemoPortalException)2 ApiException (com.intel.mtwilson.ApiException)2 WhitelistService (com.intel.mtwilson.WhitelistService)2 MleData (com.intel.mtwilson.datatypes.MleData)2 IOException (java.io.IOException)2 SignatureException (java.security.SignatureException)2 HashMap (java.util.HashMap)2 List (java.util.List)1 Map (java.util.Map)1