Mercurial > hg > mpdl-group
comparison software/eXist/mpdl-modules/src/de/mpg/mpiwg/berlin/mpdl/lt/lex/app/LexiconEntry.java @ 0:408254cf2f1d
Erstellung
author | Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de> |
---|---|
date | Wed, 24 Nov 2010 17:24:23 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:408254cf2f1d |
---|---|
1 package de.mpg.mpiwg.berlin.mpdl.lt.lex.app; | |
2 | |
3 public class LexiconEntry implements Comparable<LexiconEntry> { | |
4 private String lexiconName; | |
5 private String formName; | |
6 private String content; | |
7 private boolean xmlValid = false; | |
8 private boolean xmlMadeValid = false; | |
9 private String validationCode; | |
10 private String validationFailElementName; | |
11 | |
12 public LexiconEntry(String lexiconName, String formName, String content) { | |
13 this.lexiconName = lexiconName; | |
14 this.formName = formName; | |
15 this.content = content; | |
16 if (content != null) { | |
17 int begin = content.indexOf("<xml-valid>"); | |
18 int end = content.indexOf("</xml-valid>"); | |
19 if (begin != -1 && end != -1) { | |
20 String xmlValid = content.substring(begin + 11, end); | |
21 if (xmlValid != null) { | |
22 if (xmlValid.equals("true")) | |
23 this.xmlValid = true; | |
24 else if (xmlValid.equals("false")) | |
25 this.xmlValid = false; | |
26 } | |
27 } | |
28 } | |
29 } | |
30 | |
31 public String getLexiconName() { | |
32 return lexiconName; | |
33 } | |
34 | |
35 public String getFormName() { | |
36 return formName; | |
37 } | |
38 | |
39 public void setFormName(String formName) { | |
40 this.formName = formName; | |
41 } | |
42 | |
43 public String getContent() { | |
44 return content; | |
45 } | |
46 | |
47 public void setContent(String content) { | |
48 this.content = content; | |
49 } | |
50 | |
51 public boolean isXmlValid() { | |
52 return xmlValid; | |
53 } | |
54 | |
55 public void setXmlValid(boolean xmlValid) { | |
56 this.xmlValid = xmlValid; | |
57 } | |
58 | |
59 public String getValidationCode() { | |
60 return validationCode; | |
61 } | |
62 | |
63 public void setValidationCode(String validationCode) { | |
64 this.validationCode = validationCode; | |
65 } | |
66 | |
67 public String getValidationFailElementName() { | |
68 return validationFailElementName; | |
69 } | |
70 | |
71 public void setValidationFailElementName(String validationFailElementName) { | |
72 this.validationFailElementName = validationFailElementName; | |
73 } | |
74 | |
75 public boolean isXmlMadeValid() { | |
76 return xmlMadeValid; | |
77 } | |
78 | |
79 public void setXmlMadeValid(boolean xmlMadeValid) { | |
80 this.xmlMadeValid = xmlMadeValid; | |
81 } | |
82 | |
83 public String getRepairedEntry() { | |
84 String retStr = null; | |
85 if (content != null) { | |
86 int begin = content.indexOf("<repaired-entry>"); | |
87 int end = content.indexOf("</repaired-entry>"); | |
88 if (begin != -1 && end != -1) { | |
89 retStr = content.substring(begin, end) + "</repaired-entry>"; | |
90 } | |
91 } | |
92 return retStr; | |
93 } | |
94 | |
95 public String getOriginalEntry() { | |
96 String retStr = null; | |
97 if (content != null) { | |
98 int begin = content.indexOf("<original-entry>"); | |
99 int end = content.indexOf("</original-entry>"); | |
100 if (begin != -1 && end != -1) { | |
101 retStr = content.substring(begin, end) + "</original-entry>"; | |
102 } | |
103 } | |
104 return retStr; | |
105 } | |
106 | |
107 public int compareTo(LexiconEntry l) { | |
108 if (l.formName == null && this.formName == null) { | |
109 return 0; | |
110 } | |
111 if (this.formName == null) { | |
112 return 1; | |
113 } | |
114 if (l.formName == null) { | |
115 return -1; | |
116 } | |
117 return this.formName.compareTo(l.formName); | |
118 } | |
119 | |
120 | |
121 } |