BrightSide Workbench Full Report + Source Code
org.turro.anonymous.AnonymousCtrl Class Reference
Inheritance diagram for org.turro.anonymous.AnonymousCtrl:
Collaboration diagram for org.turro.anonymous.AnonymousCtrl:

Public Member Functions

 AnonymousCtrl ()
 
String renderMailContainer (IConstructor constructor, IContact recipe, Object entity)
 
String renderMailContainer (IConstructor constructor, IContact recipe, Object entity, String template)
 
String renderMailContainer (IConstructor constructor, String recipeName, String recipeMail, Object entity)
 
String renderMailContainer (IConstructor constructor, String recipeName, String recipeMail, Object entity, String template)
 
String renderQuestionContainer (IConstructor constructor, IContact recipe, Object entity)
 
String renderQuestionContainer (IConstructor constructor, IContact recipe, Object entity, String template)
 
void renderAnswerForm (IConstructor constructor)
 
String createAnswerLink (IConstructor constructor, IContact recipe, Object entity)
 
- Public Member Functions inherited from org.turro.elephant.direct.AbstractDirectContentCtrl
 AbstractDirectContentCtrl (String tmplRoot)
 
String createFormAction ()
 
String createPOST (String values)
 
String getAjaxSubmitUrl (String containerId)
 
String getAjaxUrl (String containerId, String values)
 
String getAjaxUrl (String containerId, KeyValueMap values)
 
String getAjaxEvalUrl (KeyValueMap values)
 
String createRightNowURL (String values)
 
String createRightNowURL (KeyValueMap values)
 
String createLinkTo (String link, KeyValueMap values)
 
String createURL ()
 
String createURL (IConstructor constructor, String values)
 
String createURL (IConstructor constructor, String values, int daysValid)
 
String createURL (IConstructor constructor, String values, int daysValid, boolean withDomain)
 
String createURL (IConstructor constructor, IContact recipe, String values, int daysValid, boolean withDomain)
 
String createURL (IConstructor constructor, IContact recipe, KeyValueMap values, int daysValid, boolean withDomain)
 
void setTemplate (String template)
 
void render (IConstructor constructor)
 
String parse (IConstructor constructor)
 
boolean itsMe (String id)
 
boolean myTurn (HttpServletRequest request)
 
void execute (ServletContext context, HttpServletRequest request, HttpServletResponse response)
 
void execute (IConstructor constructor)
 

Protected Member Functions

void prepareCleanMarker (ElephantMarker marker, KeyValueMap map)
 
void prepareMarker (ElephantMarker marker)
 
String getIdentifier ()
 
void doExecute (IConstructor constructor, KeyValueMap map)
 
- Protected Member Functions inherited from org.turro.elephant.direct.AbstractDirectContentCtrl
String getRedirContext (IConstructor constructor, boolean withDomain)
 
ElephantMarker getMarker (IConstructor constructor)
 
ElephantMarker getCleanMarkerFrom (IConstructor constructor)
 
void addContainerId (ElephantMarker marker, boolean container)
 
String getTmplRoot ()
 
String getTemplate ()
 
void writeMarkerToResponse (IConstructor constructor, KeyValueMap map)
 
void writeMarkerToResponse (IConstructor constructor, KeyValueMap map, Map extra)
 
void setNeedsUser (boolean needsUser)
 

Additional Inherited Members

- Protected Attributes inherited from org.turro.elephant.direct.AbstractDirectContentCtrl
String template = "full"
 

Detailed Description

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

Definition at line 53 of file AnonymousCtrl.java.

Constructor & Destructor Documentation

◆ AnonymousCtrl()

org.turro.anonymous.AnonymousCtrl.AnonymousCtrl ( )

Definition at line 55 of file AnonymousCtrl.java.

55  {
56  super("widgets/anonymous");
57  setNeedsUser(true);
58  }

Member Function Documentation

◆ createAnswerLink()

String org.turro.anonymous.AnonymousCtrl.createAnswerLink ( IConstructor  constructor,
IContact  recipe,
Object  entity 
)

Definition at line 111 of file AnonymousCtrl.java.

111  {
112  KeyValueMap values = new KeyValueMap();
113  values.put("type", "render-answer");
114  values.put("answerer", Authentication.getIContact().getId());
115  values.put("questioner", recipe.getId());
116  values.put("entityPath", Entities.getController(entity).getPath());
117  return createLinkTo("/user/widgets/anonymous", values);
118  }

◆ doExecute()

void org.turro.anonymous.AnonymousCtrl.doExecute ( IConstructor  constructor,
KeyValueMap  map 
)
protected

Reimplemented from org.turro.elephant.direct.AbstractDirectContentCtrl.

Definition at line 140 of file AnonymousCtrl.java.

