Search in sources :

Example 1 with NetworkFilter

use of org.ovirt.engine.api.model.NetworkFilter in project ovirt-engine by oVirt.

the class NetworkFilterMapper method map.

@Mapping(from = org.ovirt.engine.core.common.businessentities.network.NetworkFilter.class, to = NetworkFilter.class)
public static NetworkFilter map(org.ovirt.engine.core.common.businessentities.network.NetworkFilter entity, NetworkFilter template) {
    NetworkFilter networkFilter = (template != null) ? template : new NetworkFilter();
    networkFilter.setVersion(VersionMapper.map(entity.getVersion()));
    networkFilter.setName(entity.getName());
    networkFilter.setId(entity.getId().toString());
    return networkFilter;
}
Also used : NetworkFilter(org.ovirt.engine.api.model.NetworkFilter)

Example 2 with NetworkFilter

use of org.ovirt.engine.api.model.NetworkFilter in project ovirt-engine by oVirt.

the class BackendNetworkFiltersResource method mapCollection.

private NetworkFilters mapCollection(List<org.ovirt.engine.core.common.businessentities.network.NetworkFilter> entities) {
    NetworkFilters collection = new NetworkFilters();
    for (org.ovirt.engine.core.common.businessentities.network.NetworkFilter entity : entities) {
        NetworkFilter networkFilter = map(entity);
        collection.getNetworkFilters().add(addLinks(populate(map(entity), entity)));
    }
    return collection;
}
Also used : NetworkFilters(org.ovirt.engine.api.model.NetworkFilters) NetworkFilter(org.ovirt.engine.api.model.NetworkFilter)

Example 3 with NetworkFilter

use of org.ovirt.engine.api.model.NetworkFilter in project ovirt-engine by oVirt.

the class VnicProfileMapper method map.

@Mapping(from = org.ovirt.engine.core.common.businessentities.network.VnicProfile.class, to = VnicProfile.class)
public static VnicProfile map(org.ovirt.engine.core.common.businessentities.network.VnicProfile entity, VnicProfile template) {
    VnicProfile model = template != null ? template : new VnicProfile();
    if (entity.getId() != null) {
        model.setId(entity.getId().toString());
    }
    if (entity.getName() != null) {
        model.setName(entity.getName());
    }
    if (entity.getDescription() != null) {
        model.setDescription(entity.getDescription());
    }
    if (entity.getNetworkId() != null) {
        model.setNetwork(new Network());
        model.getNetwork().setId(entity.getNetworkId().toString());
    }
    model.setPortMirroring(entity.isPortMirroring());
    if (entity.getCustomProperties() != null && !entity.getCustomProperties().isEmpty()) {
        CustomProperties hooks = new CustomProperties();
        hooks.getCustomProperties().addAll(CustomPropertiesParser.parse(DevicePropertiesUtils.getInstance().convertProperties(entity.getCustomProperties()), false));
        model.setCustomProperties(hooks);
    }
    if (entity.getNetworkQosId() != null) {
        model.setQos(new Qos());
        model.getQos().setId(entity.getNetworkQosId().toString());
    }
    final VnicPassThrough vnicPassThrough = new VnicPassThrough();
    vnicPassThrough.setMode(map(entity.isPassthrough()));
    model.setPassThrough(vnicPassThrough);
    if (entity.getNetworkFilterId() != null) {
        model.setNetworkFilter(new NetworkFilter());
        model.getNetworkFilter().setId(entity.getNetworkFilterId().toString());
    }
    if (entity.isPassthrough()) {
        model.setMigratable(entity.isMigratable());
    }
    return model;
}
Also used : VnicPassThrough(org.ovirt.engine.api.model.VnicPassThrough) Qos(org.ovirt.engine.api.model.Qos) Network(org.ovirt.engine.api.model.Network) NetworkFilter(org.ovirt.engine.api.model.NetworkFilter) VnicProfile(org.ovirt.engine.api.model.VnicProfile) CustomProperties(org.ovirt.engine.api.model.CustomProperties)

Aggregations

NetworkFilter (org.ovirt.engine.api.model.NetworkFilter)3 CustomProperties (org.ovirt.engine.api.model.CustomProperties)1 Network (org.ovirt.engine.api.model.Network)1 NetworkFilters (org.ovirt.engine.api.model.NetworkFilters)1 Qos (org.ovirt.engine.api.model.Qos)1 VnicPassThrough (org.ovirt.engine.api.model.VnicPassThrough)1 VnicProfile (org.ovirt.engine.api.model.VnicProfile)1