BrightSide Workbench Full Report + Source Code
org.turro.attach.www.AttachTree Class Reference
Inheritance diagram for org.turro.attach.www.AttachTree:
Collaboration diagram for org.turro.attach.www.AttachTree:

Public Member Functions

 AttachTree (IConstructor constructor)
 
boolean isPublicOnly ()
 
void setPublicOnly (boolean publicOnly)
 
boolean isLastOnly ()
 
void setLastOnly (boolean lastOnly)
 
HashSet< String > getRestrictedFolders ()
 
void addRestrictedFolder (String restrictedFolder)
 
void addRestrictedFolders (HashSet< String > restrictedFolders)
 
String getImage (Item item)
 
String getFolderImage ()
 
String getShowURL (Item item)
 
String getROShowURL (Item item)
 
String getByteString (Item item)
 
String getDateString (Item item)
 
String getDeleteLink (Item item)
 
String createPetition (AcceptanceSingleStatus status, Item item)
 
- Public Member Functions inherited from org.turro.jpa.iterator.DaoHtmlTree< E, ID >
 DaoHtmlTree (Dao dao, ElephantMarker marker)
 
String getTreeTemplate ()
 
void setTreeTemplate (String treeTemplate)
 
String getFullTemplate ()
 
void setFullTemplate (String fullTemplate)
 
void render ()
 
String parse ()
 
VisualElements getVisuals ()
 
void renderSelected ()
 
String parseSelected ()
 
- Public Member Functions inherited from org.turro.jpa.iterator.DaoTree< E, ID >
 DaoTree (Dao dao)
 
Dao getDao ()
 
void fillTree (String path)
 
void fillRoot (Item item)
 

Protected Member Functions

Object getEntity (Object value)
 
void renderTree (ElephantMarker marker, List< Item< Object, Object >> items)
 
void renderItem (ElephantMarker marker, Object item)
 
String parseTree (ElephantMarker marker, List< Item< Object, Object >> items)
 
String parseItem (ElephantMarker marker, Object item)
 
WhereClause getChildrenClause (String currPath)
 
WhereClause getLeafClause (String currPath)
 
Object getId (Object item)
 
Object getParentId (Object item)
 
- Protected Member Functions inherited from org.turro.jpa.iterator.DaoHtmlTree< E, ID >
VisualElements loadVisuals ()
 
abstract void renderTree (ElephantMarker marker, List< Item< E, ID >> items)
 
abstract void renderItem (ElephantMarker marker, E item)
 
abstract String parseTree (ElephantMarker marker, List< Item< E, ID >> items)
 
abstract String parseItem (ElephantMarker marker, E item)
 

Additional Inherited Members

- Protected Attributes inherited from org.turro.jpa.iterator.DaoHtmlTree< E, ID >
IConstructor constructor
 
ElephantMarker marker
 
- Protected Attributes inherited from org.turro.jpa.iterator.DaoTree< E, ID >
Dao dao
 

Detailed Description

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

Definition at line 44 of file www/AttachTree.java.

Constructor & Destructor Documentation

◆ AttachTree()

org.turro.attach.www.AttachTree.AttachTree ( IConstructor  constructor)

Definition at line 49 of file www/AttachTree.java.

49  {
50  super(new AttachPU(), new ElephantMarker(constructor));
51  }

Member Function Documentation

◆ addRestrictedFolder()

void org.turro.attach.www.AttachTree.addRestrictedFolder ( String  restrictedFolder)

Definition at line 73 of file www/AttachTree.java.

73  {
74  if(!Strings.isBlank(restrictedFolder)) {
75  restrictedFolders.add(restrictedFolder);
76  }
77  }

◆ addRestrictedFolders()

void org.turro.attach.www.AttachTree.addRestrictedFolders ( HashSet< String >  restrictedFolders)

Definition at line 79 of file www/AttachTree.java.

79  {
80  if(restrictedFolders != null) {
81  this.restrictedFolders.addAll(restrictedFolders);
82  }
83  }
Here is the caller graph for this function:

◆ createPetition()

String org.turro.attach.www.AttachTree.createPetition ( AcceptanceSingleStatus  status,
Item  item 
)

Definition at line 203 of file www/AttachTree.java.

