1 package com.eyeq.pivot4j.pentaho.repository;
2
3 import java.io.IOException;
4 import java.io.Serializable;
5 import java.util.Date;
6
7 import org.apache.commons.lang.NullArgumentException;
8 import org.pentaho.platform.api.repository2.unified.RepositoryFile;
9
10 import com.eyeq.pivot4j.analytics.repository.AbstractReportFile;
11 import com.eyeq.pivot4j.analytics.repository.ReportFile;
12
13 public class PentahoReportFile extends AbstractReportFile {
14
15 public static final String DEFAULT_EXTENSION = "pivot4j";
16
17 private RepositoryFile file;
18
19 private PentahoReportFile parent;
20
21
22
23
24
25 public PentahoReportFile(RepositoryFile file, PentahoReportFile parent) {
26 if (file == null) {
27 throw new NullArgumentException("file");
28 }
29
30 this.file = file;
31 this.parent = parent;
32 }
33
34
35
36
37 protected RepositoryFile getFile() {
38 return file;
39 }
40
41
42
43
44 @Override
45 public Serializable getId() {
46 return file.getId();
47 }
48
49
50
51
52 @Override
53 public String getName() {
54 return file.getName();
55 }
56
57
58
59
60 @Override
61 public String getPath() {
62 return file.getPath().replaceAll(RepositoryFile.SEPARATOR,
63 ReportFile.SEPARATOR);
64 }
65
66
67
68
69 @Override
70 public ReportFile getParent() throws IOException {
71 return parent;
72 }
73
74
75
76
77 @Override
78 public boolean isDirectory() {
79 return file.isFolder();
80 }
81
82
83
84
85 @Override
86 public Date getLastModifiedDate() {
87 return file.getLastModifiedDate();
88 }
89
90
91
92
93 @Override
94 public long getSize() {
95 return file.getFileSize();
96 }
97 }