use of com.intel.mountwilson.datamodel.HostDetailsEntityVO in project OpenAttestation by OpenAttestation.
the class ConverterUtil method getHostVOObjectFromTxtHostRecord.
public static HostDetailsEntityVO getHostVOObjectFromTxtHostRecord(TxtHostRecord txtHostDetail) {
HostDetailsEntityVO entityVO = new HostDetailsEntityVO();
entityVO.setHostId(getConvertedHostName(txtHostDetail.HostName));
entityVO.setHostName(txtHostDetail.HostName);
entityVO.setHostIPAddress(txtHostDetail.IPAddress);
entityVO.setHostPort(txtHostDetail.Port.toString());
entityVO.setHostDescription(txtHostDetail.Description);
entityVO.setBiosName(txtHostDetail.BIOS_Name);
entityVO.setBiosBuildNo(txtHostDetail.BIOS_Version);
entityVO.setVmmName(txtHostDetail.VMM_OSName + " " + txtHostDetail.VMM_OSVersion + HelperConstant.OS_VMM_INFORMATION_SEPERATOR + txtHostDetail.VMM_Name);
entityVO.setVmmBuildNo(txtHostDetail.VMM_Version);
entityVO.setvCenterDetails(txtHostDetail.AddOn_Connection_String);
entityVO.setOemName(txtHostDetail.BIOS_Oem);
entityVO.setLocation(txtHostDetail.Location);
entityVO.setEmailAddress(txtHostDetail.Email);
return entityVO;
}
use of com.intel.mountwilson.datamodel.HostDetailsEntityVO in project OpenAttestation by OpenAttestation.
the class DemoPortalDataController method getHostForViewForPage.
/**
* Method to get Host list to for View Host Page for given page no.
*
* @param req (HttpServletRequest Object)
* @param res (HttpServletResponse Object)
* @return
*/
public ModelAndView getHostForViewForPage(HttpServletRequest req, HttpServletResponse res) {
log.info("DemoPortalDataController.getHostForViewForPage >>");
ModelAndView responseView = new ModelAndView(new JSONView());
try {
int selectedPage = Integer.parseInt(req.getParameter("pageNo"));
HttpSession session = req.getSession();
@SuppressWarnings("unchecked") Map<Integer, List<HostDetailsEntityVO>> mapOfData = (Map<Integer, List<HostDetailsEntityVO>>) session.getAttribute("HostVoList");
responseView.addObject("hostVo", mapOfData.get(selectedPage));
} catch (Exception e) {
log.error(e.toString());
e.printStackTrace();
responseView.addObject("hostVo", "");
responseView.addObject("result", false);
responseView.addObject("message", e.getMessage());
return responseView;
}
responseView.addObject("result", true);
responseView.addObject("message", "");
log.info("DemoPortalDataController.getHostForViewForPage<<<");
return responseView;
}
use of com.intel.mountwilson.datamodel.HostDetailsEntityVO in project OpenAttestation by OpenAttestation.
the class DemoPortalServicesImpl method getSingleHostTrust.
/**
* This Method is used to get Trust Status for Single Host.
*
* @param hostName
* @param apiClientServices
* @param trustedCertificates
* @return
* @throws DemoPortalException
*/
@Override
public TrustedHostVO getSingleHostTrust(String hostName, AttestationService apiClientServices, X509Certificate[] trustedCertificates, boolean forceVerify) throws DemoPortalException {
TrustedHostVO hostVO = null;
HostDetailsEntityVO hostDetailsEntityVO = new HostDetailsEntityVO();
hostDetailsEntityVO.setHostName(hostName);
String xmloutput = null;
HostTrustResponse hostTrustResponse = null;
try {
log.info("Getting trust Information for Host " + hostName);
//xmloutput = apiClientServices.getSamlForHost(new Hostname(hostName), false);
// forceVerify=false when loading dashboard, it is true when refreshing host (Refresh button)
xmloutput = apiClientServices.getSamlForHost(new Hostname(hostName), forceVerify);
TrustAssertion trustAssertion = new TrustAssertion(trustedCertificates, xmloutput);
HostTrustAssertion hostTrustAssertion = trustAssertion.getTrustAssertion(hostName);
//Set<Hostname> hostnames = new HashSet<Hostname>();
//hostnames.add(new Hostname(hostName));
//xmloutput = ConverterUtil.formateXMLString(apiClientServices.getSamlForMultipleHosts(hostnames, false));
hostTrustResponse = apiClientServices.getHostTrust(new Hostname(hostDetailsEntityVO.getHostName()));
List<TxtHostRecord> hosts = apiClientServices.queryForHosts(hostDetailsEntityVO.getHostName());
TxtHostRecord txtHostRecord = null;
for (TxtHostRecord record : hosts) {
if (record.HostName.equals(hostDetailsEntityVO.getHostName())) {
txtHostRecord = record;
}
}
hostVO = ConverterUtil.getTrustedHostVoFromHostTrustResponseAndTxtHostRecord(hostTrustResponse, txtHostRecord, hostTrustAssertion);
} catch (Exception e) {
hostVO = ConverterUtil.getTrustedHostVoFromHostTrustResponseAndErrorMessage(hostName, e.getMessage());
}
return hostVO;
}
use of com.intel.mountwilson.datamodel.HostDetailsEntityVO in project OpenAttestation by OpenAttestation.
the class DemoPortalDataController method getAllHostDetailsFromDB.
/**
* This method is used as a utility method to get Map Views for all host based on Page_no value.
*
* @param req
* @return Map<Integer, List<HostDetailsEntityVO>>
* @throws DemoPortalException
*/
private Map<Integer, List<HostDetailsEntityVO>> getAllHostDetailsFromDB(HttpServletRequest req) throws DemoPortalException {
Map<Integer, List<HostDetailsEntityVO>> map = new HashMap<Integer, List<HostDetailsEntityVO>>();
//Get List of all host available.
List<HostDetailsEntityVO> listOfVos = demoPortalServices.getHostListFromDB(getAttestationService(req, AttestationService.class));
int no_row_per_page = Integer.parseInt(TDPConfig.getConfiguration().getString("mtwilson.tdbp.paginationRowCount"));
//Divide List of all host into a subList based on the value of host per page.
List<List<HostDetailsEntityVO>> list = Lists.partition(listOfVos, no_row_per_page);
//Creating a Map view of host list based on the Page No.
int i = 1;
for (List<HostDetailsEntityVO> listForMap : list) {
map.put(i, listForMap);
i++;
}
//setting map into session attribute;
HttpSession session = req.getSession();
session.setAttribute("HostVoList", map);
return map;
}
use of com.intel.mountwilson.datamodel.HostDetailsEntityVO in project OpenAttestation by OpenAttestation.
the class DemoPortalDataController method getHostTrustSatusForPageNo.
/**
* Method is used to get trust status of host for selected page no.
* Method will get called when user choose any page no from pagination.
*
* @param req
* @param res
* @return
*/
public ModelAndView getHostTrustSatusForPageNo(HttpServletRequest req, HttpServletResponse res) {
log.info("DemoPortalDataController.getHostTrustSatusForPageNo >>");
ModelAndView responseView = new ModelAndView(new JSONView());
try {
//getting selected Page No.
int selectedPage = Integer.parseInt(req.getParameter("pageNo"));
boolean forceVerify = Boolean.parseBoolean(req.getParameter("force_verify"));
HttpSession session = req.getSession();
@SuppressWarnings("unchecked") Map<Integer, List<HostDetailsEntityVO>> //getting Map view of all Host stored into session while calling getDashBoardData().
mapOfData = (Map<Integer, List<HostDetailsEntityVO>>) session.getAttribute("HostVoList");
//calling into a Service layer to get trust status of Host for selected Page No.
responseView.addObject("hostVo", demoPortalServices.getTrustStatusForHost(mapOfData.get(selectedPage), getAttestationService(req, AttestationService.class), getTrustedCertificates(req), forceVerify));
responseView.addObject("noOfPages", mapOfData.size());
} catch (Exception e) {
log.error(e.toString());
e.printStackTrace();
responseView.addObject("hostVo", "");
responseView.addObject("result", false);
responseView.addObject("message", e.getMessage());
return responseView;
}
responseView.addObject("result", true);
responseView.addObject("message", "");
log.info("DemoPortalDataController.getHostTrustSatusForPageNo <<");
return responseView;
}
Aggregations