use of org.ovirt.engine.api.model.Property in project ovirt-engine by oVirt.
the class OpenStackVolumeProviderMapper method map.
@Mapping(from = Provider.class, to = OpenStackVolumeProvider.class)
public static OpenStackVolumeProvider map(Provider<OpenStackVolumeProviderProperties> entity, OpenStackVolumeProvider template) {
OpenStackVolumeProvider model = template != null ? template : new OpenStackVolumeProvider();
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);
}
OpenStackVolumeProviderProperties additionalProperties = entity.getAdditionalProperties();
if (additionalProperties != null) {
if (additionalProperties.getTenantName() != null) {
model.setTenantName(additionalProperties.getTenantName());
}
if (additionalProperties.getStoragePoolId() != null) {
DataCenter dataCenter = new DataCenter();
dataCenter.setId(additionalProperties.getStoragePoolId().toString());
model.setDataCenter(dataCenter);
}
}
return model;
}
Aggregations