001 /* This file is part of the project "Hilbert II" - http://www.qedeq.org
002 *
003 * Copyright 2000-2011, Michael Meyling <mime@qedeq.org>.
004 *
005 * "Hilbert II" is free software; you can redistribute
006 * it and/or modify it under the terms of the GNU General Public
007 * License as published by the Free Software Foundation; either
008 * version 2 of the License, or (at your option) any later version.
009 *
010 * This program is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
013 * GNU General Public License for more details.
014 */
015
016 package org.qedeq.kernel.bo.module;
017
018 import org.qedeq.kernel.se.common.DefaultSourceFileExceptionList;
019 import org.qedeq.kernel.se.common.SourceFileExceptionList;
020
021 /**
022 * Holds the results from a plugin execution.
023 *
024 * @author Michael Meyling
025 */
026 public class PluginResults {
027
028 /** Errors that occurred. */
029 private DefaultSourceFileExceptionList errors;
030
031 /** Warnings that occurred. */
032 private DefaultSourceFileExceptionList warnings;
033
034 /**
035 * Creates a new result container.
036 */
037 public PluginResults() {
038 errors = new DefaultSourceFileExceptionList();
039 warnings = new DefaultSourceFileExceptionList();
040 }
041
042 /**
043 * Clear all warnings and errors.
044 */
045 public void clear() {
046 errors.clear();
047 warnings.clear();
048 }
049
050 /**
051 * Get list of all errors.
052 *
053 * @return Error list. Is never <code>null</code>.
054 */
055 public SourceFileExceptionList getErrors() {
056 return errors;
057 }
058
059 /**
060 * Add errors.
061 *
062 * @param errors Add these errors.
063 */
064 public void addErrors(final SourceFileExceptionList errors) {
065 this.errors.add(errors);
066 }
067
068 /**
069 * Get list of all warnings.
070 *
071 * @return Warnings list. Is never <code>null</code>.
072 */
073 public SourceFileExceptionList getWarnings() {
074 return warnings;
075 }
076
077 /**
078 * Add warnings.
079 *
080 * @param warnings Add these warnings.
081 */
082 public void addWarnings(final SourceFileExceptionList warnings) {
083 this.warnings.add(warnings);
084 }
085
086 /**
087 * Are there any errors?
088 *
089 * @return Errors exist.
090 */
091 public boolean hasErrors() {
092 return errors.size() > 0;
093 }
094
095 /**
096 * Are there any warnings.
097 *
098 * @return Warnings exist.
099 */
100 public boolean hasWarnings() {
101 return warnings.size() > 0;
102 }
103
104 }
|