01: package org.enhydra.shark.xpdl;
02:
03: import org.enhydra.shark.xpdl.elements.Package;
04:
05: /**
06: * @author Sasa Bojanic
07: *
08: */
09: public final class XMLValidationError {
10:
11: public static final String TYPE_ERROR = "ERROR";
12: public static final String TYPE_WARNING = "WARNING";
13:
14: public static final String SUB_TYPE_SCHEMA = "SCHEMA";
15: public static final String SUB_TYPE_CONNECTION = "CONNECTION";
16: public static final String SUB_TYPE_CONFORMANCE = "CONFORMANCE";
17: public static final String SUB_TYPE_LOGIC = "LOGIC";
18:
19: private String type;
20: private String sub_type;
21: private String id;
22: private String description;
23: private XMLElement element;
24:
25: public XMLValidationError(String type, String subType, String id,
26: String desc, XMLElement el) {
27: this .type = type;
28: this .sub_type = subType;
29: this .id = id;
30: this .description = desc;
31: this .element = el;
32: }
33:
34: public String getType() {
35: return type;
36: }
37:
38: public String getSubType() {
39: return sub_type;
40: }
41:
42: public String getId() {
43: return id;
44: }
45:
46: public String getDescription() {
47: return description;
48: }
49:
50: public XMLElement getElement() {
51: return element;
52: }
53:
54: public String toString() {
55: String retVal = "";
56: if (element != null) {
57: retVal += element.toName() + ": ";
58: if (element instanceof Package
59: || element instanceof XMLCollectionElement) {
60: retVal += "Id="
61: + ((XMLComplexElement) element).get("Id")
62: .toValue();
63: }
64: if (element instanceof XMLComplexElement) {
65: XMLElement nameEl = ((XMLComplexElement) element)
66: .get("Name");
67: if (nameEl != null) {
68: retVal += ", Name=" + nameEl.toValue();
69: }
70: }
71:
72: retVal += ", type=" + type;
73: retVal += ", sub-type=" + sub_type;
74: retVal += ", " + id;
75: if (description != null && description.length() > 0)
76: retVal += ", " + description;
77: }
78: return retVal;
79: }
80:
81: }
|