Search in sources :

Example 76 with IdQueryParameters

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

the class DataCenterNetworkQoSListModel method syncSearch.

@Override
protected void syncSearch() {
    if (getEntity() == null) {
        return;
    }
    IdQueryParameters parameters = new IdQueryParameters(getEntity().getId());
    parameters.setRefresh(getIsQueryFirstTime());
    Frontend.getInstance().runQuery(QueryType.GetAllNetworkQosByStoragePoolId, parameters, new SetItemsAsyncQuery());
}
Also used : IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters)

Example 77 with IdQueryParameters

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

the class DataCenterQuotaListModel method syncSearch.

@Override
protected void syncSearch() {
    if (getEntity() == null) {
        return;
    }
    IdQueryParameters parameters = new IdQueryParameters(getEntity().getId());
    parameters.setRefresh(getIsQueryFirstTime());
    Frontend.getInstance().runQuery(QueryType.GetQuotaByStoragePoolId, parameters, new SetItemsAsyncQuery());
}
Also used : IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters)

Example 78 with IdQueryParameters

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

the class GlusterVolumeGeoRepCreateModel method getEligibleVolumes.

public void getEligibleVolumes() {
    this.startProgress(constants.fetchingDataMessage());
    Frontend.getInstance().runQuery(QueryType.GetGlusterGeoReplicationEligibleVolumes, new IdQueryParameters(masterVolume.getId()), new AsyncQuery<QueryReturnValue>(returnValue -> showAvailableVolumes(returnValue)));
}
Also used : SearchType(org.ovirt.engine.core.common.interfaces.SearchType) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) QueryType(org.ovirt.engine.core.common.queries.QueryType) EnumTranslator(org.ovirt.engine.ui.uicompat.EnumTranslator) Guid(org.ovirt.engine.core.compat.Guid) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) IEventListener(org.ovirt.engine.ui.uicompat.IEventListener) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ArrayList(java.util.ArrayList) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) HashSet(java.util.HashSet) Frontend(org.ovirt.engine.ui.frontend.Frontend) GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) EventArgs(org.ovirt.engine.ui.uicompat.EventArgs) UIMessages(org.ovirt.engine.ui.uicompat.UIMessages) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) Pair(org.ovirt.engine.core.common.utils.Pair) Model(org.ovirt.engine.ui.uicommonweb.models.Model) SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) IValidation(org.ovirt.engine.ui.uicommonweb.validation.IValidation) Collection(java.util.Collection) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) Set(java.util.Set) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) List(java.util.List) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants) LengthValidation(org.ovirt.engine.ui.uicommonweb.validation.LengthValidation) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) GlusterGeoRepNonEligibilityReason(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepNonEligibilityReason) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters)

Example 79 with IdQueryParameters

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

the class DiskVmListModel method syncSearch.

@Override
protected void syncSearch() {
    Disk disk = getEntity();
    if (disk == null) {
        return;
    }
    IdQueryParameters getVmsByDiskGuidParameters = new IdQueryParameters(disk.getId());
    getVmsByDiskGuidParameters.setRefresh(getIsQueryFirstTime());
    Frontend.getInstance().runQuery(QueryType.GetVmsByDiskGuid, getVmsByDiskGuidParameters, new AsyncQuery<QueryReturnValue>(returnValue -> {
        diskVmMap = returnValue.getReturnValue();
        ArrayList<VM> vmList = new ArrayList<>();
        ArrayList<VM> pluggedList = (ArrayList<VM>) diskVmMap.get(true);
        ArrayList<VM> unPluggedList = (ArrayList<VM>) diskVmMap.get(false);
        if (pluggedList != null) {
            vmList.addAll(pluggedList);
        }
        if (unPluggedList != null) {
            vmList.addAll(unPluggedList);
        }
        setItems(vmList);
    }));
    setIsQueryFirstTime(false);
}
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) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) HashMap(java.util.HashMap) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) 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) VM(org.ovirt.engine.core.common.businessentities.VM) ArrayList(java.util.ArrayList) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk)

Example 80 with IdQueryParameters

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

the class TaskListModel method updateSingleTask.

