class SimpleImaBaselineGenerator {

    public final SimpleImaBaseline generateBaselineFromIMAReport(
            final String baselineName, final IMAReport report)
            throws IMABaselineGeneratorException, NullPointerException {

        IMABaselineRecord imaBaselineRecord;

        if (baselineName == null) {
            LOGGER.error("null argument: baselineName");
            throw new NullPointerException("baselineName");
        }

        if (report == null) {
            LOGGER.error("null argument: report");
            throw new NullPointerException("report");
        }

        if (report.getRecords().size() < 1) {
            String msg;
            msg = "no IMA records in the report";
            LOGGER.error(msg);
            throw new IMABaselineGeneratorException(msg);
        }

        SimpleImaBaseline newBaseline = new SimpleImaBaseline(baselineName);
        for (IMAMeasurementRecord record : report.getRecords()) {
            imaBaselineRecord = new IMABaselineRecord(record.getPath(), record.getHash());
            newBaseline.addToBaseline(imaBaselineRecord);
        }

        return newBaseline;
    }

}