use of org.ovirt.engine.core.common.queries.SearchParameters in project ovirt-engine by oVirt.
the class AbstractBackendBaseTest method setUpGetEntityExpectations.
protected <E> void setUpGetEntityExpectations(String query, SearchType type, E entity) throws Exception {
QueryReturnValue queryResult = new QueryReturnValue();
SearchParameters params = new SearchParameters(query, type);
when(backend.runQuery(eq(QueryType.Search), eqSearchParams(params))).thenReturn(queryResult);
enqueueInteraction(() -> verify(backend, atLeastOnce()).runQuery(eq(QueryType.Search), eqSearchParams(params)));
queryResult.setSucceeded(true);
List<E> entities = new ArrayList<>();
entities.add(entity);
queryResult.setReturnValue(entities);
}
use of org.ovirt.engine.core.common.queries.SearchParameters in project ovirt-engine by oVirt.
the class HostListModel method syncSearch.
@Override
protected void syncSearch() {
SearchParameters tempVar = new SearchParameters(applySortOptions(getModifiedSearchString()), SearchType.VDS, isCaseSensitiveSearch());
tempVar.setMaxCount(getSearchPageSize());
super.syncSearch(QueryType.Search, tempVar);
}
use of org.ovirt.engine.core.common.queries.SearchParameters in project ovirt-engine by oVirt.
the class NetworkListModel method syncSearch.
@Override
protected void syncSearch() {
SearchParameters tempVar = new SearchParameters(applySortOptions(getSearchString()), SearchType.Network, isCaseSensitiveSearch());
tempVar.setMaxCount(getSearchPageSize());
super.syncSearch(QueryType.Search, tempVar);
}
use of org.ovirt.engine.core.common.queries.SearchParameters in project ovirt-engine by oVirt.
the class PoolGeneralModel method updateProperties.
private void updateProperties() {
final VmPool pool = getEntity();
setName(pool.getName());
setDescription(pool.getVmPoolDescription());
Frontend.getInstance().runQuery(QueryType.GetVmDataByPoolId, new IdQueryParameters(pool.getVmPoolId()), new AsyncQuery<>(new AsyncCallback<QueryReturnValue>() {
@Override
public void onSuccess(QueryReturnValue result) {
// refactor to "switch ... case...".
if (result != null) {
setvm((VM) result.getReturnValue());
}
if (getvm() != null) {
setTemplate(vmTemplateNameRenderer.render(getvm()));
setCpuInfo(ConstantsManager.getInstance().getMessages().cpuInfoLabel(getvm().getNumOfCpus(), getvm().getNumOfSockets(), getvm().getCpuPerSocket(), getvm().getThreadsPerCpu()));
setMonitorCount(getvm().getNumOfMonitors());
setOS(getvm().getVmOsId());
// $NON-NLS-1$
setDefinedMemory(getvm().getVmMemSizeMb() + " MB");
// $NON-NLS-1$
setMinAllocatedMemory(getvm().getMinAllocatedMem() + " MB");
Translator translator = EnumTranslator.getInstance();
setDefaultDisplayType(translator.translate(getvm().getDefaultDisplayType()));
setOrigin(translator.translate(getvm().getOrigin()));
setUsbPolicy(translator.translate(getvm().getUsbPolicy()));
setHasDomain(AsyncDataProvider.getInstance().isWindowsOsType(getvm().getVmOsId()));
setOptimizedForSystemProfile(translator.translate(getvm().getVmType()));
setHasTimeZone(AsyncDataProvider.getInstance().isWindowsOsType(getvm().getVmOsId()));
setTimeZone(getvm().getTimeZone());
setIsStateless(!pool.isStateful());
setQuotaName(getvm().getQuotaName());
setHasDefaultHost(getvm().getDedicatedVmForVdsList().size() > 0);
if (getHasDefaultHost()) {
Frontend.getInstance().runQuery(QueryType.Search, new SearchParameters(// $NON-NLS-1$
"Host: cluster = " + getvm().getClusterName() + " sortby name", SearchType.VDS), new AsyncQuery<QueryReturnValue>(returnValue1 -> {
// $NON-NLS-1$
String defaultHost1 = "";
ArrayList<VDS> hosts = returnValue1.getReturnValue();
for (VDS host : hosts) {
if (getvm().getDedicatedVmForVdsList().contains(host.getId())) {
if (defaultHost1.isEmpty()) {
defaultHost1 = host.getName();
} else {
// $NON-NLS-1$
defaultHost1 += ", " + host.getName();
}
}
}
setDefaultHost(defaultHost1);
}));
} else {
setDefaultHost(ConstantsManager.getInstance().getConstants().anyHostInCluster());
}
if (getvm() != null) {
PoolGeneralModel.super.updateProperties(getvm().getId());
}
} else {
setTemplate(null);
setCpuCount(0);
setMonitorCount(0);
setOS(0);
setDefinedMemory(null);
setMinAllocatedMemory(null);
setDefaultDisplayType(null);
setHasDomain(false);
setDomain(null);
setHasTimeZone(false);
setTimeZone(null);
setUsbPolicy(null);
setDefaultHost(null);
setIsStateless(!pool.isStateful());
// $NON-NLS-1$
setGraphicsType("");
// $NON-NLS-1$
setOptimizedForSystemProfile("");
getUpdateCompleteEvent().raise(this, EventArgs.EMPTY);
}
}
}));
}
use of org.ovirt.engine.core.common.queries.SearchParameters in project ovirt-engine by oVirt.
the class PoolListModel method syncSearch.
@Override
protected void syncSearch() {
SearchParameters tempVar = new SearchParameters(applySortOptions(getSearchString()), SearchType.VmPools, isCaseSensitiveSearch());
tempVar.setMaxCount(getSearchPageSize());
super.syncSearch(QueryType.Search, tempVar);
}
Aggregations