use of org.ovirt.engine.api.model.Icon in project ovirt-engine by oVirt.
the class IconHelper method createIcon.
public static Icon createIcon(Guid id) {
final Icon result = new Icon();
result.setId(id.toString());
return result;
}
use of org.ovirt.engine.api.model.Icon in project ovirt-engine by oVirt.
the class VmIconMapper method map.
@Mapping(from = VmIcon.class, to = Icon.class)
public static Icon map(VmIcon entity, Icon template) {
final Icon model = template != null ? template : new Icon();
model.setId(entity.getId().toString());
final Pair<String, String> typeAndData = entity.getTypeAndData();
model.setMediaType(typeAndData.getFirst());
model.setData(typeAndData.getSecond());
return model;
}
use of org.ovirt.engine.api.model.Icon in project ovirt-engine by oVirt.
the class IconTestHelpler method createIconWithData.
public static Icon createIconWithData() {
final Icon icon = new Icon();
icon.setMediaType(MEDIA_TYPE);
icon.setData(DATA_URL);
return icon;
}
use of org.ovirt.engine.api.model.Icon in project ovirt-engine by oVirt.
the class IconTestHelpler method createIcon.
public static Icon createIcon(Guid id) {
final Icon icon = new Icon();
icon.setId(id.toString());
return icon;
}
use of org.ovirt.engine.api.model.Icon in project ovirt-engine by oVirt.
the class VmBaseMapper method mapVmBaseEntityToModel.
/**
* Common for VM and template
*/
protected static void mapVmBaseEntityToModel(VmBase model, org.ovirt.engine.core.common.businessentities.VmBase entity) {
mapCommonEntityToModel(model, entity);
model.setComment(entity.getComment());
if (entity.getClusterId() != null) {
Cluster cluster = new Cluster();
cluster.setId(entity.getClusterId().toString());
model.setCluster(cluster);
}
if (entity.getVmType() != null) {
model.setType(mapVmType(entity.getVmType()));
}
if (entity.getResumeBehavior() != null) {
model.setStorageErrorResumeBehaviour(mapResumeBehavior(entity.getResumeBehavior()));
}
if (entity.getOrigin() != null) {
model.setOrigin(map(entity.getOrigin(), null));
}
model.setBios(new Bios());
model.getBios().setBootMenu(new BootMenu());
model.getBios().getBootMenu().setEnabled(entity.isBootMenuEnabled());
if (entity.getTimeZone() != null) {
model.setTimeZone(new TimeZone());
model.getTimeZone().setName(entity.getTimeZone());
}
if (entity.getVmInit() != null && entity.getVmInit().getDomain() != null && StringUtils.isNotBlank(entity.getVmInit().getDomain())) {
Domain domain = new Domain();
domain.setName(entity.getVmInit().getDomain());
model.setDomain(domain);
}
model.setStateless(entity.isStateless());
model.setDeleteProtected(entity.isDeleteProtected());
model.setSso(SsoMapper.map(entity.getSsoMethod(), null));
model.setTunnelMigration(entity.getTunnelMigration());
if (entity.getSerialNumberPolicy() != null) {
model.setSerialNumber(SerialNumberMapper.map(entity, null));
}
model.setStartPaused(entity.isRunAndPause());
if (entity.getCpuProfileId() != null) {
CpuProfile cpuProfile = new CpuProfile();
cpuProfile.setId(entity.getCpuProfileId().toString());
model.setCpuProfile(cpuProfile);
}
if (!StringUtils.isEmpty(entity.getCustomProperties())) {
CustomProperties hooks = new CustomProperties();
hooks.getCustomProperties().addAll(CustomPropertiesParser.parse(entity.getCustomProperties(), false));
model.setCustomProperties(hooks);
}
model.setCpuShares(entity.getCpuShares());
if (entity.getLargeIconId() != null) {
if (!model.isSetLargeIcon()) {
model.setLargeIcon(new Icon());
}
model.getLargeIcon().setId(entity.getLargeIconId().toString());
}
if (entity.getSmallIconId() != null) {
if (!model.isSetSmallIcon()) {
model.setSmallIcon(new Icon());
}
model.getSmallIcon().setId(entity.getSmallIconId().toString());
}
if (entity.getQuotaId() != null) {
Quota quota = new Quota();
quota.setId(entity.getQuotaId().toString());
model.setQuota(quota);
}
model.setLease(StorageDomainLeaseMapper.map(entity.getLeaseStorageDomainId()));
}
Aggregations