use of org.ovirt.engine.api.restapi.types.Mapping in project ovirt-engine by oVirt.
the class ExternalHostGroupMapper method map.
@Mapping(from = org.ovirt.engine.core.common.businessentities.ExternalHostGroup.class, to = ExternalHostGroup.class)
public static ExternalHostGroup map(org.ovirt.engine.core.common.businessentities.ExternalHostGroup entity, ExternalHostGroup template) {
ExternalHostGroup model = template != null ? template : new ExternalHostGroup();
String name = entity.getName();
if (name != null) {
model.setId(string2hex(name));
model.setName(name);
}
if (entity.getArchitectureName() != null) {
model.setArchitectureName(entity.getArchitectureName());
}
if (entity.getOperatingsystemName() != null) {
model.setOperatingSystemName(entity.getOperatingsystemName());
}
if (entity.getDomainName() != null) {
model.setDomainName(entity.getDomainName());
}
if (entity.getSubnetName() != null) {
model.setSubnetName(entity.getSubnetName());
}
return model;
}
use of org.ovirt.engine.api.restapi.types.Mapping in project ovirt-engine by oVirt.
the class StaticMapper method mapFooToBarInterfaces.
@Mapping(from = IFoo.class, to = IBar.class)
public static IBar mapFooToBarInterfaces(IFoo foo, IBar template) {
IBar 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 StaticMapper method mapBarToFooClasses.
@Mapping(from = BarImpl.class, to = FooImpl.class)
public static FooImpl mapBarToFooClasses(IBar bar, FooImpl template) {
FooImpl 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 OpenStackImageProviderMapper method map.
@Mapping(from = Provider.class, to = OpenStackImageProvider.class)
public static OpenStackImageProvider map(Provider<OpenStackImageProviderProperties> entity, OpenStackImageProvider template) {
OpenStackImageProvider model = template != null ? template : new OpenStackImageProvider();
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.getUrl() != null) {
model.setUrl(entity.getUrl());
}
if (entity.getAuthUrl() != null) {
model.setAuthenticationUrl(entity.getAuthUrl());
}
model.setRequiresAuthentication(entity.isRequiringAuthentication());
if (entity.getUsername() != null) {
model.setUsername(entity.getUsername());
}
// The password isn't mapped for security reasons.
// if (entity.getPassword() != null) {
// model.setPassword(entity.getPassword());
// }
Map<String, String> customProperties = entity.getCustomProperties();
if (customProperties != null) {
Properties properties = new Properties();
for (Map.Entry<String, String> entry : customProperties.entrySet()) {
Property property = new Property();
property.setName(entry.getKey());
property.setValue(entry.getValue());
properties.getProperties().add(property);
}
model.setProperties(properties);
}
OpenStackImageProviderProperties additionalProperties = entity.getAdditionalProperties();
if (additionalProperties != null) {
if (additionalProperties.getTenantName() != null) {
model.setTenantName(additionalProperties.getTenantName());
}
}
return model;
}
use of org.ovirt.engine.api.restapi.types.Mapping in project ovirt-engine by oVirt.
the class OpenStackNetworkProviderMapper method map.
@Mapping(from = OpenstackNetworkProviderProperties.AgentConfiguration.class, to = AgentConfiguration.class)
public static AgentConfiguration map(OpenstackNetworkProviderProperties.AgentConfiguration entity, AgentConfiguration template) {
AgentConfiguration model = template != null ? template : new AgentConfiguration();
if (entity.getNetworkMappings() != null) {
model.setNetworkMappings(entity.getNetworkMappings());
}
OpenstackNetworkProviderProperties.MessagingConfiguration messagingConfiguration = entity.getMessagingConfiguration();
if (messagingConfiguration != null) {
if (messagingConfiguration.getBrokerType() != null) {
model.setBrokerType(map(messagingConfiguration.getBrokerType()));
}
if (messagingConfiguration.getAddress() != null) {
model.setAddress(messagingConfiguration.getAddress());
}
if (messagingConfiguration.getPort() != null) {
model.setPort(messagingConfiguration.getPort());
}
if (messagingConfiguration.getUsername() != null) {
model.setUsername(messagingConfiguration.getUsername());
}
// The password isn't mapped for security reasons.
// if (messagingConfiguration.getPassword() != null) {
// model.setPassword(messagingConfiguration.getPassword());
// }
}
return model;
}
Aggregations