@Mapping(from = org.ovirt.engine.core.common.job.ExternalSystemType.class, to = ExternalSystemType.class) public static ExternalSystemType map(org.ovirt.engine.core.common.job.ExternalSystemType type) { switch (type) { case VDSM: return ExternalSystemType.VDSM; case GLUSTER: return ExternalSystemType.GLUSTER; default: return null; } }
@Test public void testRoundtrip() throws Exception { F model = fromClass.cast(populate(fromClass)); model = postPopulate(model); Mapper<F, T> out = mappingLocator.getMapper(fromClass, toClass); Mapper<I, F> back = mappingLocator.getMapper(inverseClass, fromClass); T to = out.map(model, null); I inverse = getInverse(to); F transform = back.map(inverse, getModel(null)); verify(model, transform); }
public static void mapFromModel(RegistrationConfiguration registrationConfiguration, ImportFromConfParameters params) { if (registrationConfiguration != null) { setParamsWithRegistrationConfigurationMappings(registrationConfiguration, params); } }
@Mapping(from = GraphicsType.class, to = DisplayType.class) public static DisplayType map(GraphicsType graphicsType, DisplayType displayType) { if (graphicsType == GraphicsType.SPICE) { return DisplayType.SPICE; } else if (graphicsType == GraphicsType.VNC) { return DisplayType.VNC; } return null; }
@Mapping(from = DiskFormat.class, to = String.class) public static VolumeFormat map(DiskFormat diskFormat, VolumeFormat template) { switch (diskFormat) { case COW: return VolumeFormat.COW; case RAW: return VolumeFormat.RAW; default: return VolumeFormat.Unassigned; } }
@Mapping(from = org.ovirt.engine.core.common.businessentities.gluster.GlusterHookStage.class, to = HookStage.class) public static HookStage map(org.ovirt.engine.core.common.businessentities.gluster.GlusterHookStage hookStage, HookStage template) { switch (hookStage) { case POST: return HookStage.POST; case PRE: return HookStage.PRE; default: return null; } }
@Mapping(from = org.ovirt.engine.core.common.businessentities.gluster.TransportType.class, to = TransportType.class) public static TransportType map(org.ovirt.engine.core.common.businessentities.gluster.TransportType transportType, TransportType template) { switch (transportType) { case TCP: return TransportType.TCP; case RDMA: return TransportType.RDMA; default: return null; } }
@Mapping(from = org.ovirt.engine.api.model.CloudInitNetworkProtocol.class, to = CloudInitNetworkProtocol.class) public static CloudInitNetworkProtocol map(org.ovirt.engine.api.model.CloudInitNetworkProtocol protocol) { switch (protocol) { case ENI: return CloudInitNetworkProtocol.ENI; case OPENSTACK_METADATA: return CloudInitNetworkProtocol.OPENSTACK_METADATA; default: return null; } }
@Mapping(from = CloudInitNetworkProtocol.class, to = org.ovirt.engine.api.model.CloudInitNetworkProtocol.class) public static org.ovirt.engine.api.model.CloudInitNetworkProtocol map(CloudInitNetworkProtocol protocol) { switch (protocol) { case ENI: return ENI; case OPENSTACK_METADATA: return OPENSTACK_METADATA; default: return null; } }
@Mapping(from = VmPoolType.class, to = org.ovirt.engine.core.common.businessentities.VmPoolType.class) public static org.ovirt.engine.core.common.businessentities.VmPoolType map( VmPoolType vmPoolType, org.ovirt.engine.core.common.businessentities.VmPoolType incoming) { switch (vmPoolType) { case AUTOMATIC: return org.ovirt.engine.core.common.businessentities.VmPoolType.AUTOMATIC; case MANUAL: return org.ovirt.engine.core.common.businessentities.VmPoolType.MANUAL; default: return null; } }
@Mapping(from = org.ovirt.engine.core.common.businessentities.storage.ScsiGenericIO.class, to = ScsiGenericIO.class) public static ScsiGenericIO map(org.ovirt.engine.core.common.businessentities.storage.ScsiGenericIO scsiGenericIO, ScsiGenericIO template) { switch (scsiGenericIO) { case FILTERED: return ScsiGenericIO.FILTERED; case UNFILTERED: return ScsiGenericIO.UNFILTERED; default: return null; } }
@Mapping(from = org.ovirt.engine.core.common.businessentities.StorageDomainType.class, to = DiskStorageType.class) public static DiskStorageType map(org.ovirt.engine.core.common.businessentities.StorageDomainType storageDomainType) { switch (storageDomainType) { case Volume: return DiskStorageType.CINDER; case ManagedBlockStorage: return DiskStorageType.MANAGED_BLOCK_STORAGE; default: return DiskStorageType.IMAGE; } }
@Mapping(from = DisplayType.class, to = GraphicsType.class) public static GraphicsType map(DisplayType displayType, GraphicsType graphicsType) { switch (displayType) { case SPICE: return GraphicsType.SPICE; case VNC: return GraphicsType.VNC; default: return null; } }
@Mapping(from = DisplayType.class, to = org.ovirt.engine.core.common.businessentities.DisplayType.class) public static org.ovirt.engine.core.common.businessentities.DisplayType mapDisplayType(DisplayType type, org.ovirt.engine.core.common.businessentities.DisplayType incoming) { switch (type) { case VNC: return org.ovirt.engine.core.common.businessentities.DisplayType.vga; case SPICE: return org.ovirt.engine.core.common.businessentities.DisplayType.qxl; default: return null; } } }
@Mapping(from = VolumeFormat.class, to = DiskFormat.class) public static DiskFormat map(VolumeFormat volumeFormat, DiskFormat template) { switch (volumeFormat) { case COW: return DiskFormat.COW; case RAW: return DiskFormat.RAW; default: return null; } }
@Mapping(from = org.ovirt.engine.core.common.businessentities.gluster.GlusterHookContentType.class, to = HookContentType.class) public static HookContentType map(org.ovirt.engine.core.common.businessentities.gluster.GlusterHookContentType hookContentType, HookContentType template) { switch (hookContentType) { case BINARY: return HookContentType.BINARY; case TEXT: return HookContentType.TEXT; default: return null; } }