Source:
<code>public static org.ovirt.engine.core.common.scheduling.AffinityGroup map(AffinityGroup model, org.ovirt.engine.core.common.scheduling.AffinityGroup template) { org.ovirt.engine.core.common.scheduling.AffinityGroup entity = template != null ? template : new org.ovirt.engine.core.common.scheduling.AffinityGroup(); if (model.isSetId()) { entity.setId(GuidUtils.asGuid(model.getId())); } if (model.isSetName()) { entity.setName(model.getName()); } if (model.isSetDescription()) { entity.setDescription(model.getDescription()); } if (model.isSetCluster() && model.getCluster().isSetId()) { entity.setClusterId(GuidUtils.asGuid(model.getCluster().getId())); } <START> <END> if (model.isSetHostsRule()) { AffinityRule hostsRule = model.getHostsRule(); if (hostsRule.isSetEnforcing()) { entity.setVdsEnforcing(hostsRule.isEnforcing()); } if (hostsRule.isSetPositive()) { entity.setVdsAffinityRule(hostsRule.isPositive() ? EntityAffinityRule.POSITIVE : EntityAffinityRule.NEGATIVE); } } if (model.isSetVmsRule()) { AffinityRule vmsRule = model.getVmsRule(); if (vmsRule.isSetEnabled()) { if (!vmsRule.isEnabled()) { entity.setVmAffinityRule(EntityAffinityRule.DISABLED); } else if (vmsRule.isSetPositive()) { entity.setVmAffinityRule(vmsRule.isPositive() ? EntityAffinityRule.POSITIVE : EntityAffinityRule.NEGATIVE); } } if (vmsRule.isSetEnforcing()) { entity.setVmEnforcing(vmsRule.isEnforcing()); } } else { if (model.isSetPositive()) { entity.setVmAffinityRule(model.isPositive() ? EntityAffinityRule.POSITIVE : EntityAffinityRule.NEGATIVE); } else { entity.setVmAffinityRule(EntityAffinityRule.DISABLED); } if (model.isSetEnforcing()) { entity.setVmEnforcing(model.isEnforcing()); } } return entity; }</code><technical_language>Yes, isSet checks for null</technical_language>

Target:
public static org.ovirt.engine.core.common.scheduling.AffinityGroup map(AffinityGroup model, org.ovirt.engine.core.common.scheduling.AffinityGroup template) { org.ovirt.engine.core.common.scheduling.AffinityGroup entity = template != null ? template : new org.ovirt.engine.core.common.scheduling.AffinityGroup(); if (model.isSetId()) { entity.setId(GuidUtils.asGuid(model.getId())); } if (model.isSetName()) { entity.setName(model.getName()); } if (model.isSetDescription()) { entity.setDescription(model.getDescription()); } if (model.isSetCluster() && model.getCluster().isSetId()) { entity.setClusterId(GuidUtils.asGuid(model.getCluster().getId())); } AffinityRule hostsRule = model.getHostsRule(); if (hostsRule != null) { if (hostsRule.isSetEnforcing()) { entity.setVdsEnforcing(hostsRule.isEnforcing()); } if (hostsRule.isSetPositive()) { entity.setVdsAffinityRule(hostsRule.isPositive() ? EntityAffinityRule.POSITIVE : EntityAffinityRule.NEGATIVE); } } AffinityRule vmsRule = model.getVmsRule(); if (vmsRule != null) { if (vmsRule.isSetEnabled()) { if (!vmsRule.isEnabled()) { entity.setVmAffinityRule(EntityAffinityRule.DISABLED); } else if (vmsRule.isSetPositive()) { entity.setVmAffinityRule(vmsRule.isPositive() ? EntityAffinityRule.POSITIVE : EntityAffinityRule.NEGATIVE); } } if (vmsRule.isSetEnforcing()) { entity.setVmEnforcing(vmsRule.isEnforcing()); } } else { if (model.isSetPositive()) { entity.setVmAffinityRule(model.isPositive() ? EntityAffinityRule.POSITIVE : EntityAffinityRule.NEGATIVE); } else { entity.setVmAffinityRule(EntityAffinityRule.DISABLED); } if (model.isSetEnforcing()) { entity.setVmEnforcing(model.isEnforcing()); } } return entity; }