private void initSupportedArchitectures() { Collection<ArchitectureType> archsWithSupportingCpus = new HashSet<>(); archsWithSupportingCpus.add(ArchitectureType.undefined); for (ServerCpu cpu: getCPU().getItems()) { if (cpu != null) { archsWithSupportingCpus.add(cpu.getArchitecture()); } } getArchitecture().setItems(archsWithSupportingCpus); }
@Mapping(from = ServerCpu.class, to = Cpu.class) public static Cpu map(ServerCpu entity, Cpu template) { Cpu model = template != null ? template : new Cpu(); model.setName(entity.getCpuName()); model.setLevel(entity.getLevel()); model.setArchitecture(map(entity.getArchitecture(), null)); return model; }
private void filterCpuTypeByArchitecture() { final ArchitectureType selectedArchitecture = getArchitecture().getSelectedItem(); final FilteredListModel.Filter<ServerCpu> filter = selectedArchitecture == null || selectedArchitecture.equals(ArchitectureType.undefined) ? cpu -> cpu == null || cpu.getLevel() > 0 : cpu -> cpu != null && selectedArchitecture.equals(cpu.getArchitecture()) && cpu.getLevel() > 0; getCPU().filterItems(filter); }
private void updateMigrateOnError() { ServerCpu cpu = getCPU().getSelectedItem(); Version version = getVersion().getSelectedItem(); if (version == null) { return; } if (cpu == null || cpu.getArchitecture() == null) { return; } getMigrateOnErrorOption_NO().setIsAvailable(true); if (AsyncDataProvider.getInstance().isMigrationSupported(cpu.getArchitecture(), version)) { getMigrateOnErrorOption_YES().setIsAvailable(true); getMigrateOnErrorOption_HA_ONLY().setIsAvailable(true); } else { getMigrateOnErrorOption_YES().setIsAvailable(false); getMigrateOnErrorOption_HA_ONLY().setIsAvailable(false); setMigrateOnErrorOption(MigrateOnErrorOptions.NO); } }
public ClusterLevel makeClusterLevel(String version) { ClusterLevel level = new ClusterLevel(); level.setId(version); // Not exposing CPU list filtered queries: if (!isFiltered()) { CpuTypes cpuTypes = new CpuTypes(); for (ServerCpu serverCpu : getServerCpuList(version)) { CpuType cpuType = new CpuType(); cpuType.setName(serverCpu.getCpuName()); cpuType.setLevel(serverCpu.getLevel()); cpuType.setArchitecture(CPUMapper.map(serverCpu.getArchitecture(), null)); cpuTypes.getCpuTypes().add(cpuType); } level.setCpuTypes(cpuTypes); } // Add permits: Permits permits = new Permits(); for (ActionGroup actionGroup : getActionGroups()) { Permit permit = PermitMapper.map(actionGroup, null); permits.getPermits().add(permit); } level.setPermits(permits); return LinkHelper.addLinks(level); }
if (cpu.getArchitecture() == getEntity().getArchitecture()) { filteredCpus.add(cpu);