Search in sources :

Example 71 with EntityModel

use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.

the class ImportRepoImageModel method executeCommand.

@Override
public void executeCommand(UICommand command) {
    if (!validate()) {
        return;
    }
    super.executeCommand(command);
    startProgress();
    ArrayList<ActionParametersBase> actionParameters = new ArrayList<>();
    final StringBuilder imageNames = new StringBuilder();
    for (EntityModel entity : getEntities()) {
        RepoImage repoImage = (RepoImage) entity.getEntity();
        // $NON-NLS-1$
        imageNames.append("\n -");
        imageNames.append(repoImage.getRepoImageName());
        ImportRepoImageParameters importParameters = new ImportRepoImageParameters();
        // source
        importParameters.setSourceRepoImageId(repoImage.getRepoImageId());
        importParameters.setSourceStorageDomainId(sourceStorageDomain.getId());
        // destination
        importParameters.setDiskAlias(((RepoImageModel) entity).getDiskImageAlias());
        importParameters.setStoragePoolId(getDataCenter().getSelectedItem().getId());
        importParameters.setStorageDomainId(getStorageDomain().getSelectedItem().getId());
        importParameters.setClusterId(getStorageDomain().getSelectedItem().getId());
        Quota selectedQuota = getQuota().getSelectedItem();
        if (selectedQuota != null) {
            importParameters.setQuotaId(selectedQuota.getId());
        }
        Boolean importAsTemplate = getImportAsTemplate().getEntity();
        importParameters.setImportAsTemplate(importAsTemplate);
        if (importAsTemplate) {
            importParameters.setClusterId(getCluster().getSelectedItem().getId());
            String templateName = getTemplateName().getEntity();
            if (StringHelper.isNotNullOrEmpty(templateName)) {
                importParameters.setTemplateName(templateName);
            }
        }
        actionParameters.add(importParameters);
    }
    Frontend.getInstance().runMultipleAction(ActionType.ImportRepoImage, actionParameters, result -> {
        ImportExportRepoImageBaseModel model = (ImportExportRepoImageBaseModel) result.getState();
        model.stopProgress();
        model.cancel();
        ConfirmationModel confirmModel = new ConfirmationModel();
        storageIsoListModel.setConfirmWindow(confirmModel);
        confirmModel.setTitle(ConstantsManager.getInstance().getConstants().importImagesTitle());
        confirmModel.setHelpTag(HelpTag.import_images);
        // $NON-NLS-1$
        confirmModel.setHashName("import_images");
        confirmModel.setMessage(ConstantsManager.getInstance().getMessages().importProcessHasBegunForImages(imageNames.toString()));
        confirmModel.getCommands().add(// $NON-NLS-1$
        new UICommand("CancelConfirm", storageIsoListModel).setTitle(ConstantsManager.getInstance().getConstants().close()).setIsDefault(true).setIsCancel(true));
    }, this);
}
Also used : ArrayList(java.util.ArrayList) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ImportRepoImageParameters(org.ovirt.engine.core.common.action.ImportRepoImageParameters) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) RepoImage(org.ovirt.engine.core.common.businessentities.storage.RepoImage) Quota(org.ovirt.engine.core.common.businessentities.Quota) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Example 72 with EntityModel

use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.

the class ImportRepoImageModel method setRepoImages.

public void setRepoImages(List<RepoImage> repoImages) {
    ArrayList<EntityModel> entities = new ArrayList<>();
    for (RepoImage i : repoImages) {
        entities.add(new RepoImageModel(i));
    }
    setEntities(entities);
}
Also used : RepoImage(org.ovirt.engine.core.common.businessentities.storage.RepoImage) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ArrayList(java.util.ArrayList)

Example 73 with EntityModel

use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.

the class AdElementListModel method addUsersToModel.

