Search in sources :

Example 21 with VnicProfileView

use of org.ovirt.engine.core.common.businessentities.network.VnicProfileView in project ovirt-engine by oVirt.

the class ProfileBehavior method initProfiles.

public void initProfiles(final Guid clusterId, final Guid dcId, final AsyncQuery<List<VnicProfileView>> profilesQuery) {
    AsyncQuery<QueryReturnValue> networksQuery = new AsyncQuery<>(response -> {
        clusterNetworks = response.getReturnValue();
        managementNetworkName = clusterNetworks.stream().filter(n -> n.getCluster().isManagement()).map(Network::getName).findFirst().orElse(null);
        profilesQuery.converterCallback = returnValue -> {
            List<VnicProfileView> vnicProfiles = new ArrayList<>();
            vnicProfiles.add(VnicProfileView.EMPTY);
            if (returnValue == null) {
                return vnicProfiles;
            }
            for (VnicProfileView vnicProfile : (List<VnicProfileView>) returnValue) {
                Network network = findNetworkById(vnicProfile.getNetworkId());
                if (network != null) {
                    vnicProfiles.add(vnicProfile);
                }
            }
            Collections.sort(vnicProfiles, Linq.VnicProfileViewComparator);
            return vnicProfiles;
        };
        AsyncDataProvider.getInstance().getVnicProfilesByDcId(profilesQuery, dcId);
    });
    Frontend.getInstance().runQuery(QueryType.GetAllVmNetworksByClusterId, new IdQueryParameters(clusterId), networksQuery);
}
Also used : QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) AsyncQuery(org.ovirt.engine.ui.frontend.AsyncQuery) Network(org.ovirt.engine.core.common.businessentities.network.Network) VnicProfileView(org.ovirt.engine.core.common.businessentities.network.VnicProfileView) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

Example 22 with VnicProfileView

use of org.ovirt.engine.core.common.businessentities.network.VnicProfileView in project ovirt-engine by oVirt.

the class ImportNetworkData method setSelectedNetworkName.

public void setSelectedNetworkName(String networkName) {
    selectedNetworkName = networkName;
    filteredNetworkProfiles = new ArrayList<>();
    for (VnicProfileView profile : networkProfiles) {
        if (profile.getNetworkName().equals(networkName)) {
            filteredNetworkProfiles.add(profile);
        }
    }
}
Also used : VnicProfileView(org.ovirt.engine.core.common.businessentities.network.VnicProfileView)

Aggregations

VnicProfileView (org.ovirt.engine.core.common.businessentities.network.VnicProfileView)22 ArrayList (java.util.ArrayList)5 Test (org.junit.Test)5 VmNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface)4 Network (org.ovirt.engine.core.common.businessentities.network.Network)2 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)2 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)2 Column (com.google.gwt.user.cellview.client.Column)1 List (java.util.List)1 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)1 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 NetworkQoS (org.ovirt.engine.core.common.businessentities.network.NetworkQoS)1 QueryParametersBase (org.ovirt.engine.core.common.queries.QueryParametersBase)1 QueryType (org.ovirt.engine.core.common.queries.QueryType)1 Guid (org.ovirt.engine.core.compat.Guid)1 AbstractCheckboxColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractCheckboxColumn)1 AbstractDiskSizeColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn)1 AbstractEnumColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn)1 AbstractImageResourceColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractImageResourceColumn)1 AbstractSafeHtmlColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractSafeHtmlColumn)1