use of org.ovirt.engine.api.model.OpenStackImageProvider in project ovirt-engine by oVirt.
the class BackendOpenStackImageResource method addParents.
@Override
protected OpenStackImage addParents(OpenStackImage image) {
OpenStackImageProvider provider = new OpenStackImageProvider();
provider.setId(providerId);
image.setOpenstackImageProvider(provider);
return super.addParents(image);
}
use of org.ovirt.engine.api.model.OpenStackImageProvider in project ovirt-engine by oVirt.
the class V3OpenStackImageProviderInAdapter method adapt.
@Override
public OpenStackImageProvider adapt(V3OpenStackImageProvider from) {
OpenStackImageProvider to = new OpenStackImageProvider();
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.isSetTenantName()) {
to.setTenantName(from.getTenantName());
}
if (from.isSetUrl()) {
to.setUrl(from.getUrl());
}
if (from.isSetUsername()) {
to.setUsername(from.getUsername());
}
return to;
}
use of org.ovirt.engine.api.model.OpenStackImageProvider in project ovirt-engine by oVirt.
the class BackendOpenStackImageProviderResourceTest method testConflictedUpdate.
@Test
public void testConflictedUpdate() throws Exception {
setUriInfo(setUpBasicUriExpectations());
setUpGetEntityExpectations(1);
OpenStackImageProvider model = getModel(1);
model.setId(GUIDS[1].toString());
try {
resource.update(model);
fail("expected WebApplicationException");
} catch (WebApplicationException wae) {
verifyImmutabilityConstraint(wae);
}
}
use of org.ovirt.engine.api.model.OpenStackImageProvider 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.model.OpenStackImageProvider in project ovirt-engine by oVirt.
the class BackendOpenStackImageProviderResourceTest method getModel.
private OpenStackImageProvider getModel(int index) {
OpenStackImageProvider model = new OpenStackImageProvider();
model.setName(NAMES[index]);
model.setDescription(DESCRIPTIONS[index]);
return model;
}
Aggregations