Search in sources :

Example 1 with WhitelistService

use of com.intel.mtwilson.WhitelistService 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 WhitelistService

use of com.intel.mtwilson.WhitelistService 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)

Example 3 with WhitelistService

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

the class WLMDataController method getWhitelistService.

/**
     * This method will return a WhitelistService Object from a Session.
     * This object is stored into Session at time of user login.
     * Check CheckLoginController.java for more Clarification.
     * 
     * @param req
     * @return
     * @throws WLMPortalException
     */
private WhitelistService getWhitelistService(HttpServletRequest req) throws WLMPortalException {
    //getting already created session object by passing false while calling into getSession();
    HttpSession session = req.getSession(false);
    WhitelistService service = null;
    if (session != null) {
        try {
            //getting WhitelistService Object from Session, stored while log-in time.  
            service = (WhitelistService) session.getAttribute("apiClientObject");
        } catch (Exception e) {
            log.error("Error while creating ApiCliennt Object. " + e.getMessage());
            throw new WLMPortalException("Error while creating ApiCliennt Object. " + e.getMessage(), e);
        }
    }
    return service;
}
Also used : WhitelistService(com.intel.mtwilson.WhitelistService) WLMPortalException(com.intel.mountwilson.common.WLMPortalException) HttpSession(javax.servlet.http.HttpSession) FileUploadException(org.apache.commons.fileupload.FileUploadException) WLMPortalException(com.intel.mountwilson.common.WLMPortalException)

Aggregations

WhitelistService (com.intel.mtwilson.WhitelistService)3 DemoPortalException (com.intel.mountwilson.common.DemoPortalException)2 MleDetailsEntityVO (com.intel.mountwilson.datamodel.MleDetailsEntityVO)2 ApiException (com.intel.mtwilson.ApiException)2 IOException (java.io.IOException)2 SignatureException (java.security.SignatureException)2 HashMap (java.util.HashMap)2 WLMPortalException (com.intel.mountwilson.common.WLMPortalException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1 HttpSession (javax.servlet.http.HttpSession)1 FileUploadException (org.apache.commons.fileupload.FileUploadException)1