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 * File representation class.
13 public class FileFacade {
15 private transient String _surl; // URL of the file
16 private transient final String _format; // Extension of the file
17 private transient String _comment; // Short description
18 private transient final String _size;
19 private transient final String _date;
21 // ==============================================================================================================================
23 // ==============================================================================================================================
25 public FileFacade(final ConvertsRelation represented,
26 final ApplicationSettings applicationSettings) {
27 ResourceBundle custom = ResourceBundle.getBundle("som",
28 applicationSettings.getCurrentLocale());
29 File export = represented.getTo().asFile();
30 String path = export.getPath();
31 String[] table = path.split("\\x2E");
32 DecimalFormat tostring = new DecimalFormat(custom
33 .getString("size.format")); // Locale size display format
34 SimpleDateFormat convert = new SimpleDateFormat(custom
35 .getString("date.format"), applicationSettings
36 .getCurrentLocale()); // Date display format
38 _surl = applicationSettings.getRepositoryURL() + path;
39 _surl = _surl.replaceAll("'", "\\\\'");
40 _format = table[table.length - 1].toUpperCase();
41 _size = tostring.format(export.length() / 1000);
42 _date = convert.format(represented.getTo().getDate());
43 _comment = represented.getDescription();
44 if (_comment == null) {
49 // ==============================================================================================================================
51 // ==============================================================================================================================
53 public String getDate() {
57 public String getDescription() {
61 public String getFormat() {
65 public String getSize() {
69 public String getURL() {