@Mapping(from = org.ovirt.engine.core.common.businessentities.storage.Disk.class, to = Disk.class) public static Disk map(org.ovirt.engine.core.common.businessentities.storage.Disk entity, Disk template) { Disk model = template != null ? template : new Disk(); // name is depreciated, use alias instead. model.setName(entity.getDiskAlias()); model.setAlias(entity.getDiskAlias()); if (entity.getId() != null) { model.setId(entity.getId().toString()); } model.setPropagateErrors(PropagateErrors.On == entity.getPropagateErrors()); model.setWipeAfterDelete(entity.isWipeAfterDelete()); model.setShareable(entity.isShareable()); model.setDescription(entity.getDiskDescription()); model.setLogicalName(entity.getLogicalName()); model.setStorageType(map(entity.getDiskStorageType())); if (entity.getDiskStorageType() == org.ovirt.engine.core.common.businessentities.storage.DiskStorageType.IMAGE || entity.getDiskStorageType() == org.ovirt.engine.core.common.businessentities.storage.DiskStorageType.CINDER || entity.getDiskStorageType() == org.ovirt.engine.core.common.businessentities.storage.DiskStorageType.MANAGED_BLOCK_STORAGE) { mapDiskImageToDiskFields((DiskImage) entity, model); } else { model.setLunStorage(StorageLogicalUnitMapper.map(((LunDisk) entity).getLun(), new HostStorage())); if (entity.getSgio() != null) { model.setSgio(map(entity.getSgio(), null)); } } model.setContentType(mapDiskContentType(entity.getContentType())); return model; }
@Override public void initialize() { commonInitialize(); getSizeExtend().setIsAvailable(false); getAlias().setEntity(getDisk().getDiskAlias()); getDescription().setEntity(getDisk().getDiskDescription()); getIsShareable().setEntity(getDisk().isShareable()); getIsWipeAfterDelete().setEntity(getDisk().isWipeAfterDelete()); getIsScsiPassthrough().setEntity(getDisk().isScsiPassthrough()); getIsSgIoUnfiltered().setEntity(getDisk().getSgio() == ScsiGenericIO.UNFILTERED); getIsReadOnly().setEntity(getVm() != null && getDiskVmElement().isReadOnly()); switch (getDisk().getDiskStorageType()) { case IMAGE: DiskImage diskImage = (DiskImage) getDisk(); getDiskStorageType().setEntity(DiskStorageType.IMAGE); getSize().setEntity((int) diskImage.getSizeInGigabytes()); getVolumeType().setSelectedItem(diskImage.getVolumeType()); break; } }
getIsWipeAfterDelete().setEntity(getDisk().isWipeAfterDelete()); getIsScsiPassthrough().setEntity(getDisk().isScsiPassthrough()); getIsSgIoUnfiltered().setEntity(getDisk().getSgio() == ScsiGenericIO.UNFILTERED); getIsReadOnly().setEntity(getDiskVmElement().isReadOnly()); getIsBootable().setEntity(getDiskVmElement().isBoot());