Fixed availability support

Change-Id: I0cc6ff781ae55d1ff5e2927f52476779b2ac5004
diff --git a/src/main/java/de/ids_mannheim/korap/index/AbstractDocument.java b/src/main/java/de/ids_mannheim/korap/index/AbstractDocument.java
index d89c8cc..40547e3 100644
--- a/src/main/java/de/ids_mannheim/korap/index/AbstractDocument.java
+++ b/src/main/java/de/ids_mannheim/korap/index/AbstractDocument.java
@@ -62,7 +62,7 @@
             docTitle, docSubTitle, docAuthor, docEditor, corpusTitle,
             corpusSubTitle, corpusAuthor, corpusEditor, textType, textTypeArt,
             textTypeRef, textColumn, textDomain, fileEditionStatement,
-            biblEditionStatement, publisher, reference, language, license,
+            biblEditionStatement, publisher, reference, language, availability,
 	// pages,
 		keywords,
 
@@ -187,8 +187,12 @@
             this.setTextTypeRef(doc.get("textTypeRef"));
         if (fields.contains("language"))
             this.setLanguage(doc.get("language"));
+
+		// Deprecated
         if (fields.contains("license"))
-            this.setLicense(doc.get("license"));
+            this.setAvailability(doc.get("license"));
+		else if (fields.contains("availability"))
+            this.setAvailability(doc.get("availability"));
 		/*
         if (fields.contains("pages"))
             this.setPages(doc.get("pages"));
@@ -807,8 +811,9 @@
      * 
      * @return The license of the text as a string.
      */
+	@Deprecated
     public String getLicense () {
-        return this.license;
+        return this.availability;
     };
 
 
@@ -818,8 +823,29 @@
      * @param license
      *            The license of the text as a string.
      */
+	@Deprecated
     public void setLicense (String license) {
-        this.license = license;
+        this.availability = license;
+    };
+
+	/**
+     * Get the availability of the text as a string.
+     * 
+     * @return The availability of the text as a string.
+     */
+    public String getAvailability () {
+        return this.availability;
+    };
+
+
+    /**
+     * Set the availability of the text as a string.
+     * 
+     * @param availability
+     *            The availability of the text as a string.
+     */
+    public void setAvailability (String availability) {
+        this.availability = availability;
     };
 
 
diff --git a/src/main/java/de/ids_mannheim/korap/index/FieldDocument.java b/src/main/java/de/ids_mannheim/korap/index/FieldDocument.java
index e8730ed..8c0fb14 100644
--- a/src/main/java/de/ids_mannheim/korap/index/FieldDocument.java
+++ b/src/main/java/de/ids_mannheim/korap/index/FieldDocument.java
@@ -31,8 +31,6 @@
   The character offset may need a special encoding in Lucene
   To store the character offsets directly (not in the payloads),
   to make this less messy and speed things up.
-
-  TODO: license is now called "availability"!
 */
 
 /**
@@ -424,12 +422,20 @@
 
 
     @Override
+	@Deprecated
     public void setLicense (String license) {
-        super.setLicense(license);
-        this.addString("license", license);
+        super.setAvailability(license);
+        this.addString("availability", license);
     };
 
-	/*
+
+	@Override
+	public void setAvailability (String availability) {
+        super.setAvailability(availability);
+        this.addString("availability", availability);
+    };
+
+    /*
     @Override
     public void setPages (String pages) {
         super.setPages(pages);
diff --git a/src/test/java/de/ids_mannheim/korap/search/TestKrill.java b/src/test/java/de/ids_mannheim/korap/search/TestKrill.java
index 98b909e..3c4c475 100644
--- a/src/test/java/de/ids_mannheim/korap/search/TestKrill.java
+++ b/src/test/java/de/ids_mannheim/korap/search/TestKrill.java
@@ -1274,7 +1274,7 @@
         assertNull(fd.getTextColumn());
         assertNull(fd.getTextDomain());
         // assertEquals(fd.getPages(), "529-547");
-        assertEquals(fd.getLicense(), null);
+        assertEquals(fd.getLicense(), "QAO-NC");
         assertEquals(fd.getCreationDate().toString(), "18200000");
         assertEquals(fd.getPubDate().toString(), "19820000");
         assertEquals(fd.getAuthor(), "Goethe, Johann Wolfgang von");
diff --git a/src/test/java/de/ids_mannheim/korap/search/TestMetaFields.java b/src/test/java/de/ids_mannheim/korap/search/TestMetaFields.java
index dfc7030..022a6f6 100644
--- a/src/test/java/de/ids_mannheim/korap/search/TestMetaFields.java
+++ b/src/test/java/de/ids_mannheim/korap/search/TestMetaFields.java
@@ -174,7 +174,7 @@
                 res.at("/matches/0/foundries").asText());
         assertEquals("Goethe-Korpus",
                 res.at("/matches/0/corpusTitle").asText());
-        assertEquals("QAO-NC", res.at("/matches/0/license").asText());
+        assertEquals("QAO-NC", res.at("/matches/0/availability").asText());
         assertEquals("Goethe: Maximen und Reflexionen, (1827-1842)",
                 res.at("/matches/0/docTitle").asText());
         assertEquals("1827", res.at("/matches/0/creationDate").asText());
diff --git a/src/test/resources/queries/metas/fields_all.jsonld b/src/test/resources/queries/metas/fields_all.jsonld
index c5594bc..aab5a4f 100644
--- a/src/test/resources/queries/metas/fields_all.jsonld
+++ b/src/test/resources/queries/metas/fields_all.jsonld
@@ -38,7 +38,7 @@
       "textTypeArt",
       "textTypeRef",
       "language",
-      "license",
+      "availability",
       "pages",
       "biblEditionStatement",
       "fileEditionStatement"