18 package org.turro.elephant.documents;
21 import java.io.UnsupportedEncodingException;
22 import java.net.URLEncoder;
23 import java.util.Properties;
25 import java.util.TreeSet;
26 import java.util.logging.Level;
27 import java.util.logging.Logger;
28 import org.amic.util.string.Cipher;
29 import org.turro.elephant.context.ElephantContext;
39 private int level = 0;
44 this.docsRoot = docsRoot;
45 this.parentDoc = parentDoc;
46 this.level = (parentDoc !=
null ? parentDoc.
getLevel() + 1 : 0);
79 if(children ==
null) {
82 File[] fs = listFiles();
83 for(
int i = 0; i < fs.length; i++) {
84 if(!fs[i].getName().startsWith(
".")) {
86 String role = tmp.
readConfig(
"root.role",
false);
102 File[] fs = listFiles();
103 for(
int i = 0; i < fs.length; i++) {
104 if(!fs[i].getName().startsWith(
".") && fs[i].isDirectory()) {
105 tmp =
new FileDocument(docsRoot,
this, fs[i].getPath());
106 String role = tmp.
readConfig(
"root.role",
false);
120 File[] fs = listFiles();
121 for(
int i = 0; i < fs.length; i++) {
122 if(fs[i].isDirectory() || (fs[i].isHidden() && !
".docs.properties".equals(fs[i].getName()))) {
123 tmp =
new FileDocument(docsRoot,
this, fs[i].getPath());
124 String role = tmp.
readConfig(
"root.role",
false);
135 String result = isFile() ? null :
readConfig(
"root.name",
false);
138 String tmp = getName();
139 if(tmp.startsWith(
".")) tmp = tmp.substring(1);
140 int p = tmp.lastIndexOf(
".");
141 if(p > -1) tmp = tmp.substring(0, p);
142 String s[] = tmp.split(
"\\_");
143 for(
int i = 0; i < s.length; i++) {
145 if(result.length() > 0) result +=
" - ";
147 if(s[i].matches(
"[0-9]*")) {
148 switch(s[i].length()) {
169 result += (tmp ==
null ? s[i] : tmp);
173 if(result ==
null) result = getName();
174 if(isFile() &&
"true".equals(
readConfig(
"file.size"))) {
193 }
catch (UnsupportedEncodingException ex) {
200 return Cipher.digest(getPath(), 40);
204 String name = getName();
205 int p = name.lastIndexOf(
".");
206 if(p > -1)
return name.substring(p + 1).toLowerCase();
219 String result =
null;
220 File startPoint =
this;
226 result = props.getProperty(property);
228 if(moveUp && result ==
null) {
static String logMsg(String msg)
Properties getPropertiesFile(String file)
IConstructor getConstructor()
String getRelativePath(String path)
boolean getCanNewFolder()
String readRootConfig(String property)
boolean getCanDelFolder()
DocumentsBean getDocumentsBean()
DocumentsRoot getDocumentsRoot()
String readConfig(String property, boolean moveUp)
FileDocument(DocumentsRoot docsRoot, FileDocument parentDoc, String pathName)
String getFormattedName()
String getFormattedPath()
boolean getCanDelFolder()
FileDocument[] getListFolders()
boolean getSomethingToShow()
FileDocument[] getNotValidated()
FileDocument getParentDoc()
FileDocument[] getListDocuments()
boolean getCanNewFolder()
String readConfig(String property)
String parseValue(String type, String outFormat, Object value)
String parseString(String type, String inFormat, String outFormat, String value)
boolean isInRole(String role)