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

Public Member Functions

 FileUtilAjax ()
 
int execute () throws Exception
 
- Public Member Functions inherited from org.turro.elephant.impl.abstracts.AbstractAction
 AbstractAction ()
 
void setConstructor (IConstructor constructor)
 
IConstructor getConstructor ()
 
String getContextParameter ()
 
String getIdelParameter ()
 
String getActionParameter ()
 
String getParameter (String param)
 
String getParameter (String param, boolean encode)
 
String getStringParameter (String param)
 
String getValueParameter (String param)
 
boolean getBooleanParameter (String param)
 
int getIntParameter (String param, int defaultValue)
 
double getDoubleParameter (String param, double defaultValue)
 
Date getDateParameter (String param, Date defaultValue)
 

Static Public Attributes

static final String VALID_ATTACHMENTS = "(?i).*\\.(jpg|gif|png|pdf|doc|txt|zip)$"
 
- Static Public Attributes inherited from org.turro.elephant.context.IAction
static final int DONE = 0
 
static final int NO_DATA = 1
 
static final int ERROR = 2
 

Additional Inherited Members

- Static Public Member Functions inherited from org.turro.elephant.impl.abstracts.AbstractAction
static String makeDateParameter (Date date)
 
static String makeDateParameter (Timestamp date)
 
static String getValuePortion (String key, String value)
 
- Protected Attributes inherited from org.turro.elephant.impl.abstracts.AbstractAction
IConstructor constructor
 

Detailed Description

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

Definition at line 33 of file FileUtilAjax.java.

Constructor & Destructor Documentation

◆ FileUtilAjax()

org.turro.elephant.impl.util.FileUtilAjax.FileUtilAjax ( )

Creates a new instance of FileUtilAjax

Definition at line 39 of file FileUtilAjax.java.

39  {
40  }

Member Function Documentation

◆ execute()

int org.turro.elephant.impl.util.FileUtilAjax.execute ( ) throws Exception

Called by constructor in request for one action.

Exceptions
java.lang.Exception
Returns
Action's result.

Implements org.turro.elephant.context.IAction.

Definition at line 43 of file FileUtilAjax.java.

43  {
44  String path = getParameter("path"),
45  action = getActionParameter();
46  boolean selectable = "true".equals(getParameter("sel"));
47  if(path == null) {
48  return IAction.NO_DATA;
49  }
50  File realPath = new File(ElephantContext.getRealPath(path));
51  if("list-folders".equals(action)) {
52  if(realPath.exists()) {
53  return listFolders(realPath);
54  }
55  else {
56  return IAction.ERROR;
57  }
58  }
59  else if("list-files".equals(action)) {
60  if(realPath.exists()) {
61  return listFiles(realPath, selectable);
62  }
63  else {
64  return IAction.ERROR;
65  }
66  }
67  else if("list-attachments".equals(action)) {
68  if(realPath.exists()) {
69  return listAttachments(realPath, selectable);
70  }
71  else {
72  return IAction.ERROR;
73  }
74  }
75  else if("remove-attachments".equals(action)) {
76  return removeAttachments(selectable, realPath);
77  }
78  else if("file-content".equals(action)) {
79  if(realPath.exists()) {
80  return fileContent(realPath);
81  }
82  else {
83  return IAction.ERROR;
84  }
85  }
86  else if("save-content".equals(action)) {
87  return saveContent(realPath);
88  }
89  else if("remove-file".equals(action)) {
90  if(realPath.exists()) {
91  realPath.delete();
92  }
93  else {
94  return IAction.ERROR;
95  }
96  }
97  return IAction.NO_DATA;
98  }
String getParameter(String param)
Here is the call graph for this function:

Member Data Documentation

◆ VALID_ATTACHMENTS

final String org.turro.elephant.impl.util.FileUtilAjax.VALID_ATTACHMENTS = "(?i).*\\.(jpg|gif|png|pdf|doc|txt|zip)$"
static

Definition at line 36 of file FileUtilAjax.java.


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