use of org.ovirt.engine.core.common.action.MoveOrCopyParameters in project ovirt-engine by oVirt.
the class VmListModel method onExportNoTemplates.
private void onExportNoTemplates() {
ExportVmModel model = (ExportVmModel) getWindow();
Guid storageDomainId = model.getStorage().getSelectedItem().getId();
if (model.getProgress() != null) {
return;
}
ArrayList<ActionParametersBase> list = new ArrayList<>();
for (Object item : getSelectedItems()) {
VM a = (VM) item;
MoveOrCopyParameters parameters = new MoveOrCopyParameters(a.getId(), storageDomainId);
parameters.setForceOverride(model.getForceOverride().getEntity());
parameters.setCopyCollapse(model.getCollapseSnapshots().getEntity());
parameters.setTemplateMustExists(false);
list.add(parameters);
}
model.startProgress();
Frontend.getInstance().runMultipleAction(ActionType.ExportVm, list, result -> {
ExportVmModel localModel = (ExportVmModel) result.getState();
localModel.stopProgress();
cancel();
}, model);
}
use of org.ovirt.engine.core.common.action.MoveOrCopyParameters in project ovirt-engine by oVirt.
the class JsonImmutableSerializeDeserializeTest method serializeCollectionsSingletonMap.
@Test
public void serializeCollectionsSingletonMap() {
MoveOrCopyParameters params = new MoveOrCopyParameters(Guid.newGuid(), Guid.newGuid());
params.setImageToDestinationDomainMap(Collections.singletonMap(Guid.createGuidFromString("9edb6526-7ab5-11e6-b829-54ee755c6cc7"), Guid.createGuidFromString("c097a788-7ab5-11e6-849b-54ee755c6cc7")));
JsonObjectSerializer serializer = new JsonObjectSerializer();
String json = serializer.serialize(params);
assertTrue(json.length() > 0);
MoveOrCopyParameters deserializedParams = new JsonObjectDeserializer().deserialize(json, MoveOrCopyParameters.class);
assertEquals(params.getContainerId(), deserializedParams.getContainerId());
assertEquals(params.getExecutionReason(), deserializedParams.getExecutionReason());
}
use of org.ovirt.engine.core.common.action.MoveOrCopyParameters in project ovirt-engine by oVirt.
the class BackendTemplateResource method export.
@Override
public Response export(Action action) {
validateParameters(action, "storageDomain.id|name");
MoveOrCopyParameters params = new MoveOrCopyParameters(guid, getStorageDomainId(action));
if (action.isSetExclusive() && action.isExclusive()) {
params.setForceOverride(true);
}
return doAction(ActionType.ExportVmTemplate, params, action, PollingType.JOB);
}
use of org.ovirt.engine.core.common.action.MoveOrCopyParameters in project ovirt-engine by oVirt.
the class TemplateListModel method doExport.
private void doExport() {
ExportVmModel model = (ExportVmModel) getWindow();
ArrayList<ActionParametersBase> list = new ArrayList<>();
for (Object item : getSelectedItems()) {
VmTemplate a = (VmTemplate) item;
if (a.getId().equals(Guid.Empty)) {
continue;
}
MoveOrCopyParameters tempVar = new MoveOrCopyParameters(a.getId(), model.getStorage().getSelectedItem().getId());
tempVar.setForceOverride(model.getForceOverride().getEntity());
list.add(tempVar);
}
model.startProgress();
Frontend.getInstance().runMultipleAction(ActionType.ExportVmTemplate, list, result -> {
ExportVmModel localModel = (ExportVmModel) result.getState();
localModel.stopProgress();
cancel();
}, model);
}
use of org.ovirt.engine.core.common.action.MoveOrCopyParameters in project ovirt-engine by oVirt.
the class VmListModel method postExportGetMissingTemplates.
private void postExportGetMissingTemplates(ArrayList<String> missingTemplatesFromVms) {
ExportVmModel model = (ExportVmModel) getWindow();
Guid storageDomainId = model.getStorage().getSelectedItem().getId();
ArrayList<ActionParametersBase> parameters = new ArrayList<>();
model.stopProgress();
for (Object a : getSelectedItems()) {
VM vm = (VM) a;
MoveOrCopyParameters parameter = new MoveOrCopyParameters(vm.getId(), storageDomainId);
parameter.setForceOverride(model.getForceOverride().getEntity());
parameter.setCopyCollapse(model.getCollapseSnapshots().getEntity());
parameter.setTemplateMustExists(true);
parameters.add(parameter);
}
if (!model.getCollapseSnapshots().getEntity()) {
if (missingTemplatesFromVms == null || missingTemplatesFromVms.size() > 0) {
ConfirmationModel confirmModel = new ConfirmationModel();
setConfirmWindow(confirmModel);
confirmModel.setTitle(ConstantsManager.getInstance().getConstants().templatesNotFoundOnExportDomainTitle());
confirmModel.setHelpTag(HelpTag.template_not_found_on_export_domain);
// $NON-NLS-1$
confirmModel.setHashName("template_not_found_on_export_domain");
confirmModel.setMessage(missingTemplatesFromVms == null ? ConstantsManager.getInstance().getConstants().couldNotReadTemplatesFromExportDomainMsg() : ConstantsManager.getInstance().getConstants().theFollowingTemplatesAreMissingOnTargetExportDomainMsg());
confirmModel.setItems(missingTemplatesFromVms);
// $NON-NLS-1$
UICommand tempVar = UICommand.createDefaultOkUiCommand("OnExportNoTemplates", this);
confirmModel.getCommands().add(tempVar);
// $NON-NLS-1$
UICommand tempVar2 = UICommand.createCancelUiCommand("CancelConfirmation", this);
confirmModel.getCommands().add(tempVar2);
} else {
if (model.getProgress() != null) {
return;
}
model.startProgress();
Frontend.getInstance().runMultipleAction(ActionType.ExportVm, parameters, result -> {
ExportVmModel localModel = (ExportVmModel) result.getState();
localModel.stopProgress();
cancel();
}, model);
}
} else {
if (model.getProgress() != null) {
return;
}
for (ActionParametersBase item : parameters) {
MoveOrCopyParameters parameter = (MoveOrCopyParameters) item;
parameter.setTemplateMustExists(false);
}
model.startProgress();
Frontend.getInstance().runMultipleAction(ActionType.ExportVm, parameters, result -> {
ExportVmModel localModel = (ExportVmModel) result.getState();
localModel.stopProgress();
cancel();
}, model);
}
}
Aggregations