class SeverityPieChart {

    public PieChartModel create(final Report report) {
        PieChartModel model = new PieChartModel(Messages.Severities_Name());

        ImmutableSet<Severity> predefinedSeverities = Severity.getPredefinedValues();
        for (Severity severity : predefinedSeverities) {
            int total = report.getSizeOf(severity);
            if (total > 0 || !severity.equals(Severity.ERROR)) {
                model.add(new PieData(LocalizedSeverity.getLocalizedString(severity), total),
                        SeverityPalette.getColor(severity));
            }
        }

        return model;
    }

}