//Building objects and validating that manifests are created ahead of create of host
TblHosts tblHosts = newRecordWithTlsPolicyAndKeystore; // new TblHosts();
log.info("saveHostInDatabase with tls policy {} and keystore size {}", tblHosts.getTlsPolicyName(), tblHosts.getTlsKeystore() == null ? "null" : tblHosts.getTlsKeystore().length);
log.error("saveHostInDatabase with tls policy {} and keystore size {}", tblHosts.getTlsPolicyName(), tblHosts.getTlsKeystore() == null ? "null" : tblHosts.getTlsKeystore().length);
TblHostsJpaController hostController = new TblHostsJpaController(
getEntityManagerFactory());
tblHosts.setAddOnConnectionInfo(host.getAddOn_Connection_String());
tblHosts.setBiosMleId(biosMleId);
tblHosts.setDescription(host.getDescription());
tblHosts.setEmail(host.getEmail());
if (host.getIPAddress() != null) {
tblHosts.setIPAddress(host.getIPAddress().toString()); // datatype.IPAddress
}
tblHosts.setName(host.getHostName().toString()); // datatype.Hostname
if (host.getPort() != null) {
tblHosts.setPort(host.getPort());
}
tblHosts.setVmmMleId(vmmMleId);
tblHosts.setAIKCertificate(certificate); // null is ok
if (location != null) {
tblHosts.setLocation(location);
}
// create the host
log.debug("COMMITING NEW HOST DO DATABASE");
hostController.create(tblHosts);
}