Search in sources :

Example 1 with UnitToAddVmTemplateParametersBuilder

use of org.ovirt.engine.ui.uicommonweb.builders.template.UnitToAddVmTemplateParametersBuilder in project ovirt-engine by oVirt.

the class VmSnapshotListModel method postNameUniqueCheck.

private void postNameUniqueCheck(VM vm) {
    UnitVmModel model = (UnitVmModel) getWindow();
    VM newVm = buildVmOnNewTemplate(model, vm);
    AddVmTemplateFromSnapshotParameters parameters = new AddVmTemplateFromSnapshotParameters(newVm.getStaticData(), model.getName().getEntity(), model.getDescription().getEntity(), getSelectedItem().getId());
    BuilderExecutor.build(model, parameters, new UnitToAddVmTemplateParametersBuilder());
    model.startProgress();
    Frontend.getInstance().runAction(ActionType.AddVmTemplateFromSnapshot, parameters, result -> {
        VmSnapshotListModel vmSnapshotListModel = (VmSnapshotListModel) result.getState();
        vmSnapshotListModel.getWindow().stopProgress();
        ActionReturnValue returnValueBase = result.getReturnValue();
        if (returnValueBase != null && returnValueBase.getSucceeded()) {
            vmSnapshotListModel.cancel();
        }
    }, this);
}
Also used : ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) UnitToAddVmTemplateParametersBuilder(org.ovirt.engine.ui.uicommonweb.builders.template.UnitToAddVmTemplateParametersBuilder) VM(org.ovirt.engine.core.common.businessentities.VM) AddVmTemplateFromSnapshotParameters(org.ovirt.engine.core.common.action.AddVmTemplateFromSnapshotParameters)

Example 2 with UnitToAddVmTemplateParametersBuilder

use of org.ovirt.engine.ui.uicommonweb.builders.template.UnitToAddVmTemplateParametersBuilder in project ovirt-engine by oVirt.

the class VmListModel method postNameUniqueCheck.

private void postNameUniqueCheck() {
    UnitVmModel model = (UnitVmModel) getWindow();
    VM vm = getSelectedItem();
    VM newVm = buildVmOnNewTemplate(model, vm);
    AddVmTemplateParameters addVmTemplateParameters = new AddVmTemplateParameters(newVm, model.getName().getEntity(), model.getDescription().getEntity());
    BuilderExecutor.build(model, addVmTemplateParameters, new UnitToAddVmTemplateParametersBuilder());
    model.startProgress();
    Frontend.getInstance().runAction(ActionType.AddVmTemplate, addVmTemplateParameters, result -> {
        getWindow().stopProgress();
        ActionReturnValue returnValueBase = result.getReturnValue();
        if (returnValueBase != null && returnValueBase.getSucceeded()) {
            cancel();
        }
    }, this);
}
Also used : ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) UnitToAddVmTemplateParametersBuilder(org.ovirt.engine.ui.uicommonweb.builders.template.UnitToAddVmTemplateParametersBuilder) VM(org.ovirt.engine.core.common.businessentities.VM) AddVmTemplateParameters(org.ovirt.engine.core.common.action.AddVmTemplateParameters)

Aggregations

ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)2 VM (org.ovirt.engine.core.common.businessentities.VM)2 UnitToAddVmTemplateParametersBuilder (org.ovirt.engine.ui.uicommonweb.builders.template.UnitToAddVmTemplateParametersBuilder)2 AddVmTemplateFromSnapshotParameters (org.ovirt.engine.core.common.action.AddVmTemplateFromSnapshotParameters)1 AddVmTemplateParameters (org.ovirt.engine.core.common.action.AddVmTemplateParameters)1