use of org.ovirt.engine.api.model.File in project ovirt-engine by oVirt.
the class FileMapper method map.
@Mapping(from = String.class, to = File.class)
public static File map(String entity, File template) {
File model = template != null ? template : new File();
model.setId(entity);
model.setName(entity);
return model;
}
use of org.ovirt.engine.api.model.File in project ovirt-engine by oVirt.
the class VmMapper method map.
@Mapping(from = VmPayload.class, to = Payload.class)
public static Payload map(VmPayload entity, Payload template) {
if (entity.getDeviceType() != null || entity.getFiles().isEmpty()) {
Payload model = template != null ? template : new Payload();
if (entity.getDeviceType() != null) {
org.ovirt.engine.api.model.VmDeviceType deviceType = map(entity.getDeviceType(), null);
if (deviceType != null) {
model.setType(deviceType);
}
}
model.setVolumeId(entity.getVolumeId());
if (entity.getFiles().size() > 0) {
model.setFiles(new Files());
for (Map.Entry<String, String> entry : entity.getFiles().entrySet()) {
File file = new File();
file.setName(entry.getKey());
file.setContent(entry.getValue());
model.getFiles().getFiles().add(file);
}
}
return model;
}
return null;
}
use of org.ovirt.engine.api.model.File in project ovirt-engine by oVirt.
the class BackendVmCdromResourceTest method getCdrom.
private Cdrom getCdrom(String path) {
Cdrom cdrom = new Cdrom();
cdrom.setFile(new File());
cdrom.getFile().setId(path);
return cdrom;
}
use of org.ovirt.engine.api.model.File in project ovirt-engine by oVirt.
the class BackendExternalVmImportsResourceTest method createVmImport.
private ExternalVmImport createVmImport() {
File file = new File();
file.setId(DRIVERS_ISO);
ExternalVmImport vmImport = new ExternalVmImport();
vmImport.setName(EXTERNAL_VM_NAME);
vmImport.setVm(new Vm());
vmImport.getVm().setName(CREATED_VM_NAME);
vmImport.setCluster(new Cluster());
vmImport.getCluster().setId(CLUSTER_ID.toString());
vmImport.setStorageDomain(new StorageDomain());
vmImport.getStorageDomain().setId(STORAGE_DOMAIN_ID.toString());
vmImport.setHost(new Host());
vmImport.getHost().setId(HOST_ID.toString());
vmImport.setSparse(true);
vmImport.setProvider(ExternalVmProviderType.VMWARE);
vmImport.setDriversIso(file);
vmImport.setUsername(USERNAME);
vmImport.setPassword(PASSWORD);
vmImport.setUrl(VMWARE_URL);
return vmImport;
}
use of org.ovirt.engine.api.model.File in project ovirt-engine by oVirt.
the class LinkHelperTest method testFileLinks.
@Test
public void testFileLinks() throws Exception {
File file = new File();
file.setId(FILE_ID);
file.setStorageDomain(new StorageDomain());
file.getStorageDomain().setId(STORAGE_DOMAIN_ID);
LinkHelper.addLinks(file);
assertEquals(FILE_HREF, file.getHref());
}
Aggregations