BrightSide Workbench Full Report + Source Code
org.turro.elephant.impl.repository.RepositoryFile Class Reference
Inheritance diagram for org.turro.elephant.impl.repository.RepositoryFile:
Collaboration diagram for org.turro.elephant.impl.repository.RepositoryFile:

Public Member Functions

 RepositoryFile (File file, IConstructor constructor)
 
boolean hasContent ()
 
File getFile ()
 
boolean isFolder ()
 
String getName ()
 
String getWebPath ()
 
String getThumbWebPath ()
 
String getMimeImage ()
 
String getByteString ()
 
String getDateString ()
 
Properties getProperties ()
 
int compareTo (RepositoryFile o)
 
File[] getFiles (String pattern)
 
File[] getFolders (String pattern)
 
Set< RepositoryFilegetRepositoryFiles (String pattern)
 
Set< RepositoryFilegetRepositoryFolders (String pattern)
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 46 of file RepositoryFile.java.

Constructor & Destructor Documentation

◆ RepositoryFile()

org.turro.elephant.impl.repository.RepositoryFile.RepositoryFile ( File  file,
IConstructor  constructor 
)

Definition at line 52 of file RepositoryFile.java.

52  {
53  this.file = file;
54  this.constructor = constructor;
55  }
Here is the caller graph for this function:

Member Function Documentation

◆ compareTo()

int org.turro.elephant.impl.repository.RepositoryFile.compareTo ( RepositoryFile  o)

Definition at line 116 of file RepositoryFile.java.

116  {
117  int result = CompareUtil.compare(file.isFile(), o.getFile().isFile());
118  if(result == 0) {
119  result = CompareUtil.compare(file.getName(), o.getFile().getName());
120  }
121  return result;
122  }
Here is the call graph for this function:

◆ getByteString()

String org.turro.elephant.impl.repository.RepositoryFile.getByteString ( )

Definition at line 92 of file RepositoryFile.java.

92  {
93  return new BytesFormatter(file.length()).toString();
94  }

◆ getDateString()

String org.turro.elephant.impl.repository.RepositoryFile.getDateString ( )

Definition at line 96 of file RepositoryFile.java.

96  {
97  return DateFormats.format(new Date(file.lastModified()),
98  DateFormat.SHORT, I_.api().used());
99  }
Here is the call graph for this function:

◆ getFile()

File org.turro.elephant.impl.repository.RepositoryFile.getFile ( )

Definition at line 61 of file RepositoryFile.java.

61  {
62  return file;
63  }
Here is the caller graph for this function:

◆ getFiles()

File [] org.turro.elephant.impl.repository.RepositoryFile.getFiles ( String  pattern)

Definition at line 124 of file RepositoryFile.java.

124  {
125  File repository = file;
126  final String patterns[] = pattern.split(",");
127  return repository.listFiles(new FileFilter() {
128  @Override
129  public boolean accept(File pathname) {
130  if(pathname.isFile() && !pathname.isHidden()) {
131  for(String p : patterns) {
132  if(Strings.compareIgnoreCase(pathname.getName(), p)) {
133  return true;
134  }
135  }
136  }
137  return false;
138  }
139  });
140  }
Here is the caller graph for this function:

◆ getFolders()

File [] org.turro.elephant.impl.repository.RepositoryFile.getFolders ( String  pattern)

Definition at line 142 of file RepositoryFile.java.

142  {
143  File repository = file;
144  final String patterns[] = pattern.split(",");
145  return repository.listFiles(new FileFilter() {
146  @Override
147  public boolean accept(File pathname) {
148  if(pathname.isDirectory() && !pathname.isHidden()) {
149  for(String p : patterns) {
150  if(Strings.compareIgnoreCase(pathname.getName(), p)) {
151  return true;
152  }
153  }
154  }
155  return false;
156  }
157  });
158  }
Here is the caller graph for this function:

◆ getMimeImage()

String org.turro.elephant.impl.repository.RepositoryFile.getMimeImage ( )

Definition at line 85 of file RepositoryFile.java.

85  {
86  return FontAwesome.getMimeIcon(FileUtil.getExtension(file));
87 // return ElephantContext.getRootWebPath() +
88 // "/_internal/system/mime/" +
89 // FileUtil.getExtension(file) + ".png";
90  }

◆ getName()

String org.turro.elephant.impl.repository.RepositoryFile.getName ( )

Definition at line 69 of file RepositoryFile.java.

69  {
70  return file.getName();
71  }

◆ getProperties()

Properties org.turro.elephant.impl.repository.RepositoryFile.getProperties ( )

Definition at line 101 of file RepositoryFile.java.

101  {
102  if(properties == null) {
103  properties = new Properties();
104  File fprop = new File(FileUtil.getBasePath(file) + ".properties");
105  if(fprop.exists()) {
106  try (InputStream is = new FileInputStream(fprop)) {
107  properties.load(new InputStreamReader(is, ElephantContext.getEncoding()));
108  } catch (IOException ex) {
109  }
110  }
111  }
112  return properties;
113  }
Here is the call graph for this function:

◆ getRepositoryFiles()

Set<RepositoryFile> org.turro.elephant.impl.repository.RepositoryFile.getRepositoryFiles ( String  pattern)

Definition at line 160 of file RepositoryFile.java.

160  {
161  File[] files = getFiles(pattern);
162  TreeSet<RepositoryFile> set = new TreeSet<>();
163  if(files != null) {
164  for(File f : files) {
165  set.add(new RepositoryFile(f, constructor));
166  }
167  }
168  return set;
169  }
RepositoryFile(File file, IConstructor constructor)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getRepositoryFolders()

Set<RepositoryFile> org.turro.elephant.impl.repository.RepositoryFile.getRepositoryFolders ( String  pattern)

Definition at line 171 of file RepositoryFile.java.

171  {
172  File[] files = getFolders(pattern);
173  TreeSet<RepositoryFile> set = new TreeSet<>();
174  if(files != null) {
175  for(File f : files) {
176  set.add(new RepositoryFile(f, constructor));
177  }
178  }
179  return set;
180  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getThumbWebPath()

String org.turro.elephant.impl.repository.RepositoryFile.getThumbWebPath ( )

Definition at line 79 of file RepositoryFile.java.

79  {
80  StringBuilder webPath = new StringBuilder(getWebPath());
81  webPath.insert(webPath.lastIndexOf("/"), "/thumbs");
82  return webPath.toString();
83  }
Here is the call graph for this function:

◆ getWebPath()

String org.turro.elephant.impl.repository.RepositoryFile.getWebPath ( )

Definition at line 73 of file RepositoryFile.java.

73  {
74  return file.getAbsolutePath().replace(
75  ElephantContext.getRealPath("/"),
76  ElephantContext.getRootWebPath());
77  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasContent()

boolean org.turro.elephant.impl.repository.RepositoryFile.hasContent ( )

Definition at line 57 of file RepositoryFile.java.

57  {
58  return file.isDirectory() && file.list().length > 0;
59  }
Here is the caller graph for this function:

◆ isFolder()

boolean org.turro.elephant.impl.repository.RepositoryFile.isFolder ( )

Definition at line 65 of file RepositoryFile.java.

65  {
66  return file.isDirectory();
67  }

The documentation for this class was generated from the following file: