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 / GeometryOperationNotSupportedException.java @ 40435
History | View | Annotate | Download (1.93 KB)
1 | 40435 | jjdelcerro | package org.gvsig.fmap.geom.operation; |
---|---|---|---|
2 | |||
3 | import java.util.HashMap; |
||
4 | import java.util.Map; |
||
5 | |||
6 | import org.gvsig.fmap.geom.type.GeometryType; |
||
7 | import org.gvsig.tools.exception.BaseException; |
||
8 | |||
9 | public class GeometryOperationNotSupportedException extends BaseException { |
||
10 | |||
11 | /**
|
||
12 | * Generated UID
|
||
13 | */
|
||
14 | private static final long serialVersionUID = -8394502194572892834L; |
||
15 | |||
16 | /**
|
||
17 | * Constants specific to this BaseException subclass
|
||
18 | */
|
||
19 | private static final String MESSAGE_KEY = "Operation_opCode_is_not_registered_for_geomTypeName_type"; |
||
20 | private static final String FORMAT_STRING = "Operation %(opCode)s is not registered for '%(geomTypeName)s' type."; |
||
21 | |||
22 | private String geomTypeName = null; |
||
23 | private int opCode = -1; |
||
24 | |||
25 | /**
|
||
26 | * Constructor with the operation code of a common operation.
|
||
27 | * @param opCode
|
||
28 | */
|
||
29 | public GeometryOperationNotSupportedException(int opCode) { |
||
30 | this(opCode, null); |
||
31 | } |
||
32 | |||
33 | /**
|
||
34 | * Constructor with the operation code related to a geometry type
|
||
35 | * @param opCode
|
||
36 | * @param geomType
|
||
37 | */
|
||
38 | public GeometryOperationNotSupportedException(int opCode, GeometryType geomType) { |
||
39 | this(opCode, geomType, null); |
||
40 | } |
||
41 | |||
42 | /**
|
||
43 | * Constructor to use when <code>this</code> is caused by another Exception
|
||
44 | * but there is not further context data available.
|
||
45 | * @param e
|
||
46 | */
|
||
47 | public GeometryOperationNotSupportedException(Exception e) { |
||
48 | this(-1, null, e); |
||
49 | } |
||
50 | |||
51 | /**
|
||
52 | * Main constructor
|
||
53 | * @param opCode
|
||
54 | * @param geomType
|
||
55 | * @param e
|
||
56 | */
|
||
57 | public GeometryOperationNotSupportedException(int opCode, GeometryType geomType, Exception e) { |
||
58 | messageKey = MESSAGE_KEY; |
||
59 | formatString = FORMAT_STRING; |
||
60 | code = serialVersionUID; |
||
61 | |||
62 | if (e != null) { |
||
63 | initCause(e); |
||
64 | } |
||
65 | if (geomType != null) { |
||
66 | geomTypeName = geomType.getName(); |
||
67 | } else {
|
||
68 | geomTypeName = "ANY";
|
||
69 | } |
||
70 | this.opCode = opCode;
|
||
71 | } |
||
72 | |||
73 | protected Map values() { |
||
74 | HashMap map = new HashMap(); |
||
75 | map.put("opCode", Integer.toString(opCode)); |
||
76 | map.put("geomTypeName", geomTypeName);
|
||
77 | return map;
|
||
78 | } |
||
79 | |||
80 | } |