Search in sources :

Example 1 with DisplayDisconnectAction

use of org.ovirt.engine.api.model.DisplayDisconnectAction in project ovirt-engine by oVirt.

the class VmBaseMapper method mapVmBaseModelToEntity.

/**
 * Common for VM and template
 */
protected static void mapVmBaseModelToEntity(org.ovirt.engine.core.common.businessentities.VmBase entity, VmBase model) {
    mapCommonModelToEntity(entity, model);
    if (model.isSetId()) {
        entity.setId(GuidUtils.asGuid(model.getId()));
    }
    if (model.isSetComment()) {
        entity.setComment(model.getComment());
    }
    if (model.isSetCluster() && model.getCluster().getId() != null) {
        entity.setClusterId(GuidUtils.asGuid(model.getCluster().getId()));
    }
    if (model.isSetOs()) {
        if (model.getOs().isSetType()) {
            entity.setOsId(VmMapper.mapOsType(model.getOs().getType()));
        }
        if (model.getOs().isSetKernel()) {
            entity.setKernelUrl(model.getOs().getKernel());
        }
        if (model.getOs().isSetInitrd()) {
            entity.setInitrdUrl(model.getOs().getInitrd());
        }
        if (model.getOs().isSetCmdline()) {
            entity.setKernelParams(model.getOs().getCmdline());
        }
    }
    if (model.isSetBios()) {
        if (model.getBios().isSetBootMenu()) {
            entity.setBootMenuEnabled(model.getBios().getBootMenu().isEnabled());
        }
    }
    if (model.isSetCpuShares()) {
        entity.setCpuShares(model.getCpuShares());
    }
    if (model.isSetDisplay()) {
        if (model.getDisplay().isSetAllowOverride()) {
            entity.setAllowConsoleReconnect(model.getDisplay().isAllowOverride());
        }
        if (model.getDisplay().isSetKeyboardLayout()) {
            String layout = model.getDisplay().getKeyboardLayout();
            if (layout.isEmpty()) {
                // uniquely represent unset keyboard layout as null
                layout = null;
            }
            entity.setVncKeyboardLayout(layout);
        }
        if (model.getDisplay().isSetFileTransferEnabled()) {
            entity.setSpiceFileTransferEnabled(model.getDisplay().isFileTransferEnabled());
        }
        if (model.getDisplay().isSetCopyPasteEnabled()) {
            entity.setSpiceCopyPasteEnabled(model.getDisplay().isCopyPasteEnabled());
        }
        if (model.getDisplay().isSetDisconnectAction()) {
            DisplayDisconnectAction action = DisplayDisconnectAction.fromValue(model.getDisplay().getDisconnectAction());
            entity.setConsoleDisconnectAction(map(action, null));
        }
    }
    if (model.isSetTimeZone()) {
        if (model.getTimeZone().isSetName()) {
            String timezone = model.getTimeZone().getName();
            if (timezone.isEmpty()) {
                // normalize default timezone representation
                timezone = null;
            }
            entity.setTimeZone(timezone);
        }
    }
    if (model.isSetOrigin()) {
        entity.setOrigin(VmMapper.map(model.getOrigin(), (OriginType) null));
    }
    if (model.isSetStateless()) {
        entity.setStateless(model.isStateless());
    }
    if (model.isSetDeleteProtected()) {
        entity.setDeleteProtected(model.isDeleteProtected());
    }
    if (model.isSetSso() && model.getSso().isSetMethods()) {
        entity.setSsoMethod(SsoMapper.map(model.getSso(), null));
    }
    if (model.isSetType()) {
        entity.setVmType(mapVmType(model.getType()));
    }
    if (model.isSetStorageErrorResumeBehaviour()) {
        entity.setResumeBehavior(mapResumeBehavior(model.getStorageErrorResumeBehaviour()));
    }
    if (model.isSetTunnelMigration()) {
        entity.setTunnelMigration(model.isTunnelMigration());
    }
    if (model.isSetSerialNumber()) {
        SerialNumberMapper.copySerialNumber(model.getSerialNumber(), entity);
    }
    if (model.isSetStartPaused()) {
        entity.setRunAndPause(model.isStartPaused());
    }
    if (model.isSetCpuProfile() && model.getCpuProfile().isSetId()) {
        entity.setCpuProfileId(GuidUtils.asGuid(model.getCpuProfile().getId()));
    }
    if (model.isSetCustomProperties()) {
        entity.setCustomProperties(CustomPropertiesParser.parse(model.getCustomProperties().getCustomProperties()));
    }
    if (model.isSetLargeIcon() && model.getLargeIcon().isSetId()) {
        entity.setLargeIconId(GuidUtils.asGuid(model.getLargeIcon().getId()));
    }
    if (model.isSetSmallIcon() && model.getSmallIcon().isSetId()) {
        entity.setSmallIconId(GuidUtils.asGuid(model.getSmallIcon().getId()));
    }
    if (model.isSetQuota() && model.getQuota().isSetId()) {
        entity.setQuotaId(GuidUtils.asGuid(model.getQuota().getId()));
    }
    if (model.isSetLease()) {
        entity.setLeaseStorageDomainId(StorageDomainLeaseMapper.map(model.getLease()));
    }
}
Also used : OriginType(org.ovirt.engine.core.common.businessentities.OriginType) DisplayDisconnectAction(org.ovirt.engine.api.model.DisplayDisconnectAction)

Aggregations

DisplayDisconnectAction (org.ovirt.engine.api.model.DisplayDisconnectAction)1 OriginType (org.ovirt.engine.core.common.businessentities.OriginType)1