use of org.ovirt.engine.api.restapi.types.Mapping in project ovirt-engine by oVirt.
the class ExternalHostMapper method map.
@Mapping(from = VDS.class, to = ExternalHost.class)
public static ExternalHost map(VDS entity, ExternalHost template) {
ExternalHost model = template != null ? template : new ExternalHost();
String name = entity.getName();
if (name != null) {
model.setId(string2hex(name));
model.setName(name);
}
if (entity.getHostName() != null) {
model.setAddress(entity.getHostName());
}
return model;
}
use of org.ovirt.engine.api.restapi.types.Mapping in project ovirt-engine by oVirt.
the class StaticMapper method mapBarToFooInterfaces.
@Mapping(from = IBar.class, to = IFoo.class)
public static IFoo mapBarToFooInterfaces(IBar bar, IFoo template) {
IFoo foo = template != null ? template : new FooImpl();
foo.set(bar.get());
return foo;
}
use of org.ovirt.engine.api.restapi.types.Mapping in project ovirt-engine by oVirt.
the class StaticMapper method mapFooToBarClasses.
@Mapping(from = FooImpl.class, to = BarImpl.class)
public static BarImpl mapFooToBarClasses(IFoo foo, BarImpl template) {
BarImpl bar = template != null ? template : new BarImpl();
bar.set(foo.get());
return bar;
}
use of org.ovirt.engine.api.restapi.types.Mapping in project ovirt-engine by oVirt.
the class OpenStackSubnetMapper method map.
@Mapping(from = OpenStackSubnet.class, to = ExternalSubnet.class)
public static ExternalSubnet map(OpenStackSubnet model, ExternalSubnet template) {
ExternalSubnet entity = template != null ? template : new ExternalSubnet();
if (model.isSetId()) {
entity.setId(model.getId());
}
if (model.isSetName()) {
entity.setName(model.getName());
}
if (model.isSetCidr()) {
entity.setCidr(model.getCidr());
}
if (model.isSetIpVersion()) {
entity.setIpVersion(IpVersionMapper.map(IpVersion.fromValue(model.getIpVersion())));
}
if (model.isSetGateway()) {
entity.setGateway(model.getGateway());
}
List<String> entityDnsServers = new ArrayList<>(1);
if (model.isSetDnsServers()) {
List<String> modelDnsServers = model.getDnsServers().getDnsServers();
entityDnsServers.addAll(modelDnsServers);
}
entity.setDnsServers(entityDnsServers);
return entity;
}
use of org.ovirt.engine.api.restapi.types.Mapping in project ovirt-engine by oVirt.
the class ExternalComputeResourceMapper method map.
@Mapping(from = org.ovirt.engine.core.common.businessentities.ExternalComputeResource.class, to = ExternalComputeResource.class)
public static ExternalComputeResource map(org.ovirt.engine.core.common.businessentities.ExternalComputeResource entity, ExternalComputeResource template) {
ExternalComputeResource model = template != null ? template : new ExternalComputeResource();
String name = entity.getName();
if (name != null) {
model.setId(string2hex(name));
model.setName(name);
}
if (entity.getProvider() != null) {
model.setProvider(entity.getProvider());
}
if (entity.getUser() != null) {
model.setUser(entity.getUser());
}
if (entity.getUrl() != null) {
model.setUrl(entity.getUrl());
}
return model;
}
Aggregations