Search in sources :

Example 1 with GetVmTemplatesFromStorageDomainParameters

use of org.ovirt.engine.core.common.queries.GetVmTemplatesFromStorageDomainParameters 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 GetVmTemplatesFromStorageDomainParameters

use of org.ovirt.engine.core.common.queries.GetVmTemplatesFromStorageDomainParameters in project ovirt-engine by oVirt.

the class AsyncDataProvider method getTemplateListByStorage.

public void getTemplateListByStorage(AsyncQuery<List<VmTemplate>> aQuery, Guid storageId) {
    aQuery.converterCallback = source -> {
        ArrayList<VmTemplate> list = new ArrayList<>();
        if (source != null) {
            for (VmTemplate template : (ArrayList<VmTemplate>) source) {
                if (template.getStatus() == VmTemplateStatus.OK) {
                    list.add(template);
                }
            }
            Collections.sort(list, new NameableComparator());
        }
        return list;
    };
    Frontend.getInstance().runQuery(QueryType.GetVmTemplatesFromStorageDomain, new GetVmTemplatesFromStorageDomainParameters(storageId, false), aQuery);
}
Also used : VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) ArrayList(java.util.ArrayList) NameableComparator(org.ovirt.engine.core.common.businessentities.comparators.NameableComparator) GetVmTemplatesFromStorageDomainParameters(org.ovirt.engine.core.common.queries.GetVmTemplatesFromStorageDomainParameters)

Aggregations

ArrayList (java.util.ArrayList)2 VmTemplate (org.ovirt.engine.core.common.businessentities.VmTemplate)2 GetVmTemplatesFromStorageDomainParameters (org.ovirt.engine.core.common.queries.GetVmTemplatesFromStorageDomainParameters)2 Collections (java.util.Collections)1 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)1 LexoNumericNameableComparator (org.ovirt.engine.core.common.businessentities.comparators.LexoNumericNameableComparator)1 NameableComparator (org.ovirt.engine.core.common.businessentities.comparators.NameableComparator)1 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)1 QueryType (org.ovirt.engine.core.common.queries.QueryType)1 Frontend (org.ovirt.engine.ui.frontend.Frontend)1 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)1 SearchableListModel (org.ovirt.engine.ui.uicommonweb.models.SearchableListModel)1 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)1