203  {
204  if(AcceptanceSingleStatus.SINGLE_FORBIDDEN.equals(status)) {
205  IAcceptances acceptances = Plugins.loadImplementation(IAcceptances.class);
206  Attachment attachment = (Attachment) item.getValue();
207  return acceptances.createPetition(AttachPU.getObjectPath(attachment), attachment.getIOwner(),
208  Application.getApplication().getConstructor().getRequest().getServletPath());
209  }
210  return "";
211  }
Here is the call graph for this function:

◆ getByteString()

String org.turro.attach.www.AttachTree.getByteString ( Item  item)

Definition at line 188 of file www/AttachTree.java.

188  {
189  Attachment attachment = (Attachment) item.getValue();
190  return attachment.getByteString();
191  }
Here is the call graph for this function:

◆ getChildrenClause()

WhereClause org.turro.attach.www.AttachTree.getChildrenClause ( String  currPath)
protected

Reimplemented from org.turro.jpa.iterator.DaoTree< E, ID >.

Definition at line 117 of file www/AttachTree.java.

117  {
118  WhereClause wc = new WhereClause();
119 // wc.addClause("select distinct a.path from Attachment as a");
120  wc.addClause("select distinct case when locate('/', a.path, " + (currPath.length() + 2) + ") = 0 then a.path else substring(a.path, 1, locate('/', a.path, " + (currPath.length() + 2) + ") - 1) end from Attachment as a");
121 // wc.addClause("select distinct substring(a.path, 1, locate('/', a.path, " + (currPath.length() + 2) + ") - 1) from Attachment as a");
122  wc.addClause("where UCASE(a.path) like UCASE(:path)");
123  wc.addNamedValue("path", currPath + "/_%");
124 // wc.addClause("and UCASE(a.path) not like UCASE(:npath)");
125 // wc.addNamedValue("npath", currPath + "/_%/%");
126  if(publicOnly) {
127  wc.addClause("and a.publishable = true");
128  }
129  wc.addClause("order by 1");
130  return wc;
131  }
Here is the call graph for this function:

◆ getDateString()

String org.turro.attach.www.AttachTree.getDateString ( Item  item)

Definition at line 193 of file www/AttachTree.java.

193  {
194  Attachment attachment = (Attachment) item.getValue();
195  return attachment.getDateString(constructor);
196  }
Here is the call graph for this function:

◆ getDeleteLink()

String org.turro.attach.www.AttachTree.getDeleteLink ( Item  item)

Definition at line 198 of file www/AttachTree.java.

198  {
199  Attachment attachment = (Attachment) item.getValue();
200  return AttachAction.delAttachment(attachment, HttpUtil.getCurrentUrl(constructor.getRequest()));
201  }
Here is the call graph for this function:

◆ getEntity()

Object org.turro.attach.www.AttachTree.getEntity ( Object  value)
protected

Definition at line 86 of file www/AttachTree.java.

86  {
87  return value instanceof Long ? getDao().find(Attachment.class, (Long) value) : value;
88  }
Here is the call graph for this function:

◆ getFolderImage()

String org.turro.attach.www.AttachTree.getFolderImage ( )

Definition at line 173 of file www/AttachTree.java.

173  {
174  return FontAwesome.getMimeIcon("folder");
175 // return ElephantContext.getRootWebPath() + "/_internal/system/mime/folder.png";
176  }

◆ getId()

Object org.turro.attach.www.AttachTree.getId ( Object  item)
protected

Definition at line 154 of file www/AttachTree.java.

154  {
155  return item instanceof Attachment ? ((Attachment) item).getId() : new Path((String) item).getLastNode();
156  }
Here is the call graph for this function:

◆ getImage()

String org.turro.attach.www.AttachTree.getImage ( Item  item)

Definition at line 163 of file www/AttachTree.java.

163  {
164  Attachment attachment = (Attachment) item.getValue();
165  return FontAwesome.getMimeIcon(attachment.getFileExtension());
166 // if(!new File(ElephantContext.getRealPath("/_internal/system/mime/" + attachment.getFileExtension() + ".png")).exists()) {
167 // return ElephantContext.getRootWebPath() + "/_internal/system/mime/empty.png";
168 // } else {
169 // return ElephantContext.getRootWebPath() + "/_internal/system/mime/" + attachment.getFileExtension() + ".png";
170 // }
171  }
Here is the call graph for this function:

◆ getLeafClause()

WhereClause org.turro.attach.www.AttachTree.getLeafClause ( String  currPath)
protected