140  {
141  String type = map.get("type");
142  if("question-form".equals(type)) {
143  renderQuestionForm(constructor, map);
144  } else if("answer-form".equals(type)) {
145  renderAnswerForm(constructor, map);
146  } else if("send-question".equals(type)) {
147  try {
148  processQuestion(constructor, map);
149  } catch (EmailException ex) {
150  Logger.getLogger(AnonymousCtrl.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
151  }
152  } else if("send-answer".equals(type)) {
153  try {
154  processAnswer(constructor, map);
155  } catch (EmailException ex) {
156  Logger.getLogger(AnonymousCtrl.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
157  }
158  } else if("mail-form".equals(type)) {
159  renderMailForm(constructor, map);
160  } else if("send-mail".equals(type)) {
161  try {
162  processMail(constructor, map);
163  } catch (EmailException ex) {
164  Logger.getLogger(AnonymousCtrl.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
165  }
166  } else if("p2pmail-form".equals(type)) {
167  renderP2PMailForm(constructor, map);
168  } else if("send-p2pmail".equals(type)) {
169  try {
170  processP2PMail(constructor, map);
171  } catch (EmailException ex) {
172  Logger.getLogger(AnonymousCtrl.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
173  }
174  }
175  }
void renderAnswerForm(IConstructor constructor)
Here is the call graph for this function:

◆ getIdentifier()

String org.turro.anonymous.AnonymousCtrl.getIdentifier ( )
protected

Reimplemented from org.turro.elephant.direct.AbstractDirectContentCtrl.

Definition at line 135 of file AnonymousCtrl.java.

135  {
136  return AnonymousCtrl.class.getAnnotation(DirectContent.class).identifier();
137  }

◆ prepareCleanMarker()

void org.turro.anonymous.AnonymousCtrl.prepareCleanMarker ( ElephantMarker  marker,
KeyValueMap  map 
)
protected

Reimplemented from org.turro.elephant.direct.AbstractDirectContentCtrl.

Definition at line 123 of file AnonymousCtrl.java.

123  {
124  // nothing to do
125  }

◆ prepareMarker()

void org.turro.anonymous.AnonymousCtrl.prepareMarker ( ElephantMarker  marker)
protected

Reimplemented from org.turro.elephant.direct.AbstractDirectContentCtrl.

Definition at line 128 of file AnonymousCtrl.java.

128  {
129  // nothing to do
130  }

◆ renderAnswerForm()

void org.turro.anonymous.AnonymousCtrl.renderAnswerForm ( IConstructor  constructor)

Definition at line 107 of file AnonymousCtrl.java.

107  {
108  execute(constructor);
109  }
void execute(ServletContext context, HttpServletRequest request, HttpServletResponse response)
Here is the caller graph for this function:

◆ renderMailContainer() [1/4]

String org.turro.anonymous.AnonymousCtrl.renderMailContainer ( IConstructor  constructor,
IContact  recipe,
Object  entity 
)

Definition at line 60 of file AnonymousCtrl.java.

60  {
61  return renderQuestionContainer(constructor, recipe, entity, "mail");
62  }
String renderQuestionContainer(IConstructor constructor, IContact recipe, Object entity)

◆ renderMailContainer() [2/4]

String org.turro.anonymous.AnonymousCtrl.renderMailContainer ( IConstructor  constructor,
IContact  recipe,
Object  entity,
String  template 
)

Definition at line 64 of file AnonymousCtrl.java.

64  {
65  return renderMailContainer(constructor, recipe.getName(), recipe.getEmail(), entity, template);
66  }
String renderMailContainer(IConstructor constructor, IContact recipe, Object entity)
Here is the call graph for this function:

◆ renderMailContainer() [3/4]

String org.turro.anonymous.AnonymousCtrl.renderMailContainer ( IConstructor  constructor,
String  recipeName,
String  recipeMail,
Object  entity 
)

Definition at line 68 of file AnonymousCtrl.java.

68  {
69  return renderMailContainer(constructor, recipeName, recipeMail, entity, "mail");
70  }

◆ renderMailContainer() [4/4]

String org.turro.anonymous.AnonymousCtrl.renderMailContainer ( IConstructor  constructor,
String  recipeName,
String  recipeMail,
Object  entity,
String  template 
)

Definition at line 72 of file AnonymousCtrl.java.

72  {
73  IContact contact = Authentication.getIContact();
74  ElephantMarker marker = new ElephantMarker(constructor);
75  String containerId = "cic_" + IdGenerator.generate();
76  marker.put("containerId", containerId);
77  KeyValueMap values = new KeyValueMap();
78  values.put("type", "mail-form");
79  values.put("senderName", contact.getName());
80  values.put("senderMail", contact.getEmail());
81  values.put("recipeName", recipeName);
82  values.put("recipeMail", recipeMail);
83  values.put("entityPath", Entities.getController(entity).getPath());
84  values.put("containerId", containerId);
85  marker.put("askLink", getAjaxUrl(containerId, values));
86  return marker.parse(getTmplRoot(), template);
87  }
String getAjaxUrl(String containerId, String values)
Here is the call graph for this function:

◆ renderQuestionContainer() [1/2]

String org.turro.anonymous.AnonymousCtrl.renderQuestionContainer ( IConstructor  constructor,
IContact  recipe,
Object  entity 
)

Definition at line 89 of file AnonymousCtrl.java.

89  {
90  return renderQuestionContainer(constructor, recipe, entity, "question");
91  }

◆ renderQuestionContainer() [2/2]

String org.turro.anonymous.AnonymousCtrl.renderQuestionContainer ( IConstructor  constructor,
IContact  recipe,
Object  entity,
String  template 
)

Definition at line 93 of file AnonymousCtrl.java.

93  {
94  ElephantMarker marker = new ElephantMarker(constructor);
95  String containerId = "cic_" + IdGenerator.generate();
96  marker.put("containerId", containerId);
97  KeyValueMap values = new KeyValueMap();
98  values.put("type", "question-form");
99  values.put("answerer", recipe.getId());
100  values.put("questioner", Authentication.getIContact().getId());
101  values.put("entityPath", Entities.getController(entity).getPath());
102  values.put("containerId", containerId);
103  marker.put("askLink", getAjaxUrl(containerId, values));
104  return marker.parse(getTmplRoot(), template);
105  }
Here is the call graph for this function:

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