use of org.ovirt.engine.core.common.utils.PairQueryable in project ovirt-engine by oVirt.
the class NetworkHostListModel method initAttachedInterfaces.
private void initAttachedInterfaces(final Collection<PairQueryable<VdsNetworkInterface, VDS>> items) {
if (getEntity() == null || StringHelper.isNullOrEmpty(getEntity().getLabel()) || items == null || items.isEmpty()) {
setItems(items);
return;
}
final NetworkHostFilter filter = getViewFilterType();
IdQueryParameters params = new IdQueryParameters(getEntity().getId());
params.setRefresh(false);
Frontend.getInstance().runQuery(QueryType.GetInterfacesByLabelForNetwork, params, new AsyncQuery<QueryReturnValue>(returnValueObj -> {
if (!filter.equals(getViewFilterType())) {
return;
}
attachedByLabelInterfaces = returnValueObj.getReturnValue();
setItems(items);
}));
}
use of org.ovirt.engine.core.common.utils.PairQueryable in project ovirt-engine by oVirt.
the class GetVdsAndNetworkInterfacesByNetworkIdQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
List<VDS> vdsList = vdsDao.getAllForNetwork(getParameters().getId());
List<VdsNetworkInterface> vdsNetworkInterfaceList = interfaceDao.getVdsInterfacesByNetworkId(getParameters().getId());
final Map<Guid, VDS> vdsById = Entities.businessEntitiesById(vdsList);
List<PairQueryable<VdsNetworkInterface, VDS>> vdsInterfaceVdsPairs = new ArrayList<>();
Network network = networkDao.get(getParameters().getId());
for (final VdsNetworkInterface vdsNetworkInterface : vdsNetworkInterfaceList) {
vdsInterfaceVdsPairs.add(new PairQueryable<>(vdsNetworkInterface, vdsById.get(vdsNetworkInterface.getVdsId())));
NetworkImplementationDetails vdsInterfaceNetworkImplementationDetails = networkImplementationDetailsUtils.calculateNetworkImplementationDetails(vdsNetworkInterface, network);
vdsNetworkInterface.setNetworkImplementationDetails(vdsInterfaceNetworkImplementationDetails);
}
getQueryReturnValue().setReturnValue(vdsInterfaceVdsPairs);
}
use of org.ovirt.engine.core.common.utils.PairQueryable in project ovirt-engine by oVirt.
the class GetVmTemplatesAndNetworkInterfacesByNetworkIdQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
List<VmTemplate> vmTemplateList = vmTemplateDao.getAllForNetwork(getParameters().getId());
List<VmNetworkInterface> vmNetworkInterfaceList = vmNetworkInterfaceDao.getAllForTemplatesByNetwork(getParameters().getId());
final Map<Guid, VmTemplate> vmTemplatesById = Entities.businessEntitiesById(vmTemplateList);
List<PairQueryable<VmNetworkInterface, VmTemplate>> vmInterfaceVmPairs = new ArrayList<>();
for (VmNetworkInterface vmNetworkInterface : vmNetworkInterfaceList) {
vmInterfaceVmPairs.add(new PairQueryable<>(vmNetworkInterface, vmTemplatesById.get(vmNetworkInterface.getVmTemplateId())));
}
getQueryReturnValue().setReturnValue(vmInterfaceVmPairs);
}
use of org.ovirt.engine.core.common.utils.PairQueryable in project ovirt-engine by oVirt.
the class SubTabNetworkClusterView method createNetRoleColumn.
private AbstractSafeHtmlColumn<PairQueryable<Cluster, NetworkCluster>> createNetRoleColumn() {
return new AbstractSafeHtmlColumn<PairQueryable<Cluster, NetworkCluster>>() {
@Override
public SafeHtml getValue(PairQueryable<Cluster, NetworkCluster> object) {
List<SafeHtml> images = new LinkedList<>();
NetworkCluster networkCluster = object.getSecond();
if (networkCluster != null) {
images.add(thisOrEmptyImage(networkCluster.isManagement(), managementImage));
images.add(thisOrEmptyImage(networkCluster.isDisplay(), displayImage));
images.add(thisOrEmptyImage(networkCluster.isMigration(), migrationImage));
images.add(thisOrEmptyImage(networkCluster.isGluster(), glusterNwImage));
images.add(thisOrEmptyImage(networkCluster.isDefaultRoute(), defaultRouteImage));
}
return MultiImageColumnHelper.getValue(images);
}
@Override
public SafeHtml getTooltip(PairQueryable<Cluster, NetworkCluster> object) {
Map<SafeHtml, String> imagesToText = new LinkedHashMap<>();
NetworkCluster networkCluster = object.getSecond();
if (networkCluster != null) {
if (networkCluster.isManagement()) {
imagesToText.put(managementImage, constants.managementItemInfo());
}
if (networkCluster.isDisplay()) {
imagesToText.put(displayImage, constants.displayItemInfo());
}
if (networkCluster.isMigration()) {
imagesToText.put(migrationImage, constants.migrationItemInfo());
}
if (networkCluster.isGluster()) {
imagesToText.put(glusterNwImage, constants.glusterNwItemInfo());
}
if (networkCluster.isDefaultRoute()) {
imagesToText.put(defaultRouteImage, constants.defaultRouteItemInfo());
}
}
return MultiImageColumnHelper.getTooltip(imagesToText);
}
};
}
Aggregations