diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/software/mpdl-services/mpiwg-mpdl-lt/src/de/mpg/mpiwg/berlin/mpdl/lt/dict/app/LexiconEntry.java	Wed Nov 09 15:32:05 2011 +0100
@@ -0,0 +1,130 @@
+package de.mpg.mpiwg.berlin.mpdl.lt.dict.app;
+
+public class LexiconEntry implements Comparable<LexiconEntry> {
+  private String lexiconName;
+  private String formName;
+  private String content;
+  private String remoteUrl;
+  private boolean xmlValid = false;
+  private boolean xmlMadeValid = false;
+  private String validationCode;
+  private String validationFailElementName;
+
+  public LexiconEntry(String lexiconName, String formName, String content) {
+    this.lexiconName = lexiconName;
+    this.formName = formName;
+    this.content = content;
+    if (content != null) {
+      int begin = content.indexOf("<xml-valid>");
+      int end = content.indexOf("</xml-valid>");
+      if (begin != -1 && end != -1) {
+        String xmlValid = content.substring(begin + 11, end);
+        if (xmlValid != null) {
+          if (xmlValid.equals("true"))
+            this.xmlValid = true;
+          else if (xmlValid.equals("false"))
+            this.xmlValid = false;
+        }
+      }
+    }
+  }
+  
+  public String getLexiconName() {
+    return lexiconName;
+  }
+
+  public String getFormName() {
+    return formName;
+  }
+  
+  public void setFormName(String formName) {
+    this.formName = formName;  
+  }
+  
+  public String getContent() {
+    return content;
+  }
+
+  public void setContent(String content) {
+    this.content = content;  
+  }
+  
+  public String getRemoteUrl() {
+    return remoteUrl;
+  }
+
+  public void setRemoteUrl(String remoteUrl) {
+    this.remoteUrl = remoteUrl;  
+  }
+  
+  public boolean isXmlValid() {
+    return xmlValid;
+  }
+  
+  public void setXmlValid(boolean xmlValid) {
+    this.xmlValid = xmlValid;
+  }
+
+  public String getValidationCode() {
+    return validationCode;
+  }
+
+  public void setValidationCode(String validationCode) {
+    this.validationCode = validationCode;
+  }
+
+  public String getValidationFailElementName() {
+    return validationFailElementName;
+  }
+
+  public void setValidationFailElementName(String validationFailElementName) {
+    this.validationFailElementName = validationFailElementName;
+  }
+
+  public boolean isXmlMadeValid() {
+    return xmlMadeValid;
+  }
+
+  public void setXmlMadeValid(boolean xmlMadeValid) {
+    this.xmlMadeValid = xmlMadeValid;
+  }
+
+  public String getRepairedEntry() {
+    String retStr = null;
+    if (content != null) {
+      int begin = content.indexOf("<repaired-entry>");
+      int end = content.indexOf("</repaired-entry>");
+      if (begin != -1 && end != -1) {
+        retStr = content.substring(begin, end) + "</repaired-entry>";
+      }
+    }
+    return retStr;
+  }
+
+  public String getOriginalEntry() {
+    String retStr = null;
+    if (content != null) {
+      int begin = content.indexOf("<original-entry>");
+      int end = content.indexOf("</original-entry>");
+      if (begin != -1 && end != -1) {
+        retStr = content.substring(begin, end) + "</original-entry>";
+      }
+    }
+    return retStr;
+  }
+
+  public int compareTo(LexiconEntry l) {
+    if (l.formName == null && this.formName == null) {
+      return 0;
+    }
+    if (this.formName == null) {
+      return 1;
+    }
+    if (l.formName == null) {
+      return -1;
+    }
+    return this.formName.compareTo(l.formName);
+  }
+
+  
+}