BrightSide Workbench Full Report + Source Code
org.turro.elephant.documents.DocumentsRoot Class Reference

Public Member Functions

 DocumentsRoot (DocumentsBean docBean, String realRoot, String relativeRoot, Element config)
 
Properties getPropertiesFromUser (IUser user)
 
void savePropertiesToUser (Properties props, IUser user)
 
Properties getPropertiesFrom (String folder)
 
void savePropertiesTo (String folder, Properties props)
 
DocumentsBean getDocumentsBean ()
 
FileDocument getFileDocumentRoot ()
 
void setFileDocumentSelected (String selected)
 
FileDocument getFileDocumentSelected ()
 
String getAttribute (String attrib)
 
boolean getCanNew ()
 
boolean getCanDelete ()
 
boolean getCanNewFolder ()
 
boolean getCanDelFolder ()
 
String getDownloadURL ()
 
String getPath ()
 
String getRelativePath (String path)
 
Collection getInsertionPointsWrapped ()
 
FileDocument[] getInsertionFolders ()
 
Collection< FileDocumentgetNotValidated ()
 
String readConfig (String property)
 
String readRootConfig (String property)
 
void addInsertionPoint (String ident, String name)
 

Detailed Description

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

Definition at line 38 of file DocumentsRoot.java.

Constructor & Destructor Documentation

◆ DocumentsRoot()

org.turro.elephant.documents.DocumentsRoot.DocumentsRoot ( DocumentsBean  docBean,
String  realRoot,
String  relativeRoot,
Element  config 
)

Creates a new instance of DocumentsRoot

Definition at line 44 of file DocumentsRoot.java.

44  {
45  this.docBean = docBean;
46  this.realRoot = realRoot;
47  this.docsRoot = realRoot + relativeRoot;
48  this.configuration = config;
49  privateKey = Cipher.digest(docsRoot, 30);
50  docBean.setAttribute("@" + privateKey, docsRoot);
51  }
void setAttribute(String key, String value)
Here is the call graph for this function:

Member Function Documentation

◆ addInsertionPoint()

void org.turro.elephant.documents.DocumentsRoot.addInsertionPoint ( String  ident,
String  name 
)

Definition at line 185 of file DocumentsRoot.java.

185  {
186  if(ident.matches(getAttribute("insertionPattern"))) {
187  new File(getPath() + "/" + ident).mkdirs();
188  Properties props = new Properties();
189  props.put("root.name", name);
190  savePropertiesTo(ident, props);
191  copyTemplate(ident);
192  docBean.getMessages().addMessage(I_.get("Insertion point created"));
193  }
194  else {
195  docBean.getMessages().addError(I_.get("Identifier error, does not match pattern"));
196  }
197  }
void savePropertiesTo(String folder, Properties props)
Here is the call graph for this function:

◆ getAttribute()

String org.turro.elephant.documents.DocumentsRoot.getAttribute ( String  attrib)

Definition at line 99 of file DocumentsRoot.java.

99  {
100  return configuration != null ? configuration.getAttributeValue(attrib) : null;
101  }
Here is the caller graph for this function:

◆ getCanDelete()

boolean org.turro.elephant.documents.DocumentsRoot.getCanDelete ( )

Definition at line 107 of file DocumentsRoot.java.

