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;
}
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;
}
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;
}
Aggregations