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

Public Member Functions

 ForumCtrl ()
 
boolean canDelete (Topic topic)
 
boolean canDelete (Post post)
 
String getDeleteLink (Topic topic)
 
String getDeleteLink (Post post)
 
boolean hasContent ()
 
String renderNewTopicContainer (IConstructor constructor)
 
String renderReplyContainer (IConstructor constructor, Topic topic)
 
String renderReplyContainer (IConstructor constructor, Post post)
 
String getParticipationLink (Topic topic)
 
boolean isMine (Topic topic)
 
- Public Member Functions inherited from org.turro.elephant.direct.AbstractDirectEntityCtrl
 AbstractDirectEntityCtrl (String tmplRoot, String entityAttribute)
 
void setConstructor (IConstructor constructor)
 
void setEntityPath (String entityPath)
 
- 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)
 
- Public Member Functions inherited from org.turro.action.IEntityCtrl
void setTemplate (String template)
 
void render (IConstructor constructor)
 
String parse (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.AbstractDirectEntityCtrl
ElephantMarker getMarker (IConstructor constructor)
 
- Protected Member Functions inherited from org.turro.elephant.direct.AbstractDirectContentCtrl
String getRedirContext (IConstructor constructor, boolean withDomain)
 
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.AbstractDirectEntityCtrl
String entityPath
 
IElephantEntity iee
 
IConstructor norReentrantConstructor
 
- 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 60 of file ForumCtrl.java.

Constructor & Destructor Documentation

◆ ForumCtrl()

org.turro.forum.www.ForumCtrl.ForumCtrl ( )

Definition at line 64 of file ForumCtrl.java.

64  {
65  super("forum", "forum");
66  }

Member Function Documentation

◆ canDelete() [1/2]

boolean org.turro.forum.www.ForumCtrl.canDelete ( Post  post)

Definition at line 78 of file ForumCtrl.java.

78  {
79  IContact contact = Authentication.getIContact();
80  Date allowed = new CheckDate().addDays(-1).getDate();
81  return (Application.getApplication().isInRole("contact-comment:delete") ||
82  (post.getAuthorId().equals(contact.getId()) && allowed.before(post.getCreation()))) &&
83  post.getPosts().isEmpty();
84  }
Here is the call graph for this function:

◆ canDelete() [2/2]

boolean org.turro.forum.www.ForumCtrl.canDelete ( Topic  topic)

Definition at line 70 of file ForumCtrl.java.

70  {
71  IContact contact = Authentication.getIContact();
72  Date allowed = new CheckDate().addDays(-1).getDate();
73  return (Application.getApplication().isInRole("contact-comment:delete") ||
74  (topic.getAuthorId().equals(contact.getId()) && allowed.before(topic.getCreation()))) &&
75  topic.getPosts().isEmpty();
76  }
Here is the call graph for this function:

◆ doExecute()

void org.turro.forum.www.ForumCtrl.doExecute ( IConstructor  constructor,
KeyValueMap  map 
)
protected

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

Definition at line 120 of file ForumCtrl.java.

120  {
121  String type = map.get("type");
122  if("participate".equals(type)) {
123  processParticipate(map, constructor);
124  } else if("new-topic-form". equals(type)) {
125  renderNewTopicForm(map, constructor);
126  } else if("new-topic". equals(type)) {
127  processNewTopic(map, constructor);
128  } else if("reply-form". equals(type)) {
129  renderReplyForm(map, constructor);
130  } else if("reply". equals(type)) {
131  processReply(map, constructor);
132  } else if("delete". equals(type)) {
133  processDelete(map, constructor);
134  }
135  }

◆ getDeleteLink() [1/2]

String org.turro.forum.www.ForumCtrl.getDeleteLink ( Post  post)

Definition at line 90 of file ForumCtrl.java.

90  {
91  return createRightNowURL("type=delete;post=" + post.getId());
92  }
Here is the call graph for this function:

◆ getDeleteLink() [2/2]

String org.turro.forum.www.ForumCtrl.getDeleteLink ( Topic  topic)

Definition at line 86 of file ForumCtrl.java.

86  {
87  return createRightNowURL("type=delete;topic=" + topic.getId());
88  }
Here is the call graph for this function:

◆ getIdentifier()

String org.turro.forum.www.ForumCtrl.getIdentifier ( )
protected

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

Definition at line 115 of file ForumCtrl.java.

115  {
116  return ForumCtrl.class.getAnnotation(DirectContent.class).identifier();
117  }

◆ getParticipationLink()

String org.turro.forum.www.ForumCtrl.getParticipationLink ( Topic  topic)

Definition at line 175 of file ForumCtrl.java.

175  {
176  return createPOST("type=participate;topic=" + topic.getId());
177  }
Here is the call graph for this function:

◆ hasContent()

boolean org.turro.forum.www.ForumCtrl.hasContent ( )

Reimplemented from org.turro.elephant.direct.AbstractDirectEntityCtrl.

Definition at line 102 of file ForumCtrl.java.

102  {
103  getRelatedTopics();
104  return !topics.isEmpty() && super.hasContent();
105  }

◆ isMine()

boolean org.turro.forum.www.ForumCtrl.isMine ( Topic  topic)

Definition at line 179 of file ForumCtrl.java.

179  {
180  IContact contact = Authentication.getIContact();
181  return topic.isParticipant(contact);
182  }
Here is the call graph for this function:

◆ prepareCleanMarker()

void org.turro.forum.www.ForumCtrl.prepareCleanMarker ( ElephantMarker  marker,
KeyValueMap  map 
)
protected

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

Definition at line 95 of file ForumCtrl.java.

95  {
96  throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
97  }

◆ prepareMarker()

void org.turro.forum.www.ForumCtrl.prepareMarker ( ElephantMarker  marker)
protected

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

Definition at line 108 of file ForumCtrl.java.

108  {
109  marker.put("topics", getRelatedTopics());
110  }
Here is the call graph for this function:

◆ renderNewTopicContainer()

String org.turro.forum.www.ForumCtrl.renderNewTopicContainer ( IConstructor  constructor)

Definition at line 139 of file ForumCtrl.java.

139  {
140  if(!Strings.isBlank(entityPath)) {
141  ElephantMarker marker = new ElephantMarker(constructor);
142  marker.put("entityPath", entityPath);
143  String containerId = "cic_" + IdGenerator.generate();
144  marker.put("containerId", containerId);
145  marker.put("newTopicLink", getAjaxUrl(containerId,
146  "type=new-topic-form;entityPath=" + entityPath +
147  ";containerId=" + containerId));
148  return marker.parse("forum", "new-topic-container");
149  }
150  return null;
151  }
String getAjaxUrl(String containerId, String values)
Here is the call graph for this function:

◆ renderReplyContainer() [1/2]

String org.turro.forum.www.ForumCtrl.renderReplyContainer ( IConstructor  constructor,
Post  post 
)

Definition at line 164 of file ForumCtrl.java.

164  {
165  ElephantMarker marker = new ElephantMarker(constructor);
166  marker.put("post", post);
167  String containerId = "cic_" + IdGenerator.generate();
168  marker.put("containerId", containerId);
169  marker.put("replyLink", getAjaxUrl(containerId,
170  "type=reply-form;post=" + post.getId() +
171  ";containerId=" + containerId));
172  return marker.parse("forum", "reply-container");
173  }
Here is the call graph for this function:

◆ renderReplyContainer() [2/2]

String org.turro.forum.www.ForumCtrl.renderReplyContainer ( IConstructor  constructor,
Topic  topic 
)

Definition at line 153 of file ForumCtrl.java.

153  {
154  ElephantMarker marker = new ElephantMarker(constructor);
155  marker.put("topic", topic);
156  String containerId = "cic_" + IdGenerator.generate();
157  marker.put("containerId", containerId);
158  marker.put("replyLink", getAjaxUrl(containerId,
159  "type=reply-form;topic=" + topic.getId() +
160  ";containerId=" + containerId));
161  return marker.parse("forum", "reply-container");
162  }
Here is the call graph for this function:

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