1    /*
2     * Copyright 2009 :torweg free software group
3     *
4     * This program is free software: you can redistribute it and/or modify
5     * it under the terms of the GNU General Public License as published by
6     * the Free Software Foundation, either version 3 of the License, or
7     * (at your option) any later version.
8     * 
9     * This program is distributed in the hope that it will be useful,
10    * but WITHOUT ANY WARRANTY; without even the implied warranty of
11    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    * GNU General Public License for more details.
13    * 
14    * You should have received a copy of the GNU General Public License
15    * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16    *
17    */
18   package org.torweg.pulse.util.captcha;
19   
20   import javax.xml.bind.annotation.XmlAccessType;
21   import javax.xml.bind.annotation.XmlAccessorType;
22   import javax.xml.bind.annotation.XmlAttribute;
23   import javax.xml.bind.annotation.XmlElement;
24   import javax.xml.bind.annotation.XmlRootElement;
25   
26   /**
27    * Interface defining a response of a captcha-validation-request.
28    * 
29    * @author Daniel Dietz
30    * @version $Revision: 1407 $
31    */
32   @XmlRootElement(name = "captcha-response")
33   @XmlAccessorType(XmlAccessType.PROPERTY)
34   public abstract class AbstractCaptchaResponse {
35   
36       /**
37        * Returns whether the captcha has passed validation.
38        * 
39        * @return {@code true} if the captcha has passed validation,
40        *         {@code false} otherwise
41        */
42       @XmlAttribute(name = "valid", required = true)
43       public abstract boolean isValid();
44   
45       /**
46        * Returns the error-message if the captcha has not passed validation.
47        * 
48        * @return the error-message
49        */
50       @XmlElement(name = "message", required = false)
51       public abstract String getErrorMessage();
52   
53   }
54