public Guid getDefaultIconId(boolean small) { final VmIconIdSizePair pair = osIdToDefaultIconIdMap.get(DEFAULT_OS_ID); if (pair != null) { return pair.get(small); } throw new RuntimeException("Icon of default operating system not found."); //$NON-NLS-1$ }
public Guid getOsDefaultIconId(Integer osId, boolean small) { if (osId == null) { return getDefaultIconId(small); } final VmIconIdSizePair pair = osIdToDefaultIconIdMap.get(osId); if (pair != null) { return pair.get(small); } return getDefaultIconId(small); }
@Override public OperatingSystemInfos list() { OsRepository repository = SimpleDependencyInjector.getInstance().get(OsRepository.class); final Map<Integer, VmIconIdSizePair> iconDefaults = getIconDefaults(); List<Integer> ids = repository.getOsIds(); Map<Integer, String> uniqueNames = repository.getUniqueOsNames(); Map<Integer, String> names = repository.getOsNames(); OperatingSystemInfos collection = new OperatingSystemInfos(); for (Integer id : ids) { OperatingSystemInfo model = new OperatingSystemInfo(); model.setId(id.toString()); if (iconDefaults.containsKey(id)) { final VmIconIdSizePair iconDefault = iconDefaults.get(id); model.setSmallIcon(IconHelper.createIcon(iconDefault.getSmall())); model.setLargeIcon(IconHelper.createIcon(iconDefault.getLarge())); } String uniqueName = uniqueNames.get(id); if (uniqueName != null) { model.setName(uniqueName); } String name = names.get(id); if (name != null) { model.setDescription(name); } model.setArchitecture(CPUMapper.map(repository.getArchitectureFromOS(id), null)); collection.getOperatingSystemInfos().add(addLinks(model)); } return collection; }