protected CpuProfiles mapCollection(List<org.ovirt.engine.core.common.businessentities.profiles.CpuProfile> entities) { CpuProfiles collection = new CpuProfiles(); Map<Guid, Qos> qosMap = new HashMap<>(); for (org.ovirt.engine.core.common.businessentities.profiles.CpuProfile entity : entities) { CpuProfile profile = populate(map(entity), entity); collection.getCpuProfiles().add(profile); if (entity.getQosId() != null) { qosMap.put(entity.getQosId(), profile.getQos()); } } handleQosDataCenterLinks(qosMap); for (CpuProfile cpuProfile : collection.getCpuProfiles()) { addLinks(cpuProfile); } return collection; }
@Test public void testGetByQos() { List<CpuProfile> allForQos = dao.getAllForQos(FixturesTool.QOS_ID_4); assertNotNull(allForQos); assertEquals(2, allForQos.size()); for (CpuProfile cpuProfile : allForQos) { assertEquals(FixturesTool.QOS_ID_4, cpuProfile.getQosId()); } }
public EditCpuProfileModel(IModel sourceModel, CpuProfile profile, Guid dataCenterId) { super(sourceModel, dataCenterId, profile.getQosId(), ActionType.UpdateCpuProfile); setTitle(ConstantsManager.getInstance().getConstants().cpuProfileTitle()); setHelpTag(HelpTag.edit_cpu_profile); setHashName("edit_cpu_profile"); //$NON-NLS-1$ setProfile(profile); getName().setEntity(profile.getName()); getDescription().setEntity(profile.getDescription()); }
@Mapping(from = org.ovirt.engine.core.common.businessentities.profiles.CpuProfile.class, to = CpuProfile.class) public static CpuProfile map(org.ovirt.engine.core.common.businessentities.profiles.CpuProfile entity, CpuProfile template) { CpuProfile model = template != null ? template : new CpuProfile(); if (entity.getId() != null) { model.setId(entity.getId().toString()); } if (entity.getName() != null) { model.setName(entity.getName()); } if (entity.getDescription() != null) { model.setDescription(entity.getDescription()); } if (entity.getClusterId() != null) { model.setCluster(new Cluster()); model.getCluster().setId(entity.getClusterId().toString()); } if (entity.getQosId() != null) { model.setQos(new Qos()); model.getQos().setId(entity.getQosId().toString()); } return model; } }