107  {
108  return docBean.getCanDelete();
109  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCanDelFolder()

boolean org.turro.elephant.documents.DocumentsRoot.getCanDelFolder ( )

Definition at line 115 of file DocumentsRoot.java.

115  {
116  return docBean.getCanDelFolder();
117  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCanNew()

boolean org.turro.elephant.documents.DocumentsRoot.getCanNew ( )

Definition at line 103 of file DocumentsRoot.java.

103  {
104  return docBean.getCanNew();
105  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCanNewFolder()

boolean org.turro.elephant.documents.DocumentsRoot.getCanNewFolder ( )

Definition at line 111 of file DocumentsRoot.java.

111  {
112  return docBean.getCanNewFolder();
113  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDocumentsBean()

DocumentsBean org.turro.elephant.documents.DocumentsRoot.getDocumentsBean ( )

Definition at line 83 of file DocumentsRoot.java.

83  {
84  return docBean;
85  }
Here is the caller graph for this function:

◆ getDownloadURL()

String org.turro.elephant.documents.DocumentsRoot.getDownloadURL ( )

Definition at line 119 of file DocumentsRoot.java.

119  {
120  return docBean.getDownloadURL() + "?down_path=@" + privateKey;
121  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFileDocumentRoot()

FileDocument org.turro.elephant.documents.DocumentsRoot.getFileDocumentRoot ( )

Definition at line 87 of file DocumentsRoot.java.

87  {
88  return new FileDocument(this, null, docsRoot);
89  }
Here is the caller graph for this function:

◆ getFileDocumentSelected()

FileDocument org.turro.elephant.documents.DocumentsRoot.getFileDocumentSelected ( )

Definition at line 95 of file DocumentsRoot.java.

95  {
96  return new FileDocument(this, null, docsRoot + selected);
97  }

◆ getInsertionFolders()

FileDocument [] org.turro.elephant.documents.DocumentsRoot.getInsertionFolders ( )

Definition at line 145 of file DocumentsRoot.java.

145  {
146  Vector v = new Vector();
147  String pattern = getAttribute("insertionPattern");
148  for(FileDocument fd : getFileDocumentRoot().getListFolders()) {
149  if(pattern == null || fd.getName().matches(pattern)) {
150  v.add(fd);
151  }
152  }
153  return (FileDocument[]) v.toArray(new FileDocument[0]);
154  }
Here is the call graph for this function:

◆ getInsertionPointsWrapped()

Collection org.turro.elephant.documents.DocumentsRoot.getInsertionPointsWrapped ( )

Definition at line 134 of file DocumentsRoot.java.

134  {
135  Vector v = new Vector();
136  String pattern = getAttribute("insertionPattern");
137  for(FileDocument fd : getFileDocumentRoot().getListFolders()) {
138  if(pattern == null || fd.getName().matches(pattern)) {
139  v.add(new FileDocumentWrapper(fd, true));
140  }
141  }
142  return v;
143  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getNotValidated()

Collection<FileDocument> org.turro.elephant.documents.DocumentsRoot.getNotValidated ( )

Definition at line 156 of file DocumentsRoot.java.

156  {
157  Vector v = new Vector();
158  fillNotValidated(v, getFileDocumentRoot());
159  return v;
160  }
Here is the call graph for this function:

◆ getPath()

String org.turro.elephant.documents.DocumentsRoot.getPath ( )

Definition at line 123 of file DocumentsRoot.java.

123  {
124  return realRoot;
125  }
Here is the caller graph for this function:

◆ getPropertiesFrom()

Properties org.turro.elephant.documents.DocumentsRoot.getPropertiesFrom ( String  folder)

Definition at line 73 of file DocumentsRoot.java.

73  {
75  getPath() + "/" + folder + "/.docs.properties");
76  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPropertiesFromUser()

Properties org.turro.elephant.documents.DocumentsRoot.getPropertiesFromUser ( IUser  user)

Definition at line 53 of file DocumentsRoot.java.

53  {
54  File userFolder = new File(getPath() + "/" + user.getId());
55  if(!userFolder.exists()) {
56  userFolder.mkdirs();
57  Properties props = new Properties();
58  props.put("root.name", user.getName());
59  savePropertiesTo(user.getId(), props);
60  return props;
61  }
62  return getPropertiesFrom(user.getId());
63  }
Properties getPropertiesFrom(String folder)
Here is the call graph for this function:

◆ getRelativePath()

String org.turro.elephant.documents.DocumentsRoot.getRelativePath ( String  path)

Definition at line 127 of file DocumentsRoot.java.

127  {
128  if(path.startsWith(docsRoot)) {
129  return path.substring(docsRoot.length());
130  }
131  return path;
132  }
Here is the caller graph for this function:

◆ readConfig()

String org.turro.elephant.documents.DocumentsRoot.readConfig ( String  property)

Definition at line 173 of file DocumentsRoot.java.

173  {
174  return getFileDocumentRoot().readConfig(property);
175  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ readRootConfig()

String org.turro.elephant.documents.DocumentsRoot.readRootConfig ( String  property)

Definition at line 177 of file DocumentsRoot.java.

177  {
178  Properties props = docBean.getPropertiesFile(realRoot + "/.docs.properties");
179  if(props != null) {
180  return props.getProperty(property);
181  }
182  return null;
183  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ savePropertiesTo()

void org.turro.elephant.documents.DocumentsRoot.savePropertiesTo ( String  folder,
Properties  props 
)

Definition at line 78 of file DocumentsRoot.java.

78  {
80  getPath() + "/" + folder + "/.docs.properties");
81  }
void savePropertiesFile(Properties props, String file)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ savePropertiesToUser()

void org.turro.elephant.documents.DocumentsRoot.savePropertiesToUser ( Properties  props,
IUser  user 
)

Definition at line 65 of file DocumentsRoot.java.

65  {
66  File userFolder = new File(getPath() + "/" + user.getId());
67  if(!userFolder.exists()) {
68  userFolder.mkdirs();
69  }
70  savePropertiesTo(user.getId(), props);
71  }
Here is the call graph for this function:

◆ setFileDocumentSelected()

void org.turro.elephant.documents.DocumentsRoot.setFileDocumentSelected ( String  selected)

Definition at line 91 of file DocumentsRoot.java.

91  {
92  this.selected = selected;
93  }
Here is the caller graph for this function:

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