use of org.ovirt.engine.core.common.queries.QueryReturnValue in project ovirt-engine by oVirt.
the class GlusterVolumeGeoRepCreateModel method getVolumesForForceSessionCreate.
public void getVolumesForForceSessionCreate() {
GlusterVolumeGeoRepCreateModel.this.startProgress(constants.fetchingDataMessage());
// $NON-NLS-1$
SearchParameters volumesSearchParameters = new SearchParameters("Volumes:", SearchType.GlusterVolume, false);
volumesSearchParameters.setRefresh(true);
Frontend.getInstance().runQuery(QueryType.Search, volumesSearchParameters, new AsyncQuery<QueryReturnValue>(returnValue -> showAvailableVolumes(returnValue)));
}
use of org.ovirt.engine.core.common.queries.QueryReturnValue 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)));
}
use of org.ovirt.engine.core.common.queries.QueryReturnValue 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);
}
use of org.ovirt.engine.core.common.queries.QueryReturnValue in project ovirt-engine by oVirt.
the class EventListModel method refreshModel.
protected void refreshModel() {
AsyncQuery<QueryReturnValue> query = new AsyncQuery<>(returnValue -> {
List<AuditLog> newEvents = returnValue.getReturnValue();
List<AuditLog> currentEvents = (List<AuditLog>) getItems();
if (isDisplayEventsOnly()) {
newEvents = newEvents.stream().filter(e -> e.getSeverity() != AuditLogSeverity.ALERT).collect(Collectors.toList());
}
if (!newEvents.isEmpty() && currentEvents != null && (currentEvents.isEmpty() || !currentEvents.get(0).equals(newEvents.get(0)))) {
// We received some new events, tell the active models to update.
RefreshActiveModelEvent.fire(EventListModel.this, false);
}
EventListModel.this.setItems(newEvents);
EventListModel.this.setLastEvent(Linq.firstOrNull(newEvents));
});
SearchParameters params = new SearchParameters(applySortOptions(getSearchString()), SearchType.AuditLog, isCaseSensitiveSearch());
params.setMaxCount(getSearchPageSize());
params.setRefresh(false);
Frontend.getInstance().runQuery(QueryType.Search, params, query);
}
use of org.ovirt.engine.core.common.queries.QueryReturnValue 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;
}
Aggregations