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;
11 public class FileFacade {
13 private String surl; // URL of the file
14 private String format; // Extension of the file
15 private String comment; // Short description
19 // ==============================================================================================================================
21 // ==============================================================================================================================
23 public FileFacade (ConvertsRelation represented) {
24 // ------------------------------------------------
25 ResourceBundle custom = ResourceBundle.getBundle("som", 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.getString("size.format")); // Locale size display format
30 SimpleDateFormat convert = new SimpleDateFormat(custom.getString("date.format")); // Date display format
32 surl = ApplicationSettings.getRepositoryURL() + path;
33 surl = surl.replaceAll("'", "\\\\'");
34 format = table[table.length-1].toUpperCase();
35 size = tostring.format(export.length()/1000);
36 date = convert.format(represented.getTo().getDate());
37 comment = represented.getDescription();
38 if (comment == null) comment = "";
41 // ==============================================================================================================================
43 // ==============================================================================================================================
45 public String getDate () {
46 // ------------------------
49 public String getDescription () {
50 // -------------------------------
53 public String getFormat () {
54 // -----------------------
57 public String getSize () {
58 // ------------------------
61 public String getURL () {
62 // -----------------------