use of org.ovirt.engine.api.model.Properties in project ovirt-engine by oVirt.
the class V3ExternalHostProviderInAdapter method adapt.
@Override
public ExternalHostProvider adapt(V3ExternalHostProvider from) {
ExternalHostProvider to = new ExternalHostProvider();
if (from.isSetLinks()) {
to.getLinks().addAll(adaptIn(from.getLinks()));
}
if (from.isSetActions()) {
to.setActions(adaptIn(from.getActions()));
}
if (from.isSetAuthenticationUrl()) {
to.setAuthenticationUrl(from.getAuthenticationUrl());
}
if (from.isSetComment()) {
to.setComment(from.getComment());
}
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.isSetPassword()) {
to.setPassword(from.getPassword());
}
if (from.isSetProperties()) {
to.setProperties(new Properties());
to.getProperties().getProperties().addAll(adaptIn(from.getProperties().getProperties()));
}
if (from.isSetRequiresAuthentication()) {
to.setRequiresAuthentication(from.isRequiresAuthentication());
}
if (from.isSetUrl()) {
to.setUrl(from.getUrl());
}
if (from.isSetUsername()) {
to.setUsername(from.getUsername());
}
return to;
}
use of org.ovirt.engine.api.model.Properties in project ovirt-engine by oVirt.
the class LinkLayerDiscoveryProtocolElementMapper method map.
@Mapping(from = Tlv.class, to = LinkLayerDiscoveryProtocolElement.class)
public static LinkLayerDiscoveryProtocolElement map(Tlv entity, LinkLayerDiscoveryProtocolElement template) {
LinkLayerDiscoveryProtocolElement model = template != null ? template : new LinkLayerDiscoveryProtocolElement();
model.setName(entity.getName());
model.setType(entity.getType());
model.setOui(entity.getOui());
model.setSubtype(entity.getSubtype());
Properties properties = new Properties();
for (Map.Entry<String, String> entry : entity.getProperties().entrySet()) {
Property property = new Property();
property.setName(entry.getKey());
property.setValue(entry.getValue());
properties.getProperties().add(property);
}
model.setProperties(properties);
return model;
}
use of org.ovirt.engine.api.model.Properties in project ovirt-engine by oVirt.
the class OpenStackNetworkProviderMapper method map.
@Mapping(from = Provider.class, to = OpenStackNetworkProvider.class)
public static OpenStackNetworkProvider map(Provider<OpenstackNetworkProviderProperties> entity, OpenStackNetworkProvider template) {
OpenStackNetworkProvider model = template != null ? template : new OpenStackNetworkProvider();
model.setType(mapProviderType(entity.getType()));
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.setUnmanaged(entity.getIsUnmanaged());
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);
}
OpenstackNetworkProviderProperties additionalProperties = entity.getAdditionalProperties();
if (additionalProperties != null) {
if (additionalProperties.getTenantName() != null) {
model.setTenantName(additionalProperties.getTenantName());
}
String pluginType = additionalProperties.getPluginType();
if (pluginType != null) {
// for backwards compatibility, and should be removed in version 5 of the API.
if (entity.getType() == ProviderType.OPENSTACK_NETWORK && OpenstackNetworkPluginType.OPEN_VSWITCH.name().equalsIgnoreCase(pluginType)) {
model.setPluginType(NetworkPluginType.OPEN_VSWITCH);
}
model.setExternalPluginType(additionalProperties.getPluginType());
}
if (additionalProperties.getAgentConfiguration() != null) {
model.setAgentConfiguration(map(additionalProperties.getAgentConfiguration(), null));
}
model.setReadOnly(additionalProperties.getReadOnly());
model.setAutoSync(additionalProperties.getAutoSync());
}
return model;
}
use of org.ovirt.engine.api.model.Properties in project ovirt-engine by oVirt.
the class V3OpenStackNetworkProviderInAdapter method adapt.
@Override
public OpenStackNetworkProvider adapt(V3OpenStackNetworkProvider from) {
OpenStackNetworkProvider to = new OpenStackNetworkProvider();
if (from.isSetLinks()) {
to.getLinks().addAll(adaptIn(from.getLinks()));
}
if (from.isSetActions()) {
to.setActions(adaptIn(from.getActions()));
}
if (from.isSetAgentConfiguration()) {
to.setAgentConfiguration(adaptIn(from.getAgentConfiguration()));
}
if (from.isSetAuthenticationUrl()) {
to.setAuthenticationUrl(from.getAuthenticationUrl());
}
if (from.isSetComment()) {
to.setComment(from.getComment());
}
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.isSetPassword()) {
to.setPassword(from.getPassword());
}
if (from.isSetPluginType()) {
to.setPluginType(NetworkPluginType.fromValue(from.getPluginType()));
}
if (from.isSetProperties()) {
to.setProperties(new Properties());
to.getProperties().getProperties().addAll(adaptIn(from.getProperties().getProperties()));
}
if (from.isSetRequiresAuthentication()) {
to.setRequiresAuthentication(from.isRequiresAuthentication());
}
if (from.isSetTenantName()) {
to.setTenantName(from.getTenantName());
}
if (from.isSetUrl()) {
to.setUrl(from.getUrl());
}
if (from.isSetUsername()) {
to.setUsername(from.getUsername());
}
to.setType(OpenStackNetworkProviderType.NEUTRON);
return to;
}
use of org.ovirt.engine.api.model.Properties in project ovirt-engine by oVirt.
the class V3OpenStackVolumeTypeInAdapter method adapt.
@Override
public OpenStackVolumeType adapt(V3OpenStackVolumeType from) {
OpenStackVolumeType to = new OpenStackVolumeType();
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.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.isSetOpenstackVolumeProvider()) {
to.setOpenstackVolumeProvider(adaptIn(from.getOpenstackVolumeProvider()));
}
if (from.isSetProperties()) {
to.setProperties(new Properties());
to.getProperties().getProperties().addAll(adaptIn(from.getProperties().getProperties()));
}
return to;
}
Aggregations