use of org.ovirt.engine.core.common.businessentities.VmInitNetwork in project ovirt-engine by oVirt.
the class InitializationMapper method map.
@Mapping(from = Initialization.class, to = VmInit.class)
public static VmInit map(Initialization model, VmInit template) {
VmInit entity = template != null ? template : new VmInit();
boolean someSubTagSet = false;
if (model.isSetHostName()) {
someSubTagSet = true;
entity.setHostname(model.getHostName());
}
if (model.isSetDomain()) {
someSubTagSet = true;
entity.setDomain(model.getDomain());
}
if (model.isSetTimezone()) {
someSubTagSet = true;
entity.setTimeZone(model.getTimezone());
}
if (model.isSetAuthorizedSshKeys()) {
someSubTagSet = true;
entity.setAuthorizedKeys(model.getAuthorizedSshKeys());
}
if (model.isSetRegenerateSshKeys()) {
someSubTagSet = true;
entity.setRegenerateKeys(model.isRegenerateSshKeys());
}
if (model.isSetDnsServers()) {
someSubTagSet = true;
entity.setDnsServers(model.getDnsServers());
}
if (model.isSetDnsSearch()) {
someSubTagSet = true;
entity.setDnsSearch(model.getDnsSearch());
}
if (model.isSetWindowsLicenseKey()) {
someSubTagSet = true;
entity.setWinKey(model.getWindowsLicenseKey());
}
if (model.isSetRootPassword()) {
someSubTagSet = true;
entity.setRootPassword(model.getRootPassword());
}
if (model.isSetCustomScript()) {
someSubTagSet = true;
entity.setCustomScript(model.getCustomScript());
}
if (model.isSetNicConfigurations()) {
someSubTagSet = true;
List<VmInitNetwork> networks = new ArrayList<>();
for (NicConfiguration nic : model.getNicConfigurations().getNicConfigurations()) {
networks.add(map(nic, null));
}
entity.setNetworks(networks);
}
if (model.isSetInputLocale()) {
someSubTagSet = true;
entity.setInputLocale(model.getInputLocale());
}
if (model.isSetUiLanguage()) {
someSubTagSet = true;
entity.setUiLanguage(model.getUiLanguage());
}
if (model.isSetSystemLocale()) {
someSubTagSet = true;
entity.setSystemLocale(model.getSystemLocale());
}
if (model.isSetUserLocale()) {
someSubTagSet = true;
entity.setUserLocale(model.getUserLocale());
}
if (model.isSetUserName()) {
someSubTagSet = true;
entity.setUserName(model.getUserName());
}
if (model.isSetActiveDirectoryOu()) {
someSubTagSet = true;
entity.setActiveDirectoryOU(model.getActiveDirectoryOu());
}
if (model.isSetOrgName()) {
someSubTagSet = true;
entity.setOrgName(model.getOrgName());
}
if (model.isSetCloudInit()) {
someSubTagSet = true;
VmMapper.map(model.getCloudInit(), entity);
}
if (!someSubTagSet) {
return null;
}
return entity;
}
use of org.ovirt.engine.core.common.businessentities.VmInitNetwork in project ovirt-engine by oVirt.
the class VmInitModel method addNetwork.
private void addNetwork() {
if (!networkMap.containsKey(newNetworkText)) {
networkMap.put(newNetworkText, new VmInitNetwork());
getNetworkList().setItems(new ArrayList<>(networkMap.keySet()));
}
getNetworkList().setSelectedItem(newNetworkText);
}
use of org.ovirt.engine.core.common.businessentities.VmInitNetwork in project ovirt-engine by oVirt.
the class VmInitModel method updateNetworkDisplay.
/* Update displayed network properties to reflect currently-selected item */
private void updateNetworkDisplay() {
String networkName = null;
VmInitNetwork vmInitNetwork = null;
if (getNetworkList().getSelectedItem() != null) {
networkName = getNetworkList().getSelectedItem();
vmInitNetwork = networkMap.get(networkName);
}
final Ipv4BootProtocol ipv4bootProtocol = vmInitNetwork == null || vmInitNetwork.getBootProtocol() == null ? Ipv4BootProtocol.NONE : vmInitNetwork.getBootProtocol();
getIpv4BootProtocolList().setSelectedItem(ipv4bootProtocol);
final Ipv6BootProtocol ipv6bootProtocol = vmInitNetwork == null || vmInitNetwork.getIpv6BootProtocol() == null ? Ipv6BootProtocol.NONE : vmInitNetwork.getIpv6BootProtocol();
getIpv6BootProtocolList().setSelectedItem(ipv6bootProtocol);
getNetworkIpAddress().setEntity(vmInitNetwork == null ? null : vmInitNetwork.getIp());
getNetworkNetmask().setEntity(vmInitNetwork == null ? null : vmInitNetwork.getNetmask());
getNetworkGateway().setEntity(vmInitNetwork == null ? null : vmInitNetwork.getGateway());
getNetworkIpv6Address().setEntity(vmInitNetwork == null ? null : vmInitNetwork.getIpv6Address());
getNetworkIpv6Prefix().setEntity(vmInitNetwork == null ? null : vmInitNetwork.getIpv6Prefix());
getNetworkIpv6Gateway().setEntity(vmInitNetwork == null ? null : vmInitNetwork.getIpv6Gateway());
hardCodeStartOnBoot();
}
Aggregations