use of org.ovirt.engine.core.common.businessentities.network.VmNicFilterParameter in project ovirt-engine by oVirt.
the class VmNicFilterParameterDaoImpl method getAllForVmNic.
@Override
public List<VmNicFilterParameter> getAllForVmNic(Guid vmInterfaceId, Guid userId, boolean filtered) {
MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("vm_interface_id", vmInterfaceId).addValue("user_id", userId).addValue("is_filtered", filtered);
List<VmNicFilterParameter> results = getCallsHandler().executeReadList("GetVmInterfaceFilterParametersByVmInterfaceId", VmNicFilterParameterRowMapper.INSTANCE, parameterSource);
return results;
}
use of org.ovirt.engine.core.common.businessentities.network.VmNicFilterParameter in project ovirt-engine by oVirt.
the class AddVmInterfaceCommand method saveNetworkFilterParameters.
protected void saveNetworkFilterParameters() {
if (getParameters().getFilterParameters() != null) {
for (VmNicFilterParameter parameter : getParameters().getFilterParameters()) {
parameter.setVmInterfaceId(getInterface().getId());
runInternalAction(ActionType.AddVmNicFilterParameter, new VmNicFilterParameterParameters(getParameters().getVmId(), parameter));
}
}
}
use of org.ovirt.engine.core.common.businessentities.network.VmNicFilterParameter in project ovirt-engine by oVirt.
the class UpdateVmInterfaceCommand method saveNetworkFilterParameters.
protected void saveNetworkFilterParameters() {
List<VmNicFilterParameter> newParameters = getParameters().getFilterParameters();
if (newParameters != null) {
List<VmNicFilterParameter> savedParameters = runInternalQuery(QueryType.GetVmInterfaceFilterParametersByVmInterfaceId, new IdQueryParameters(getInterface().getId())).getReturnValue();
for (VmNicFilterParameter parameter : newParameters) {
boolean toUpdate = savedParameters.stream().anyMatch(saved -> Objects.equals(parameter.getId(), saved.getId()));
if (toUpdate) {
runInternalAction(ActionType.UpdateVmNicFilterParameter, new VmNicFilterParameterParameters(getParameters().getVmId(), parameter));
} else {
parameter.setVmInterfaceId(getInterface().getId());
runInternalAction(ActionType.AddVmNicFilterParameter, new VmNicFilterParameterParameters(getParameters().getVmId(), parameter));
}
}
for (VmNicFilterParameter parameter : savedParameters) {
if (newParameters.stream().noneMatch(newParameter -> Objects.equals(parameter.getId(), newParameter.getId()))) {
runInternalAction(ActionType.RemoveVmNicFilterParameter, new RemoveVmNicFilterParameterParameters(getParameters().getVmId(), parameter.getId()));
}
}
}
}
use of org.ovirt.engine.core.common.businessentities.network.VmNicFilterParameter in project ovirt-engine by oVirt.
the class VmInterfaceListModel method updateNetworkFilterParameterMap.
private void updateNetworkFilterParameterMap(List<VmNetworkInterface> vmInterfaces) {
List<QueryType> queryTypes = new ArrayList<>();
List<QueryParametersBase> queryParametersBases = new ArrayList<>();
vmInterfaces.stream().forEach(iface -> {
queryTypes.add(QueryType.GetVmInterfaceFilterParametersByVmInterfaceId);
queryParametersBases.add(new IdQueryParameters(iface.getId()));
});
final IFrontendMultipleQueryAsyncCallback callback = multiResult -> {
Map<Guid, List<VmNicFilterParameter>> networkFilterMap = new HashMap<>(vmInterfaces.size());
for (int i = 0; i < multiResult.getReturnValues().size(); i++) {
List<VmNicFilterParameter> params = multiResult.getReturnValues().get(i).getReturnValue();
networkFilterMap.put(vmInterfaces.get(i).getId(), params);
}
setMapNicFilterParameter(networkFilterMap);
setItems(vmInterfaces);
};
if (vmInterfaces.isEmpty()) {
setItems(vmInterfaces);
}
Frontend.getInstance().runMultipleQueries(queryTypes, queryParametersBases, callback);
}
Aggregations