public boolean updateSingleTask(final String guidOrCorrelationId) {
    if (!detailedTaskMap.containsKey(guidOrCorrelationId)) {
        detailedTaskMap.put(guidOrCorrelationId, null);
        if (guidOrCorrelationId.startsWith(WEBADMIN)) {
            GetJobsByCorrelationIdQueryParameters parameters = new GetJobsByCorrelationIdQueryParameters();
            parameters.setCorrelationId(guidOrCorrelationId);
            Frontend.getInstance().runQuery(QueryType.GetJobsByCorrelationId, parameters, new AsyncQuery<QueryReturnValue>(returnValue -> {
                ArrayList<Job> retTasks = returnValue.getReturnValue();
                ArrayList<Job> taskList = (ArrayList<Job>) getItems();
                ArrayList<Job> newTaskList = new ArrayList<>();
                for (Job task : taskList) {
                    if (task.getCorrelationId().equals(guidOrCorrelationId)) {
                        detailedTaskMap.put(guidOrCorrelationId, task);
                        task.setStatus(JobExecutionStatus.FINISHED);
                        for (Job job : retTasks) {
                            Step step = new Step();
                            step.setId(job.getId());
                            step.setDescription(job.getDescription());
                            step.setCorrelationId(job.getCorrelationId());
                            step.setStartTime(job.getStartTime());
                            step.setEndTime(job.getEndTime());
                            step.setStatus(job.getStatus());
                            step.setSteps(job.getSteps());
                            if (!task.getStatus().equals(JobExecutionStatus.FINISHED) && !job.getStatus().equals(JobExecutionStatus.FINISHED)) {
                                task.setStatus(job.getStatus());
                            }
                            if (task.getLastUpdateTime() == null || (task.getLastUpdateTime().before(job.getLastUpdateTime()) && !task.getLastUpdateTime().equals(job.getLastUpdateTime()))) {
                                task.setLastUpdateTime(job.getEndTime());
                            }
                            Date tempDate = task.getLastUpdateTime();
                            if (task.getStartTime() == null || task.getStartTime().after(job.getStartTime())) {
                                task.setStartTime(job.getStartTime());
                            }
                            if (task.getEndTime() != null && (task.getEndTime() == null || task.getEndTime().before(job.getEndTime()))) {
                                task.setEndTime(job.getEndTime());
                            }
                            task.addStep(step);
                            task.setLastUpdateTime(tempDate);
                        }
                    }
                    newTaskList.add(task);
                }
                setItems(newTaskList);
            }));
        } else {
            IdQueryParameters parameters = new IdQueryParameters(new Guid(guidOrCorrelationId));
            Frontend.getInstance().runQuery(QueryType.GetJobByJobId, parameters, new AsyncQuery<QueryReturnValue>(returnValue -> {
                Job retTask = returnValue.getReturnValue();
                if (retTask == null) {
                    return;
                }
                detailedTaskMap.put(retTask.getId().toString(), retTask);
                ArrayList<Job> taskList = (ArrayList<Job>) getItems();
                ArrayList<Job> newTaskList = new ArrayList<>();
                for (Job task : taskList) {
                    if (task.getId().equals(retTask.getId())) {
                        newTaskList.add(retTask);
                    } else {
                        newTaskList.add(task);
                    }
                }
                setItems(newTaskList);
            }));
        }
        return false;
    }
    return true;
}
Also used : GetJobsByOffsetQueryParameters(org.ovirt.engine.core.common.queries.GetJobsByOffsetQueryParameters) JobExecutionStatus(org.ovirt.engine.core.common.job.JobExecutionStatus) QueryType(org.ovirt.engine.core.common.queries.QueryType) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Date(java.util.Date) Job(org.ovirt.engine.core.common.job.Job) Guid(org.ovirt.engine.core.compat.Guid) HashMap(java.util.HashMap) Random(java.util.Random) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ArrayList(java.util.ArrayList) GetJobsByCorrelationIdQueryParameters(org.ovirt.engine.core.common.queries.GetJobsByCorrelationIdQueryParameters) Frontend(org.ovirt.engine.ui.frontend.Frontend) List(java.util.List) Map(java.util.Map) Step(org.ovirt.engine.core.common.job.Step) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) GetJobsByCorrelationIdQueryParameters(org.ovirt.engine.core.common.queries.GetJobsByCorrelationIdQueryParameters) GetJobsByCorrelationIdQueryParameters(org.ovirt.engine.core.common.queries.GetJobsByCorrelationIdQueryParameters) ArrayList(java.util.ArrayList) Step(org.ovirt.engine.core.common.job.Step) Guid(org.ovirt.engine.core.compat.Guid) Job(org.ovirt.engine.core.common.job.Job) Date(java.util.Date)

Aggregations

IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)268 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)89 Guid (org.ovirt.engine.core.compat.Guid)80 ArrayList (java.util.ArrayList)68 StorageDomainsAndStoragePoolIdQueryParameters (org.ovirt.engine.core.common.queries.StorageDomainsAndStoragePoolIdQueryParameters)62 QueryType (org.ovirt.engine.core.common.queries.QueryType)59 List (java.util.List)47 Frontend (org.ovirt.engine.ui.frontend.Frontend)45 VM (org.ovirt.engine.core.common.businessentities.VM)42 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)36 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)35 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)26 Collection (java.util.Collection)25 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)25 SearchableListModel (org.ovirt.engine.ui.uicommonweb.models.SearchableListModel)25 Test (org.junit.Test)24 VDS (org.ovirt.engine.core.common.businessentities.VDS)24 HashMap (java.util.HashMap)22 ActionType (org.ovirt.engine.core.common.action.ActionType)21 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)19