class SimpleImaBaselineGenerator {

    public final SimpleImaBaseline generateBaselineFromIntegrityReport(
            final String baselineName, final IntegrityReport 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.contains(IMAReport.class)) {
            String msg = "no IMA report in the integrity report";
            LOGGER.error(msg);
            throw new IMABaselineGeneratorException(msg);
        }

        IMAReport imaReport = report.extractReport(IMAReport.class);
        if (imaReport.getRecords().size() < 1) {
            String msg = "no IMA records in the report";
            LOGGER.error(msg);
            throw new IMABaselineGeneratorException(msg);
        }
        SimpleImaBaseline newBaseline = new SimpleImaBaseline(baselineName);
        for (IMAMeasurementRecord imaRecord : imaReport.getRecords()) {
            imaBaselineRecord = new IMABaselineRecord(imaRecord.getPath(),
                    imaRecord.getHash());
            newBaseline.addToBaseline(imaBaselineRecord);
        }
        return newBaseline;
    }

}