/** * Map the storage pool (i.e. datacenter entity) to a Cluster instance * with the same compatibility version */ protected Cluster map(StoragePool pool) { return getMapper(StoragePool.class, Cluster.class).map(pool, null); }
protected ArrayList<ActionGroup> mapPermits(List<Permit> permits) { ArrayList<ActionGroup> actionGroups = new ArrayList<>(); Mapper<Permit, ActionGroup> mapper = getMapper(Permit.class, ActionGroup.class); actionGroups.addAll(permits.stream().map(p -> mapper.map(p, (ActionGroup) null)).collect(Collectors.toList())); return actionGroups; } }
protected R map(Q entity, R template) { return getMapper(entityType, modelType).map(entity, template); }
protected StorageServerConnections mapToCnx(StorageDomain model) { return getMapper(StorageDomain.class, StorageServerConnections.class).map(model, null); }
protected Q map(R model, Q template) { return getMapper(modelType, entityType).map(model, template); }
private UpdateHostNicVfsConfigParameters prepareUpdateHostNicVfsConfigParameters(Action action, HostNicVfsConfig vfsConfig) { final Mapper<HostNicVfsConfig, UpdateHostNicVfsConfigParameters> entityMapper = getMapper(HostNicVfsConfig.class, UpdateHostNicVfsConfigParameters.class); UpdateHostNicVfsConfigParameters params = entityMapper.map(vfsConfig, new UpdateHostNicVfsConfigParameters()); final Mapper<org.ovirt.engine.api.model.HostNicVirtualFunctionsConfiguration, UpdateHostNicVfsConfigParameters> userInputMapper = getMapper(org.ovirt.engine.api.model.HostNicVirtualFunctionsConfiguration.class, UpdateHostNicVfsConfigParameters.class); userInputMapper.map(action.getVirtualFunctionsConfiguration(), params); return params; }
private List<GlusterBrickEntity> mapBricks(Guid volumeId, GlusterBricks glusterBricks) { List<GlusterBrickEntity> bricks = new ArrayList<>(); if (glusterBricks.getGlusterBricks().size() > 0) { for (GlusterBrick brick : glusterBricks.getGlusterBricks()) { GlusterBrickEntity brickEntity = getMapper(GlusterBrick.class, GlusterBrickEntity.class).map(brick, null); brickEntity.setVolumeId(volumeId); bricks.add(brickEntity); } } return bricks; }
private void mapBricks(GlusterVolume volume, GlusterVolumeEntity volumeEntity) { List<GlusterBrickEntity> bricks = new ArrayList<>(); for(GlusterBrick brick : volume.getBricks().getGlusterBricks()) { bricks.add(getMapper(GlusterBrick.class, GlusterBrickEntity.class).map(brick, null)); } volumeEntity.setBricks(bricks); }
@Override public ActionParametersBase getParameters(Network incoming, org.ovirt.engine.core.common.businessentities.network.Network entity) { org.ovirt.engine.core.common.businessentities.network.Network updated = getMapper(modelType, org.ovirt.engine.core.common.businessentities.network.Network.class).map(incoming, entity); return new AddNetworkStoragePoolParameters(entity.getDataCenterId(), updated); } }
@Override public ActionParametersBase getParameters( Network incoming, org.ovirt.engine.core.common.businessentities.network.Network entity) { org.ovirt.engine.core.common.businessentities.network.Network updated = getMapper( Network.class, org.ovirt.engine.core.common.businessentities.network.Network.class ).map(incoming, entity); return new AddNetworkStoragePoolParameters(entity.getDataCenterId(), updated); } }
@Override public Response add(GraphicsConsole console) { GraphicsDevice device = getMapper(GraphicsConsole.class, GraphicsDevice.class).map(console, null); device.setVmId(guid); ActionReturnValue res = doCreateEntity(ActionType.AddGraphicsAndVideoDevices, createAddGraphicsDeviceParams(device)); if (res != null && res.getSucceeded()) { return BackendGraphicsConsoleHelper.find(console, this::list); } throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).build()); }
@Override public Response add(GraphicsConsole console) { GraphicsDevice device = getMapper(GraphicsConsole.class, GraphicsDevice.class).map(console, null); device.setVmId(guid); ActionReturnValue res = doCreateEntity(ActionType.AddGraphicsAndVideoDevices, createAddGraphicsDeviceParams(device)); if (res != null && res.getSucceeded()) { return BackendGraphicsConsoleHelper.find(console, this::list); } throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).build()); }
Host addHostedEngineIfConfigured(Host host, VDS entity) { /* Add entity data only if the hosted engine agent is configured on this host */ if (entity.getHighlyAvailableIsConfigured()) { HostedEngine hostedEngine = getMapper(VDS.class, HostedEngine.class).map(entity, null); host.setHostedEngine(hostedEngine); } return host; }
private Hooks mapCollection(Map<String, Map<String, Map<String, String>>> hooksMap) { Hooks hooks = getMapper(Map.class, Hooks.class).map(hooksMap, null); for (Hook hook : hooks.getHooks()) { addLinks(hook); } return hooks; }
@Override public Response add(GraphicsConsole console) { GraphicsDevice device = getMapper(GraphicsConsole.class, GraphicsDevice.class).map(console, null); device.setVmId(guid); ActionReturnValue res = doCreateEntity(ActionType.AddGraphicsAndVideoDevices, createAddGraphicsDeviceParams(device)); if (res != null && res.getSucceeded()) { return BackendGraphicsConsoleHelper.find(console, this::list); } throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).build()); }
private Snapshot map(org.ovirt.engine.core.common.businessentities.Snapshot entity, Snapshot template) { return getMapper(org.ovirt.engine.core.common.businessentities.Snapshot.class, Snapshot.class).map(entity, template); }
@Override public IscsiBond update(IscsiBond iscsiBond) { return performUpdate(iscsiBond, new QueryIdResolver<>(QueryType.GetIscsiBondById, IdQueryParameters.class), ActionType.EditIscsiBond, (incoming, entity) -> new EditIscsiBondParameters( getMapper(modelType, org.ovirt.engine.core.common.businessentities.IscsiBond.class).map(incoming, entity) )); }
public HostStorages list() { HostStorages ret = new HostStorages(); for (LUNs lun : getLogicalUnits()) { HostStorage storage = map(lun); List<StorageServerConnections> lunConnections = lun.getLunConnections(); if (lunConnections!=null && !lunConnections.isEmpty()) { getMapper(StorageServerConnections.class, LogicalUnit.class).map(lunConnections.get(0), storage.getLogicalUnits().getLogicalUnits().get(0)); } ret.getHostStorages().add(addLinks(storage)); } return ret; }
public CreateOrUpdateBond mapBonds(BusinessEntityMap<Bond> bonds, HostNic model) { Mapper<HostNic, Bond> hostNicMapper = getMapper(HostNic.class, Bond.class); Bond bond; if (model.isSetId()) { Guid nicId = asGuid(model.getId()); bond = hostNicMapper.map(model, bonds.get(nicId)); } else { Bond template = model.isSetName() ? bonds.get(model.getName()) : null; bond = hostNicMapper.map(model, template); } return CreateOrUpdateBond.fromBond(bond); }
private void prepareImagesForCloneFromSnapshotParams(DiskAttachments disksAttachments, Map<Guid, DiskImage> imagesFromConfiguration) { if (disksAttachments.getDiskAttachments() != null) { for (DiskAttachment diskAttachment : disksAttachments.getDiskAttachments()) { Disk disk = diskAttachment.getDisk(); if (disk != null && disk.isSetImageId()) { DiskImage diskImageFromConfig = imagesFromConfiguration.get(asGuid(disk.getImageId())); DiskImage diskImage = (DiskImage) getMapper(Disk.class, org.ovirt.engine.core.common.businessentities.storage.Disk.class).map(disk, diskImageFromConfig); imagesFromConfiguration.put(diskImage.getId(), diskImage); } } } }