View Javadoc

1   /*
2    * Copyright 2012-2013 smartics, Kronseder & Reiner GmbH
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package de.smartics.properties.report.data;
17  
18  import java.util.List;
19  
20  import de.smartics.properties.api.core.context.alias.AliasTraverser;
21  import de.smartics.properties.report.app.ReportException;
22  
23  /**
24   * Sink to accept report items. Implementations may either store that
25   * information in memory or write it to a store.
26   */
27  public interface PropertyReport
28  {
29    // ********************************* Fields *********************************
30  
31    // --- constants ------------------------------------------------------------
32  
33    // ****************************** Initializer *******************************
34  
35    // ****************************** Inner Classes *****************************
36  
37    // ********************************* Methods ********************************
38  
39    // --- get&set --------------------------------------------------------------
40  
41    // --- business -------------------------------------------------------------
42  
43    /**
44     * Passes a report set document information to the report.
45     *
46     * @param reportSet the report set to handle.
47     * @throws ReportException on any problem that prevents the report to digest
48     *           the given set.
49     */
50    void handle(PropertyReportSet reportSet) throws ReportException;
51  
52    /**
53     * Passes a report item to the report.
54     *
55     * @param item the report item to handle.
56     * @throws ReportException on any problem that prevents the report to digest
57     *           the given item.
58     */
59    void handle(PropertyReportItem item) throws ReportException;
60  
61    // ... dealing with problems ................................................
62  
63    /**
64     * Reports a problem encountered while analyzing for report items.
65     *
66     * @param problem a description to the problem encountered.
67     */
68    void addProblem(ReportProblem problem);
69  
70    /**
71     * Checks if there are reported problems.
72     *
73     * @return <code>true</code> if at least one report problem is reported,
74     *         <code>false</code> if there are none.
75     */
76    boolean hasProblems();
77  
78    /**
79     * Returns the list of problems encountered while parsing sources and fetching
80     * report information.
81     *
82     * @return the list of problems encountered while parsing sources and fetching
83     *         report information.
84     */
85    List<ReportProblem> getProblems();
86  
87    /**
88     * Allows to traverse the collected aliases.
89     *
90     * @param traverser the traverser to traverse the aliases.
91     */
92    void traverseAliases(final AliasTraverser traverser);
93  
94    // --- object basics --------------------------------------------------------
95  }