1 package org.splat.simer;
4 import java.text.DecimalFormat;
5 import java.text.SimpleDateFormat;
6 import java.util.ResourceBundle;
8 import org.splat.dal.bo.som.ConvertsRelation;
10 public class FileFacade {
12 private String surl; // URL of the file
13 private final String format; // Extension of the file
14 private String comment; // Short description
15 private final String size;
16 private final String date;
18 // ==============================================================================================================================
20 // ==============================================================================================================================
22 public FileFacade(final ConvertsRelation represented,
23 final ApplicationSettings applicationSettings) {
24 ResourceBundle custom = ResourceBundle.getBundle("som",
25 applicationSettings.getCurrentLocale());
26 File export = represented.getTo().asFile();
27 String path = export.getPath();
28 String[] table = path.split("\\x2E");
29 DecimalFormat tostring = new DecimalFormat(custom
30 .getString("size.format")); // Locale size display format
31 SimpleDateFormat convert = new SimpleDateFormat(custom
32 .getString("date.format")); // Date display format
34 surl = applicationSettings.getRepositoryURL() + path;
35 surl = surl.replaceAll("'", "\\\\'");
36 format = table[table.length - 1].toUpperCase();
37 size = tostring.format(export.length() / 1000);
38 date = convert.format(represented.getTo().getDate());
39 comment = represented.getDescription();
40 if (comment == null) {
45 // ==============================================================================================================================
47 // ==============================================================================================================================
49 public String getDate() {
53 public String getDescription() {
57 public String getFormat() {
61 public String getSize() {
65 public String getURL() {