Reimplemented from org.turro.jpa.iterator.DaoTree< E, ID >.

Definition at line 134 of file www/AttachTree.java.

134  {
135  WhereClause wc = new WhereClause();
136  wc.addClause("select distinct a from Attachment as a");
137  if(Strings.isBlank(currPath)) {
138  wc.addClause("where a.path is null");
139  } else {
140  wc.addClause("where UCASE(a.path) = UCASE(:path)");
141  wc.addNamedValue("path", currPath);
142  }
143  if(publicOnly) {
144  wc.addClause("and a.publishable = true");
145  }
146  if(lastOnly) {
147  wc.addClause("and a.modification = (select max(a2.modification) from Attachment as a2 where a2.path = a.path and a2.fileName = a.fileName)");
148  }
149  wc.addClause("order by a.fileName");
150  return wc;
151  }
Here is the call graph for this function:

◆ getParentId()

Object org.turro.attach.www.AttachTree.getParentId ( Object  item)
protected

Definition at line 159 of file www/AttachTree.java.

159  {
160  return null;
161  }

◆ getRestrictedFolders()

HashSet<String> org.turro.attach.www.AttachTree.getRestrictedFolders ( )

Definition at line 69 of file www/AttachTree.java.

69  {
70  return restrictedFolders;
71  }

◆ getROShowURL()

String org.turro.attach.www.AttachTree.getROShowURL ( Item  item)

Definition at line 183 of file www/AttachTree.java.

183  {
184  Attachment attachment = (Attachment) item.getValue();
185  return attachment.getROShowURL(constructor);
186  }
Here is the call graph for this function:

◆ getShowURL()

String org.turro.attach.www.AttachTree.getShowURL ( Item  item)

Definition at line 178 of file www/AttachTree.java.

178  {
179  Attachment attachment = (Attachment) item.getValue();
180  return attachment.getShowURL(constructor);
181  }
Here is the call graph for this function:

◆ isLastOnly()

boolean org.turro.attach.www.AttachTree.isLastOnly ( )

Definition at line 61 of file www/AttachTree.java.

61  {
62  return lastOnly;
63  }

◆ isPublicOnly()

boolean org.turro.attach.www.AttachTree.isPublicOnly ( )

Definition at line 53 of file www/AttachTree.java.

53  {
54  return publicOnly;
55  }

◆ parseItem()

String org.turro.attach.www.AttachTree.parseItem ( ElephantMarker  marker,
Object  item 
)
protected

Definition at line 111 of file www/AttachTree.java.

111  {
112  marker.put("item", item);
113  return marker.parse("attachment", getFullTemplate());
114  }
String parse(String rootTmpl, String tmpl)
Object put(Object key, Object value)
Here is the call graph for this function:

◆ parseTree()

String org.turro.attach.www.AttachTree.parseTree ( ElephantMarker  marker,
List< Item< Object, Object >>  items 
)
protected

Definition at line 104 of file www/AttachTree.java.

104  {
105  clean(items);
106  marker.put("items", items);
107  return marker.parse("attachment", getTreeTemplate());
108  }
Here is the call graph for this function:

◆ renderItem()

void org.turro.attach.www.AttachTree.renderItem ( ElephantMarker  marker,
Object  item 
)
protected

Definition at line 98 of file www/AttachTree.java.

98  {
99  marker.put("item", item);
100  marker.process("attachment", getFullTemplate());
101  }
void process(String rootTmpl, String tmpl)
Here is the call graph for this function:

◆ renderTree()

void org.turro.attach.www.AttachTree.renderTree ( ElephantMarker  marker,
List< Item< Object, Object >>  items 
)
protected

Definition at line 91 of file www/AttachTree.java.

91  {
92  clean(items);
93  marker.put("items", items);
94  marker.process("attachment", getTreeTemplate());
95  }
Here is the call graph for this function:

◆ setLastOnly()

void org.turro.attach.www.AttachTree.setLastOnly ( boolean  lastOnly)

Definition at line 65 of file www/AttachTree.java.

65  {
66  this.lastOnly = lastOnly;
67  }
Here is the caller graph for this function:

◆ setPublicOnly()

void org.turro.attach.www.AttachTree.setPublicOnly ( boolean  publicOnly)

Definition at line 57 of file www/AttachTree.java.

57  {
58  this.publicOnly = publicOnly;
59  }
Here is the caller graph for this function:

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