use of org.ovirt.engine.api.model.Networks in project ovirt-engine by oVirt.
the class V3NetworksInAdapter method adapt.
@Override
public Networks adapt(V3Networks from) {
Networks to = new Networks();
if (from.isSetActions()) {
to.setActions(adaptIn(from.getActions()));
}
if (from.isSetActive()) {
to.setActive(from.getActive());
}
if (from.isSetSize()) {
to.setSize(from.getSize());
}
if (from.isSetTotal()) {
to.setTotal(from.getTotal());
}
to.getNetworks().addAll(adaptIn(from.getNetworks()));
return to;
}
use of org.ovirt.engine.api.model.Networks in project ovirt-engine by oVirt.
the class V3IscsiBondInAdapter method adapt.
@Override
public IscsiBond adapt(V3IscsiBond from) {
IscsiBond to = new IscsiBond();
if (from.isSetLinks()) {
to.getLinks().addAll(adaptIn(from.getLinks()));
}
if (from.isSetActions()) {
to.setActions(adaptIn(from.getActions()));
}
if (from.isSetComment()) {
to.setComment(from.getComment());
}
if (from.isSetDataCenter()) {
to.setDataCenter(adaptIn(from.getDataCenter()));
}
if (from.isSetDescription()) {
to.setDescription(from.getDescription());
}
if (from.isSetId()) {
to.setId(from.getId());
}
if (from.isSetHref()) {
to.setHref(from.getHref());
}
if (from.isSetName()) {
to.setName(from.getName());
}
if (from.isSetNetworks()) {
to.setNetworks(new Networks());
to.getNetworks().getNetworks().addAll(adaptIn(from.getNetworks().getNetworks()));
}
if (from.isSetStorageConnections()) {
to.setStorageConnections(new StorageConnections());
to.getStorageConnections().getStorageConnections().addAll(adaptIn(from.getStorageConnections().getStorageConnections()));
}
return to;
}
use of org.ovirt.engine.api.model.Networks in project ovirt-engine by oVirt.
the class BackendVirtualFunctionAllowedNetworkResource method get.
@Override
public Network get() {
final Networks networks = getParent().list();
final Network network = networks.getNetworks().stream().filter(n -> n.getId().equals(id)).findFirst().orElse(null);
if (network == null) {
notFound();
}
return network;
}
use of org.ovirt.engine.api.model.Networks in project ovirt-engine by oVirt.
the class BackendVirtualFunctionAllowedNetworksResource method list.
@Override
public Networks list() {
final Set<Guid> networkIds = loadVfAllowedNetworks();
final Networks networks = new Networks();
for (Guid networkId : networkIds) {
final Network network = new Network();
network.setId(networkId.toString());
networks.getNetworks().add(network);
addLinks(network);
}
return networks;
}
use of org.ovirt.engine.api.model.Networks in project ovirt-engine by oVirt.
the class IscsiBondMapper method map.
@Mapping(from = org.ovirt.engine.core.common.businessentities.IscsiBond.class, to = IscsiBond.class)
public static IscsiBond map(org.ovirt.engine.core.common.businessentities.IscsiBond from, IscsiBond to) {
IscsiBond iscsiBond = (to != null) ? to : new IscsiBond();
DataCenter dataCenter = new DataCenter();
dataCenter.setId(from.getStoragePoolId().toString());
iscsiBond.setDataCenter(dataCenter);
iscsiBond.setName(from.getName());
iscsiBond.setDescription(from.getDescription());
if (from.getId() != null) {
iscsiBond.setId(from.getId().toString());
}
Networks networks = new Networks();
for (Guid id : from.getNetworkIds()) {
Network network = new Network();
network.setId(id.toString());
networks.getNetworks().add(network);
}
iscsiBond.setNetworks(networks);
StorageConnections connections = new StorageConnections();
for (String id : from.getStorageConnectionIds()) {
StorageConnection conn = new StorageConnection();
conn.setId(id);
connections.getStorageConnections().add(conn);
}
iscsiBond.setStorageConnections(connections);
return iscsiBond;
}
Aggregations