Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.geometry / org.gvsig.fmap.geometry.api / src / main / java / org / gvsig / fmap / geom / operation / GeometryOperationException.java @ 40596

History | View | Annotate | Download (2.68 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.fmap.geom.operation;
25

    
26
import java.util.HashMap;
27
import java.util.Map;
28

    
29
import org.gvsig.tools.exception.BaseException;
30

    
31
/**
32
 * @author Jorge Piera Llodr? (jorge.piera@iver.es)
33
 */
34
public class GeometryOperationException extends BaseException {
35

    
36
        /**
37
         * Generated serial version UID
38
         */
39
        private static final long serialVersionUID = 8230919748601156772L;
40
        private static final String MESSAGE_KEY = "geometry_operation_exception";
41
        private static final String FORMAT_STRING =
42
                "Exception executing the operation with code %(operationCode) for the geometry with type %(geometryType).";
43

    
44
        private int geometryType = -1;
45
        private int operationCode = -1;
46

    
47
        /**
48
         * Constructor with some context data for cases in which the root cause of
49
         * <code>this</code> is internal (usually an unsatisfied logic rule).
50
         * @param geometryType
51
         * @param operationCode
52
         */
53
        public GeometryOperationException(int geometryType, int operationCode){
54
                this(geometryType, operationCode, null);
55
        }
56

    
57
        /**
58
         * Constructor to use when <code>this</code> is caused by another Exception
59
         * but there is not further context data available.
60
         * @param e
61
         */
62
        public GeometryOperationException(Exception e) {
63
                this(-1, -1, e);
64
        }
65

    
66
        /**
67
         * Main constructor that provides both context data and a cause Exception
68
         * @param geometryType
69
         * @param operationCode
70
         * @param exp
71
         */
72
        public GeometryOperationException(int geometryType, int operationCode, Exception e) {
73
                super(FORMAT_STRING, e, MESSAGE_KEY, serialVersionUID);
74

    
75
                this.geometryType = geometryType;
76
                this.operationCode = operationCode;
77
        }
78

    
79
        protected Map values() {
80
                HashMap map = new HashMap();
81
                map.put("geometryType", String.valueOf(geometryType));
82
                map.put("operationCode", String.valueOf(operationCode));
83
                return map;
84
        }
85
}
86