001package com.credibledoc.substitution.reporting.context;
002
003import com.credibledoc.substitution.reporting.report.ReportRepository;
004import com.credibledoc.substitution.reporting.reportdocument.ReportDocumentRepository;
005import com.credibledoc.substitution.reporting.reportdocument.creator.ReportDocumentCreatorRepository;
006
007/**
008 * Contains instances of stateful objects (repositories) used in Reporting:
009 * <ul>
010 *     <li>{@link #reportDocumentCreatorRepository}</li>
011 *     <li>{@link #reportDocumentRepository}</li>
012 *     <li>{@link #reportRepository}</li>
013 * </ul>
014 * 
015 * @author Kyrylo Semenko
016 */
017public class ReportingContext {
018    /**
019     * Contains {@link com.credibledoc.substitution.reporting.reportdocument.creator.ReportDocumentCreator} instances.
020     */
021    private ReportDocumentCreatorRepository reportDocumentCreatorRepository;
022
023    /**
024     * Contains {@link com.credibledoc.substitution.reporting.reportdocument.ReportDocument} instances.
025     */
026    private ReportDocumentRepository reportDocumentRepository;
027
028    /**
029     * Contains {@link com.credibledoc.substitution.reporting.report.Report} instances.
030     */
031    private ReportRepository reportRepository;
032
033    @Override
034    public String toString() {
035        return "ReportingContext{" +
036            "reportDocumentCreatorRepository=" + reportDocumentCreatorRepository +
037            ", reportDocumentRepository=" + reportDocumentRepository +
038            ", reportRepository=" + reportRepository +
039            '}';
040    }
041
042    /**
043     * @return The {@link #reportDocumentCreatorRepository} field value.
044     */
045    public ReportDocumentCreatorRepository getReportDocumentCreatorRepository() {
046        return reportDocumentCreatorRepository;
047    }
048
049    /**
050     * @param reportDocumentCreatorRepository see the {@link #reportDocumentCreatorRepository} field description.
051     */
052    public void setReportDocumentCreatorRepository(ReportDocumentCreatorRepository reportDocumentCreatorRepository) {
053        this.reportDocumentCreatorRepository = reportDocumentCreatorRepository;
054    }
055
056    /**
057     * @return The {@link #reportDocumentRepository} field value.
058     */
059    public ReportDocumentRepository getReportDocumentRepository() {
060        return reportDocumentRepository;
061    }
062
063    /**
064     * @param reportDocumentRepository see the {@link #reportDocumentRepository} field description.
065     */
066    public void setReportDocumentRepository(ReportDocumentRepository reportDocumentRepository) {
067        this.reportDocumentRepository = reportDocumentRepository;
068    }
069
070    /**
071     * @return The {@link #reportRepository} field value.
072     */
073    public ReportRepository getReportRepository() {
074        return reportRepository;
075    }
076
077    /**
078     * @param reportRepository see the {@link #reportRepository} field description.
079     */
080    public void setReportRepository(ReportRepository reportRepository) {
081        this.reportRepository = reportRepository;
082    }
083
084    /**
085     * Create new instances of {@link #reportDocumentRepository} and {@link #reportDocumentCreatorRepository}.
086     * @return the current instance of {@link ReportingContext}.
087     */
088    public ReportingContext init() {
089        this.reportDocumentCreatorRepository = new ReportDocumentCreatorRepository();
090        this.reportDocumentRepository = new ReportDocumentRepository();
091        this.reportRepository = new ReportRepository();
092        return this;
093    }
094}