View Javadoc
1   /*
2    * This file is part of ***  M y C o R e  ***
3    * See http://www.mycore.de/ for details.
4    *
5    * MyCoRe is free software: you can redistribute it and/or modify
6    * it under the terms of the GNU General Public License as published by
7    * the Free Software Foundation, either version 3 of the License, or
8    * (at your option) any later version.
9    *
10   * MyCoRe is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   * GNU General Public License for more details.
14   *
15   * You should have received a copy of the GNU General Public License
16   * along with MyCoRe.  If not, see <http://www.gnu.org/licenses/>.
17   */
18  package org.mycore.access.facts.condition;
19  
20  import org.jdom2.Element;
21  import org.mycore.access.facts.MCRFactsHolder;
22  import org.mycore.access.facts.model.MCRCondition;
23  
24  /**
25   * This is the base implementation for a condition.
26   * 
27   * It is the super class for MCRCombinedCondition and MCRFactCondition.
28   * 
29   * @author Robert Stephan
30   *
31   */
32  public abstract class MCRAbstractCondition implements MCRCondition {
33  
34      private Element boundElement = null;
35  
36      private String type;
37  
38      private boolean debug;
39  
40      /** 
41       * implementors of this method should call super.parse(xml) to bind the XML element to the condition
42       */
43      public void parse(Element xml) {
44          boundElement = xml;
45          type = xml.getName();
46      }
47  
48      public Element getBoundElement() {
49          return boundElement;
50      }
51  
52      public String getType() {
53          return type;
54      }
55  
56      public boolean isDebug() {
57          return debug;
58      }
59  
60      public void setDebug(boolean b) {
61          this.debug = b;
62  
63      }
64  
65      public abstract boolean matches(MCRFactsHolder facts);
66  }