Skip to content

Commit

Permalink
[Upd] Remove prefix from the ResourceFormat, refactor XLS2TSVConverto…
Browse files Browse the repository at this point in the history
…r and HTML2TSVConvertor to use ResourceFormat instead of STRING
  • Loading branch information
rodionnv committed Sep 14, 2023
1 parent ba12cfc commit 1a9d0b8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Expand Up @@ -13,12 +13,10 @@ public enum ResourceFormat {
TSV("text/tab-separated-values"),
HTML("text/html"),
EXCEL("application/vnd.ms-excel");

private static String PREFIX = TabularModule.TYPE_URI + "/";
private final String localName;

public Resource getResource() {
return ResourceFactory.createResource(PREFIX + this.localName);
return ResourceFactory.createResource(this.localName);
}

public static ResourceFormat fromResource(Resource resource) {
Expand Down
@@ -1,6 +1,7 @@
package cz.cvut.spipes.modules.util;

import cz.cvut.spipes.constants.HTML;
import cz.cvut.spipes.modules.ResourceFormat;
import cz.cvut.spipes.registry.StreamResource;
import cz.cvut.spipes.registry.StringStreamResource;
import org.jsoup.Jsoup;
Expand Down Expand Up @@ -44,7 +45,7 @@ public StringStreamResource convertToTSV(StreamResource streamResource) {
return new StringStreamResource(
streamResource.getUri(),
tsvStringBuilder.toString().getBytes(),
"text/tsv"
ResourceFormat.TSV.toString()
);
}

Expand Down
@@ -1,5 +1,6 @@
package cz.cvut.spipes.modules.util;

import cz.cvut.spipes.modules.ResourceFormat;
import cz.cvut.spipes.registry.StreamResource;
import cz.cvut.spipes.registry.StringStreamResource;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
Expand Down Expand Up @@ -33,7 +34,7 @@ public StringStreamResource convertToTSV(StreamResource streamResource,int sheet
return new StringStreamResource(
streamResource.getUri(),
tsvStringBuilder.toString().getBytes(),
"text/tsv"
ResourceFormat.TSV.toString()
);
}
catch (IOException e) {
Expand Down

0 comments on commit 1a9d0b8

Please sign in to comment.