use of org.ovirt.engine.api.model.StorageFormat in project ovirt-engine by oVirt.
the class StorageFormatMapperTest method testMapping.
@Test
public void testMapping() {
StorageFormat storageFormat = StorageFormatMapper.map(StorageFormatType.V1, null);
assertEquals(StorageFormat.V1, storageFormat);
StorageFormatType storageFormatType = StorageFormatMapper.map(storageFormat, null);
assertEquals(StorageFormatType.V1, storageFormatType);
storageFormat = StorageFormatMapper.map(StorageFormatType.V2, null);
assertEquals(StorageFormat.V2, storageFormat);
storageFormatType = StorageFormatMapper.map(storageFormat, null);
assertEquals(StorageFormatType.V2, storageFormatType);
}
use of org.ovirt.engine.api.model.StorageFormat in project ovirt-engine by oVirt.
the class DataCenterMapper method map.
@Mapping(from = StoragePool.class, to = DataCenter.class)
public static DataCenter map(StoragePool entity, DataCenter template) {
DataCenter model = template != null ? template : new DataCenter();
model.setId(entity.getId().toString());
model.setName(entity.getName());
model.setLocal(entity.isLocal());
if (!StringUtils.isEmpty(entity.getdescription())) {
model.setDescription(entity.getdescription());
}
if (!StringUtils.isEmpty(entity.getComment())) {
model.setComment(entity.getComment());
}
if (entity.getStatus() != null) {
model.setStatus(mapDataCenterStatus(entity.getStatus()));
}
if (entity.getCompatibilityVersion() != null) {
model.setVersion(VersionMapper.map(entity.getCompatibilityVersion()));
}
if (entity.getStoragePoolFormatType() != null) {
StorageFormat storageFormat = StorageFormatMapper.map(entity.getStoragePoolFormatType(), null);
if (storageFormat != null) {
model.setStorageFormat(storageFormat);
}
}
if (entity.getMacPoolId() != null) {
model.setMacPool(new MacPool());
model.getMacPool().setId(entity.getMacPoolId().toString());
}
if (entity.getQuotaEnforcementType() != null) {
model.setQuotaMode(map(entity.getQuotaEnforcementType()));
}
return model;
}
Aggregations