use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class UnitVmModel method setBootSequence.
public void setBootSequence(BootSequence value) {
ArrayList<BootSequence> items = new ArrayList<>();
for (char a : value.toString().toCharArray()) {
items.add(BootSequence.valueOf(String.valueOf(a)));
}
EntityModel<BootSequence> firstBootDevice = null;
for (EntityModel<BootSequence> item : getFirstBootDevice().getItems()) {
if (item.getEntity() == Linq.firstOrNull(items)) {
firstBootDevice = item;
}
}
getFirstBootDevice().setSelectedItem(firstBootDevice);
Iterable<EntityModel<BootSequence>> secondDeviceOptions = getSecondBootDevice().getItems();
if (items.size() > 1) {
BootSequence last = items.get(items.size() - 1);
for (EntityModel<BootSequence> a : secondDeviceOptions) {
if (a.getEntity() != null && a.getEntity() == last) {
getSecondBootDevice().setSelectedItem(a);
break;
}
}
} else {
for (EntityModel<BootSequence> a : secondDeviceOptions) {
if (a.getEntity() == null) {
getSecondBootDevice().setSelectedItem(a);
break;
}
}
}
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class UnitVmModel method setRngDevice.
public void setRngDevice(VmRngDevice dev) {
maybeSetEntity(rngBytes, dev.getBytes() == null ? null : dev.getBytes());
maybeSetEntity(rngPeriod, dev.getPeriod() == null ? null : dev.getPeriod());
maybeSetEntity(rngSourceUrandom, dev.getSource() == VmRngDevice.Source.RANDOM);
maybeSetEntity(rngSourceHwrng, dev.getSource() == VmRngDevice.Source.HWRNG);
// is invalid
if (!Boolean.TRUE.equals(rngSourceUrandom.getEntity()) && !Boolean.TRUE.equals(rngSourceHwrng.getEntity())) {
getBehavior().deactivateInstanceTypeManager();
EntityModel[] entityModels = { rngSourceUrandom, rngSourceHwrng };
for (EntityModel entityModel : entityModels) {
if (entityModel.getIsAvailable() && entityModel.getIsChangable()) {
// select first available
entityModel.setEntity(Boolean.TRUE);
break;
}
}
getBehavior().activateInstanceTypeManager();
}
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class UnitVmModel method initFirstBootDevice.
private void initFirstBootDevice() {
EntityModel tempVar = new EntityModel();
tempVar.setTitle(ConstantsManager.getInstance().getConstants().hardDiskTitle());
tempVar.setEntity(BootSequence.C);
EntityModel hardDiskOption = tempVar;
List<EntityModel<BootSequence>> firstBootDeviceItems = new ArrayList<>();
firstBootDeviceItems.add(hardDiskOption);
EntityModel tempVar2 = new EntityModel();
tempVar2.setTitle(ConstantsManager.getInstance().getConstants().cdromTitle());
tempVar2.setEntity(BootSequence.D);
firstBootDeviceItems.add(tempVar2);
EntityModel tempVar3 = new EntityModel();
tempVar3.setTitle(ConstantsManager.getInstance().getConstants().networkPXETitle());
tempVar3.setEntity(BootSequence.N);
firstBootDeviceItems.add(tempVar3);
getFirstBootDevice().setItems(firstBootDeviceItems);
getFirstBootDevice().setSelectedItem(hardDiskOption);
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class ErrataDetailModelForm method initialize.
public void initialize() {
driver.initialize(this);
formBuilder.addFormItem(new FormItem(constants.errataId(), id, 0, 0), 2, 10);
formBuilder.addFormItem(new FormItem(constants.errataDateIssued(), issued, 1, 0), 2, 10);
formBuilder.addFormItem(new FormItem(constants.errataType(), type, 2, 0), 2, 10);
formBuilder.addFormItem(new FormItem(constants.errataSeverity(), severity, 3, 0) {
@Override
public boolean getIsAvailable() {
EntityModel<Erratum> model = getModel();
return model != null && model.getEntity() != null && model.getEntity().getSeverity() != null;
}
}, 2, 10);
formBuilder.addFormItem(new FormItem(constants.description(), description, 4, 0), 2, 10);
formBuilder.addFormItem(new FormItem(constants.solution(), solution, 5, 0), 2, 10);
formBuilder.addFormItem(new FormItem(constants.summary(), summary, 6, 0), 2, 10);
formBuilder.addFormItem(new FormItem(constants.errataPackages(), packages, 7, 0), 2, 10);
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class HostListModel method onInstall.
public void onInstall() {
final VDS host = getSelectedItem();
InstallModel model = (InstallModel) getWindow();
if (!model.validate(host.isOvirtVintageNode())) {
model.setValidationFailed(new EntityModel<>(true));
return;
}
final UpdateVdsActionParameters param = new UpdateVdsActionParameters();
param.setvds(host);
param.setVdsId(host.getId());
param.setPassword(model.getUserPassword().getEntity());
param.setReinstallOrUpgrade(true);
param.setInstallHost(true);
param.setoVirtIsoFile(null);
param.setOverrideFirewall(model.getOverrideIpTables().getEntity());
param.setActivateHost(model.getActivateHostAfterInstall().getEntity());
param.setAuthMethod(model.getAuthenticationMethod());
// Explicitly set null, to be clear we don't want to update fence agents.
param.setFenceAgents(null);
param.setHostedEngineDeployConfiguration(new HostedEngineDeployConfiguration(model.getHostedEngineHostModel().getSelectedItem()));
Provider<?> networkProvider = (Provider<?>) model.getNetworkProviders().getSelectedItem();
if (networkProvider == null) {
param.getVdsStaticData().setOpenstackNetworkProviderId(null);
} else {
param.getVdsStaticData().setOpenstackNetworkProviderId(networkProvider.getId());
param.setNetworkMappings((String) model.getInterfaceMappings().getEntity());
}
AsyncDataProvider.getInstance().getClusterById(new AsyncQuery<>(returnValue -> Frontend.getInstance().runAction(ActionType.InstallVds, param, result -> {
ActionReturnValue returnValue1 = result.getReturnValue();
if (returnValue1 != null && returnValue1.getSucceeded()) {
cancel();
}
})), host.getClusterId());
}
Aggregations