Search in sources :

Example 1 with LexoNumericNameableComparator

use of org.ovirt.engine.core.common.businessentities.comparators.LexoNumericNameableComparator in project ovirt-engine by oVirt.

the class StorageTemplateListModel method syncSearch.

@Override
protected void syncSearch() {
    if (getEntity() == null) {
        return;
    }
    super.syncSearch();
    GetVmTemplatesFromStorageDomainParameters tempVar = new GetVmTemplatesFromStorageDomainParameters(getEntity().getId(), true);
    tempVar.setRefresh(getIsQueryFirstTime());
    Frontend.getInstance().runQuery(QueryType.GetVmTemplatesFromStorageDomain, tempVar, new AsyncQuery<QueryReturnValue>(returnValue -> {
        ArrayList<VmTemplate> templates = returnValue.getReturnValue();
        Collections.sort(templates, new LexoNumericNameableComparator<>());
        setItems(templates);
        setIsEmpty(templates.size() == 0);
    }));
}
Also used : QueryType(org.ovirt.engine.core.common.queries.QueryType) Frontend(org.ovirt.engine.ui.frontend.Frontend) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) GetVmTemplatesFromStorageDomainParameters(org.ovirt.engine.core.common.queries.GetVmTemplatesFromStorageDomainParameters) LexoNumericNameableComparator(org.ovirt.engine.core.common.businessentities.comparators.LexoNumericNameableComparator) VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) Collections(java.util.Collections) ArrayList(java.util.ArrayList) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) LexoNumericNameableComparator(org.ovirt.engine.core.common.businessentities.comparators.LexoNumericNameableComparator) ArrayList(java.util.ArrayList) GetVmTemplatesFromStorageDomainParameters(org.ovirt.engine.core.common.queries.GetVmTemplatesFromStorageDomainParameters)

Example 2 with LexoNumericNameableComparator

use of org.ovirt.engine.core.common.businessentities.comparators.LexoNumericNameableComparator in project ovirt-engine by oVirt.

the class StorageVmListModel method syncSearch.

@Override
protected void syncSearch() {
    if (getEntity() == null) {
        return;
    }
    super.syncSearch();
    IdQueryParameters tempVar = new IdQueryParameters(getEntity().getId());
    tempVar.setRefresh(getIsQueryFirstTime());
    Frontend.getInstance().runQuery(QueryType.GetVmsByStorageDomain, tempVar, new AsyncQuery<QueryReturnValue>(returnValue -> {
        ArrayList<VM> vms = returnValue.getReturnValue();
        Collections.sort(vms, new LexoNumericNameableComparator<>());
        setItems(vms);
        setIsEmpty(vms.size() == 0);
    }));
}
Also used : QueryType(org.ovirt.engine.core.common.queries.QueryType) Frontend(org.ovirt.engine.ui.frontend.Frontend) VM(org.ovirt.engine.core.common.businessentities.VM) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) LexoNumericNameableComparator(org.ovirt.engine.core.common.businessentities.comparators.LexoNumericNameableComparator) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) Collections(java.util.Collections) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ArrayList(java.util.ArrayList) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) LexoNumericNameableComparator(org.ovirt.engine.core.common.businessentities.comparators.LexoNumericNameableComparator) ArrayList(java.util.ArrayList)

Example 3 with LexoNumericNameableComparator

use of org.ovirt.engine.core.common.businessentities.comparators.LexoNumericNameableComparator in project ovirt-engine by oVirt.

the class SnapshotModel method updateVmConfiguration.

public void updateVmConfiguration(final AsyncCallback<Void> onUpdateAsyncCallback) {
    Snapshot snapshot = getEntity();
    if (snapshot == null) {
        return;
    }
    AsyncDataProvider.getInstance().getVmConfigurationBySnapshot(new AsyncQuery<>(vm -> {
        Snapshot snapshot1 = getEntity();
        if (vm != null && snapshot1 != null) {
            setVm(vm);
            setDisks(vm.getDiskList());
            setNics(vm.getInterfaces());
            setApps(Arrays.asList(snapshot1.getAppList() != null ? snapshot1.getAppList().split(",") : // $NON-NLS-1$
            new String[] {}));
            Collections.sort(getDisks(), new DiskByDiskAliasComparator());
            Collections.sort(getNics(), new LexoNumericNameableComparator<>());
        }
        onUpdateAsyncCallback.onSuccess(null);
    }), snapshot.getId());
}
Also used : NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) Arrays(java.util.Arrays) Guid(org.ovirt.engine.core.compat.Guid) SpecialAsciiI18NOrNoneValidation(org.ovirt.engine.ui.uicommonweb.validation.SpecialAsciiI18NOrNoneValidation) DiskByDiskAliasComparator(org.ovirt.engine.core.common.businessentities.comparators.DiskByDiskAliasComparator) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) ArrayList(java.util.ArrayList) AsyncCallback(org.ovirt.engine.ui.frontend.AsyncCallback) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) LexoNumericNameableComparator(org.ovirt.engine.core.common.businessentities.comparators.LexoNumericNameableComparator) Snapshot(org.ovirt.engine.core.common.businessentities.Snapshot) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) Version(org.ovirt.engine.core.compat.Version) ICommandTarget(org.ovirt.engine.ui.uicommonweb.ICommandTarget) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) BaseDisk(org.ovirt.engine.core.common.businessentities.storage.BaseDisk) SnapshotStatus(org.ovirt.engine.core.common.businessentities.Snapshot.SnapshotStatus) VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) CreateSnapshotForVmParameters(org.ovirt.engine.core.common.action.CreateSnapshotForVmParameters) IValidation(org.ovirt.engine.ui.uicommonweb.validation.IValidation) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) Set(java.util.Set) BusinessEntitiesDefinitions(org.ovirt.engine.core.common.businessentities.BusinessEntitiesDefinitions) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) Collectors(java.util.stream.Collectors) SnapshotType(org.ovirt.engine.core.common.businessentities.Snapshot.SnapshotType) List(java.util.List) VM(org.ovirt.engine.core.common.businessentities.VM) LengthValidation(org.ovirt.engine.ui.uicommonweb.validation.LengthValidation) Collections(java.util.Collections) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) Snapshot(org.ovirt.engine.core.common.businessentities.Snapshot) LexoNumericNameableComparator(org.ovirt.engine.core.common.businessentities.comparators.LexoNumericNameableComparator) DiskByDiskAliasComparator(org.ovirt.engine.core.common.businessentities.comparators.DiskByDiskAliasComparator)

Aggregations

ArrayList (java.util.ArrayList)3 Collections (java.util.Collections)3 LexoNumericNameableComparator (org.ovirt.engine.core.common.businessentities.comparators.LexoNumericNameableComparator)3 Frontend (org.ovirt.engine.ui.frontend.Frontend)3 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)3 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)3 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)2 VM (org.ovirt.engine.core.common.businessentities.VM)2 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)2 QueryType (org.ovirt.engine.core.common.queries.QueryType)2 SearchableListModel (org.ovirt.engine.ui.uicommonweb.models.SearchableListModel)2 Arrays (java.util.Arrays)1 List (java.util.List)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)1 ActionType (org.ovirt.engine.core.common.action.ActionType)1 CreateSnapshotForVmParameters (org.ovirt.engine.core.common.action.CreateSnapshotForVmParameters)1 BusinessEntitiesDefinitions (org.ovirt.engine.core.common.businessentities.BusinessEntitiesDefinitions)1 Snapshot (org.ovirt.engine.core.common.businessentities.Snapshot)1