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

Public Member Functions

 FeedbackAction ()
 
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)
 

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)
 
- 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
 
- 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 35 of file FeedbackAction.java.

Constructor & Destructor Documentation

◆ FeedbackAction()

org.turro.elephant.impl.feedback.FeedbackAction.FeedbackAction ( )

Creates a new instance of FeedbackAction

Definition at line 38 of file FeedbackAction.java.

38  {
39  }

Member Function Documentation

◆ execute()

int org.turro.elephant.impl.feedback.FeedbackAction.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 42 of file FeedbackAction.java.

42  {
43  String fbquery = getParameter("fbquery"),
44  comment = getParameter("comment"),
45  action = getActionParameter(),
46  ctx = getParameter("context");
47 
48  if("post".equals(action)) {
49  if(!Strings.isBlank(comment)) {
50  String feedback = ctx + "|" + fbquery + "|" + comment + "|" +
51  constructor.getRequest().getRemoteAddr() + "|" +
52  "|*EOL*|" + "\n";
53  FileUtil.appendContent(
54  new File(ElephantContext.getRealPath(
55  "/WEB-INF/elephant/feedback/data/" +
56  ObjectString.formatObject(new Date(), "yyyyMMdd", false) +
57  ".txt"
58  )),
59  feedback
60  );
61 
62  String mailBody =
63  "Context: " + ctx + "\n" +
64  "Opinion:" + fbquery + "\n" +
65  "Comment:" + "\n" + comment + "\n\n" +
66  "RemoteADR:" + constructor.getRequest().getRemoteAddr();
67  String subject = "Feedback on " + ElephantContext.getSiteName();
68  MailSenders.getPool()
69  .addAdministrators()
70  .send(subject, StringParser.toHTML(mailBody));
71  }
72  }
73  return IAction.DONE;
74  }
String getParameter(String param)
Here is the call graph for this function:

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