use of org.ovirt.engine.ui.uicompat.TaskContext in project ovirt-engine by oVirt.
the class DataCenterGuideModel method saveNfsStorage.
private void saveNfsStorage(final TaskContext context) {
this.context = context;
StorageModel model = (StorageModel) getWindow();
boolean isNew = model.getStorage() == null;
storageModel = model.getCurrentStorageItem();
NfsStorageModel nfsModel = (NfsStorageModel) storageModel;
path = nfsModel.getPath().getEntity();
storageDomain = new StorageDomainStatic();
storageDomain.setStorageType(isNew ? storageModel.getType() : storageDomain.getStorageType());
storageDomain.setStorageDomainType(isNew ? storageModel.getRole() : storageDomain.getStorageDomainType());
storageDomain.setStorageName(model.getName().getEntity());
storageDomain.setStorageFormat(model.getFormat().getSelectedItem());
AsyncDataProvider.getInstance().getStorageDomainsByConnection(new AsyncQuery<>(storages -> {
if (storages != null && storages.size() > 0) {
String storageName = storages.get(0).getStorageName();
onFinish(context, false, storageModel, ConstantsManager.getInstance().getMessages().createOperationFailedDcGuideMsg(storageName));
} else {
saveNewNfsStorage();
}
}), null, path);
}
use of org.ovirt.engine.ui.uicompat.TaskContext in project ovirt-engine by oVirt.
the class DataCenterGuideModel method saveLocalStorage.
private void saveLocalStorage(final TaskContext context) {
this.context = context;
StorageModel model = (StorageModel) getWindow();
VDS host = model.getHost().getSelectedItem();
boolean isNew = model.getStorage() == null;
storageModel = model.getCurrentStorageItem();
LocalStorageModel localModel = (LocalStorageModel) storageModel;
path = localModel.getPath().getEntity();
storageDomain = new StorageDomainStatic();
storageDomain.setStorageType(isNew ? storageModel.getType() : storageDomain.getStorageType());
storageDomain.setStorageDomainType(isNew ? storageModel.getRole() : storageDomain.getStorageDomainType());
storageDomain.setStorageName(model.getName().getEntity());
AsyncDataProvider.getInstance().getStorageDomainsByConnection(new AsyncQuery<>(storages -> {
if (storages != null && storages.size() > 0) {
String storageName = storages.get(0).getStorageName();
onFinish(context, false, storageModel, ConstantsManager.getInstance().getMessages().createOperationFailedDcGuideMsg(storageName));
} else {
saveNewLocalStorage();
}
}), host.getStoragePoolId(), path);
}
Aggregations