Project

General

Profile

Download (1.82 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2018 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.exception;
10

    
11
/**
12
 * This Exception is for throwing an exception if a filter prevents a method
13
 * from returning any value except an empty one.
14
 * This is because the filter condition itself can never be <code>true</code>
15
 * (e.g. because a given subtree ID does not exist in the database at all)
16
 * or because non of the data matches the filter.
17
 * <BR>
18
 * In the first case it is recommended to set the invalidFilter parameter to <code>true</code>
19
 * to indicate that the filter itself might be not correct.
20
 *
21
 * @author a.mueller
22
 * @since 14.09.2018
23
 */
24
public class FilterException extends Exception {
25

    
26
    private static final long serialVersionUID = 7491596488082796101L;
27

    
28
    private boolean invalidFilter;
29

    
30
    public FilterException(boolean invalidFilter) {
31
        super();
32
        this.setInvalidFilter(invalidFilter);
33
    }
34

    
35
    public FilterException(String message, boolean invalidFilter) {
36
        super(message);
37
        this.setInvalidFilter(invalidFilter);
38
    }
39

    
40
    /**
41
     * @param cause
42
     */
43
    public FilterException(Throwable cause, boolean invalidFilter) {
44
        super(cause);
45
        this.setInvalidFilter(invalidFilter);
46
    }
47

    
48
    /**
49
     * @param message
50
     * @param cause
51
     */
52
    public FilterException(String message, Throwable cause, boolean invalidFilter) {
53
        super(message, cause);
54
        this.setInvalidFilter(invalidFilter);
55
    }
56

    
57
    public boolean isInvalidFilter() {
58
        return invalidFilter;
59
    }
60

    
61
    public void setInvalidFilter(boolean invalidFilter) {
62
        this.invalidFilter = invalidFilter;
63
    }
64

    
65
}
(1-1/2)