protected void addUsersToModel(QueryReturnValue returnValue, Set<String> excludeUsers) {
    for (Queryable item : (List<Queryable>) returnValue.getReturnValue()) {
        DirectoryUser a = (DirectoryUser) item;
        if (!excludeUsers.contains(a.getId())) {
            EntityModel<DbUser> tempVar2 = new EntityModel<>();
            tempVar2.setEntity(new DbUser(a));
            getusers().add(tempVar2);
        }
    }
}
Also used : DirectoryUser(org.ovirt.engine.core.aaa.DirectoryUser) Queryable(org.ovirt.engine.core.common.businessentities.Queryable) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ArrayList(java.util.ArrayList) List(java.util.List) DbUser(org.ovirt.engine.core.common.businessentities.aaa.DbUser)

Example 74 with EntityModel

use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.

the class TagListModel method tagToModel.

public TagModel tagToModel(Tags tag) {
    EntityModel<String> tempVar = new EntityModel<>();
    tempVar.setEntity(tag.getTagName());
    EntityModel<String> name = tempVar;
    EntityModel<String> tempVar2 = new EntityModel<>();
    tempVar2.setEntity(tag.getDescription());
    EntityModel<String> description = tempVar2;
    ArrayList<TagModel> children = new ArrayList<>();
    for (Tags a : tag.getChildren()) {
        children.add(tagToModel(a));
    }
    TagModel model = new TagModel();
    model.setId(tag.getTagId());
    model.setName(name);
    model.setDescription(description);
    model.setType((tag.getIsReadonly() == null ? false : tag.getIsReadonly()) ? TagModelType.ReadOnly : TagModelType.Regular);
    model.setSelection(false);
    model.setParentId(tag.getParentId() == null ? Guid.Empty : tag.getParentId());
    model.setChildren(children);
    for (TagModel child : children) {
        child.setParent(model);
    }
    model.getSelectionChangedEvent().addListener(this);
    return model;
}
Also used : EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ArrayList(java.util.ArrayList) Tags(org.ovirt.engine.core.common.businessentities.Tags)

Example 75 with EntityModel

use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.

the class StorageListModel method importFileStoragePostInit.

