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