public void importFileStoragePostInit() {
    Guid storagePoolId = null;
    StoragePool dataCenter = storageModel.getContainer().getDataCenter().getSelectedItem();
    if (dataCenter != null && !dataCenter.getId().equals(Guid.Empty)) {
        storagePoolId = dataCenter.getId();
    }
    // Check storage domain existence
    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().importFailedDomainAlreadyExistStorageMsg(storageName));
        } else {
            StorageServerConnections tempVar = new StorageServerConnections();
            tempVar.setConnection(path);
            tempVar.setStorageType(storageType);
            if (storageModel instanceof NfsStorageModel) {
                NfsStorageModel nfsModel = (NfsStorageModel) storageModel;
                if (isConnectionOverriden()) {
                    tempVar.setNfsVersion((NfsVersion) ((EntityModel) nfsModel.getVersion().getSelectedItem()).getEntity());
                    tempVar.setNfsRetrans(nfsModel.getRetransmissions().asConvertible().nullableShort());
                    tempVar.setNfsTimeo(nfsModel.getTimeout().asConvertible().nullableShort());
                }
            }
            if (storageModel instanceof PosixStorageModel) {
                PosixStorageModel posixModel = (PosixStorageModel) storageModel;
                tempVar.setVfsType(posixModel.getVfsType().getEntity());
                tempVar.setMountOptions(posixModel.getMountOptions().getEntity());
            }
            fileConnection = tempVar;
            importFileStorageConnect();
        }
    }), storagePoolId, path);
}
Also used : SearchType(org.ovirt.engine.core.common.interfaces.SearchType) Arrays(java.util.Arrays) FrontendActionAsyncResult(org.ovirt.engine.ui.uicompat.FrontendActionAsyncResult) SearchObjects(org.ovirt.engine.core.searchbackend.SearchObjects) RegexValidation(org.ovirt.engine.ui.uicommonweb.validation.RegexValidation) Inject(com.google.inject.Inject) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) ApplicationMode(org.ovirt.engine.core.common.mode.ApplicationMode) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ExtendSANStorageDomainParameters(org.ovirt.engine.core.common.action.ExtendSANStorageDomainParameters) DiskProfileListModel(org.ovirt.engine.ui.uicommonweb.models.profiles.DiskProfileListModel) ActionType(org.ovirt.engine.core.common.action.ActionType) GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) NfsVersion(org.ovirt.engine.core.common.businessentities.NfsVersion) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) HasEntity(org.ovirt.engine.ui.uicommonweb.models.HasEntity) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) AttachStorageDomainToPoolParameters(org.ovirt.engine.core.common.action.AttachStorageDomainToPoolParameters) StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType) SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) ReduceSANStorageDomainDevicesCommandParameters(org.ovirt.engine.core.common.action.ReduceSANStorageDomainDevicesCommandParameters) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) Set(java.util.Set) AddSANStorageDomainParameters(org.ovirt.engine.core.common.action.AddSANStorageDomainParameters) StorageDomainSharedStatus(org.ovirt.engine.core.common.businessentities.StorageDomainSharedStatus) StringHelper(org.ovirt.engine.core.compat.StringHelper) List(java.util.List) Cloner(org.ovirt.engine.ui.uicommonweb.Cloner) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) PermissionListModel(org.ovirt.engine.ui.uicommonweb.models.configure.PermissionListModel) ITaskTarget(org.ovirt.engine.ui.uicompat.ITaskTarget) Guid(org.ovirt.engine.core.compat.Guid) IFrontendActionAsyncCallback(org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback) TaskContext(org.ovirt.engine.ui.uicompat.TaskContext) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) Task(org.ovirt.engine.ui.uicompat.Task) StorageDomainStatus(org.ovirt.engine.core.common.businessentities.StorageDomainStatus) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) GetDeviceListQueryParameters(org.ovirt.engine.core.common.queries.GetDeviceListQueryParameters) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Frontend(org.ovirt.engine.ui.frontend.Frontend) StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) LinkedList(java.util.LinkedList) Model(org.ovirt.engine.ui.uicommonweb.models.Model) RemoveStorageDomainParameters(org.ovirt.engine.core.common.action.RemoveStorageDomainParameters) StorageDomainManagementParameter(org.ovirt.engine.core.common.action.StorageDomainManagementParameter) Linq(org.ovirt.engine.ui.uicommonweb.Linq) SearchStringMapping(org.ovirt.engine.ui.uicommonweb.models.SearchStringMapping) IValidation(org.ovirt.engine.ui.uicommonweb.validation.IValidation) ListWithSimpleDetailsModel(org.ovirt.engine.ui.uicommonweb.models.ListWithSimpleDetailsModel) StorageServerConnectionParametersBase(org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase) StorageDomainType(org.ovirt.engine.core.common.businessentities.StorageDomainType) WebAdminApplicationPlaces(org.ovirt.engine.ui.uicommonweb.place.WebAdminApplicationPlaces) VDS(org.ovirt.engine.core.common.businessentities.VDS) StorageDomainParametersBase(org.ovirt.engine.core.common.action.StorageDomainParametersBase) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) NfsVersion(org.ovirt.engine.core.common.businessentities.NfsVersion) Guid(org.ovirt.engine.core.compat.Guid)

Aggregations

EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)105 ArrayList (java.util.ArrayList)56 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)27 List (java.util.List)26 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)23 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)22 ListModel (org.ovirt.engine.ui.uicommonweb.models.ListModel)22 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)22 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)20 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)19 ActionType (org.ovirt.engine.core.common.action.ActionType)18 Frontend (org.ovirt.engine.ui.frontend.Frontend)18 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)17 Guid (org.ovirt.engine.core.compat.Guid)17 PropertyChangedEventArgs (org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs)17 VDS (org.ovirt.engine.core.common.businessentities.VDS)16 QueryType (org.ovirt.engine.core.common.queries.QueryType)16 NoSelectionModel (com.google.gwt.view.client.NoSelectionModel)13 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)13 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)13