BrightSide Workbench Full Report + Source Code
org.turro.students.content.ChallengeContentIterator Class Reference
Inheritance diagram for org.turro.students.content.ChallengeContentIterator:
Collaboration diagram for org.turro.students.content.ChallengeContentIterator:

Public Member Functions

 ChallengeContentIterator (IConstructor constructor, Writer writer, IContact contact, boolean mail, String pubPath)
 
boolean isMine (Challenge challenge, IContact contact)
 
boolean isMine (Response response, IContact contact)
 
boolean isVisible (Response response, IContact contact)
 
boolean isStudentRelated ()
 
void setStudentRelated (boolean studentRelated)
 
boolean isChallengerRelated ()
 
void setChallengerRelated (boolean challengerRelated)
 
String getStatus ()
 
void setStatus (String status)
 
void setResponseFrom (int days)
 
Object getResponseAttachCtrl (Response response)
 
Collection< Path > getCategories ()
 
- Public Member Functions inherited from org.turro.jpa.content.EntityDaoContentIterator< E, ID >
 EntityDaoContentIterator (Dao dao, IConstructor constructor, Writer writer, IContact contact, boolean mail, String contextPath)
 
void setSeenStatus (SeenStatusCheck seenStatus)
 
SeenStatusCheck getSeenStatus ()
 
String getId ()
 
String getContextPath ()
 
IContact getContact ()
 
boolean isMail ()
 
Object getVotesCtrl (E e)
 
Object getInterestCtrl (E e)
 
Object getCommentsCtrl (E e)
 
Object getAttachmentsCtrl (E e)
 
Object getFilesCtrl (E e)
 
Object getDescriptionsCtrl (E e)
 
Object getPollsCtrl (E e)
 
Object getForumCtrl (E e)
 
void assignDefaultsByName (String name)
 
void assignDefaultsByMacro (MacroProcessorContext context)
 
Object getParticipationCtrl (E e, ParticipationReason reason)
 
Object getSpamCtrl (E e)
 
Object getFollowCtrl (E e)
 
Object getSeenCtrl (E e)
 
Object getLikeCtrl (E e)
 
Object getApplyCtrl (E e)
 
Object getCtrlByLabel (String ctrl, E e, IContact contact)
 
- Public Member Functions inherited from org.turro.jpa.iterator.DaoHtmlIterator< E, ID >
 DaoHtmlIterator (Dao dao, ElephantMarker marker)
 
 DaoHtmlIterator (Dao dao, ElephantMarker marker, Writer writer)
 
void setSummaryTemplate (String summaryTemplate)
 
String getSummaryTemplate ()
 
void setFullTemplate (String fullTemplate)
 
String getFullTemplate ()
 
boolean isRestricted ()
 
void setRestricted (boolean restricted)
 
boolean isAllowInterest ()
 
void setAllowInterest (boolean allowInterest)
 
boolean isAllowComments ()
 
void setAllowComments (boolean allowComments)
 
boolean isAllowVotes ()
 
void setAllowVotes (boolean allowVotes)
 
boolean isAllowForum ()
 
void setAllowForum (boolean allowForum)
 
boolean isAllowDescriptions ()
 
void setAllowDescriptions (boolean allowDescriptions)
 
boolean isAllowAttachments ()
 
void setAllowAttachments (boolean allowAttachments)
 
boolean isAllowFiles ()
 
void setAllowFiles (boolean allowFiles)
 
boolean isAllowPolls ()
 
void setAllowPolls (boolean allowPolls)
 
boolean isAllowRanking ()
 
void setAllowRanking (boolean allowRanking)
 
boolean isAllowMatching ()
 
void setAllowMatching (boolean allowMatching)
 
boolean isDoMatching ()
 
void setDoMatching (boolean doMatching)
 
String getRankingInstance ()
 
void setRankingInstance (String rankingInstance)
 
String getMatchingInstance ()
 
void setMatchingInstance (String matchingInstance)
 
boolean isAllowSorting ()
 
void setAllowSorting (boolean allowSorting)
 
boolean isNavigatorTop ()
 
void setNavigatorTop (boolean navigatorTop)
 
boolean isNavigatorBottom ()
 
void setNavigatorBottom (boolean navigatorBottom)
 
DaoHtmlTree getNavigationTree ()
 
void setNavigationTree (DaoHtmlTree navigationTree)
 
DaoHtmlSearch getSearchEngine ()
 
void setSearchEngine (DaoHtmlSearch searchEngine)
 
boolean isSearchOption ()
 
void setSearchOption (boolean searchOption)
 
boolean isForceSummary ()
 
void setForceSummary (boolean forceSummary)
 
boolean wantItem ()
 
boolean isItem ()
 
boolean checkEntity (ID value)
 
Object addAttribute (String key, Object value)
 
Writer getWriter ()
 
void load ()
 
void forceItem (ID item)
 
String getTitle ()
 
Collection< String > getMetas ()
 
void render ()
 
boolean isFirst ()
 
boolean isLast ()
 
String renderSearchEngine ()
 
String renderTree ()
 
String renderTreeSelection ()
 
TagSet getCloudTags ()
 
TagSet getEntityTags (Object entity)
 
boolean isSeen (Object entity)
 
VisualElements getVisuals ()
 
boolean isEmpty ()
 
- Public Member Functions inherited from org.turro.jpa.iterator.DaoIterator< E, ID >
 DaoIterator (Dao dao)
 
int getPage ()
 
void setPage (int page)
 
List< E > getItems ()
 
int getTotalCount ()
 
List< E > getTotalItems ()
 
int item ()
 
void current (int value)
 
int current ()
 
int pages ()
 
boolean beginning ()
 
boolean end ()
 
void next ()
 
void previous ()
 

Protected Member Functions

WhereClause getWhereClause ()
 
WhereClause getCountClause ()
 
void renderSummary (ElephantMarker marker, Challenge e, int page)
 
void renderItem (ElephantMarker marker, Challenge e, int page)
 
String entityRoot ()
 
Challenge entity (Long value)
 
VisualElements loadVisuals ()
 
boolean isValid (Challenge e)
 
String title (Challenge e)
 
Collection< String > metas (Challenge e)
 
String getTemplateRoot ()
 
Object doVotesCtrl (Challenge e)
 
Object doInterestCtrl (Challenge e)
 
Object doCommentsCtrl (Challenge e)
 
Object doAttachmentsCtrl (Challenge e)
 
Object doFilesCtrl (Challenge e)
 
Object doDescriptionsCtrl (Challenge e)
 
Object doPollsCtrl (Challenge e)
 
String getItemLink (Challenge e)
 
String getReadAllLink ()
 
String getRestrictedLink ()
 
- Protected Member Functions inherited from org.turro.jpa.content.EntityDaoContentIterator< E, ID >
void prepareControls (E entity, int page)
 
String doItemLink (E entity, ID id, boolean obfuscated)
 
abstract Object doVotesCtrl (E e)
 
abstract Object doInterestCtrl (E e)
 
abstract Object doCommentsCtrl (E e)
 
abstract Object doAttachmentsCtrl (E e)
 
abstract Object doFilesCtrl (E e)
 
abstract Object doDescriptionsCtrl (E e)
 
abstract Object doPollsCtrl (E e)
 
abstract String getItemLink (E e)
 
- Protected Member Functions inherited from org.turro.jpa.iterator.DaoHtmlIterator< E, ID >
abstract E entity (ID value)
 
abstract void renderSummary (ElephantMarker marker, E e, int page)
 
abstract void renderItem (ElephantMarker marker, E e, int page)
 
abstract String title (E e)
 
abstract Collection< String > metas (E e)
 
void renderForbidden (ElephantMarker marker, int page)
 
ID getIDFromURL (String root)
 
ID getIdentifier ()
 
void preload ()
 
boolean isValid (E e)
 
boolean canShow (E e)
 
ID parseId (String value)
 
String stringId (ID value)
 
- Protected Member Functions inherited from org.turro.jpa.iterator.DaoIterator< E, ID >
void initClauses ()
 

Additional Inherited Members

- Static Public Attributes inherited from org.turro.action.content.IContentIterator
static String PRELOAD_TMPL = "#preload"
 
- Protected Attributes inherited from org.turro.jpa.iterator.DaoHtmlIterator< E, ID >
HTMLHelper html
 
IConstructor constructor
 
ElephantMarker marker
 
DaoHtmlSearch searchEngine
 
DaoHtmlTree navigationTree
 
- Protected Attributes inherited from org.turro.jpa.iterator.DaoIterator< E, ID >
List< E > items
 
Dao dao
 
int _total = -1
 

Detailed Description

Constructor & Destructor Documentation

◆ ChallengeContentIterator()

org.turro.students.content.ChallengeContentIterator.ChallengeContentIterator ( IConstructor  constructor,
Writer  writer,
IContact  contact,
boolean  mail,
String  pubPath 
)

Definition at line 68 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

68  {
69  super(new StudentsPU(), constructor, writer, contact, mail, pubPath);
70  }

Member Function Documentation

◆ doAttachmentsCtrl()

Object org.turro.students.content.ChallengeContentIterator.doAttachmentsCtrl ( Challenge  e)
protected

Definition at line 297 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

297  {
298  return Entities.getController(e).configureCtrl(
299  new AttachCtrl(constructor), getContact());
300  }
Here is the call graph for this function:

◆ doCommentsCtrl()

Object org.turro.students.content.ChallengeContentIterator.doCommentsCtrl ( Challenge  e)
protected

Definition at line 291 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

291  {
292  return Entities.getController(e).configureCtrl(
293  new CommentItCtrl(constructor), getContact());
294  }
Here is the call graph for this function:

◆ doDescriptionsCtrl()

Object org.turro.students.content.ChallengeContentIterator.doDescriptionsCtrl ( Challenge  e)
protected

Definition at line 309 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

309  {
310  return Entities.getController(e).configureCtrl(
311  new DescribeItCtrl(constructor), getContact());
312  }
Here is the call graph for this function:

◆ doFilesCtrl()

Object org.turro.students.content.ChallengeContentIterator.doFilesCtrl ( Challenge  e)
protected

Definition at line 303 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

303  {
304  return Entities.getController(e).configureCtrl(
305  new FileAttach(StudentsPU.getObjectPath(e)), getContact());
306  }
Here is the call graph for this function:

◆ doInterestCtrl()

Object org.turro.students.content.ChallengeContentIterator.doInterestCtrl ( Challenge  e)
protected

Definition at line 285 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

285  {
286  return Entities.getController(e).configureCtrl(
287  new StarItCtrl(constructor), getContact());
288  }
Here is the call graph for this function:

◆ doPollsCtrl()

Object org.turro.students.content.ChallengeContentIterator.doPollsCtrl ( Challenge  e)
protected

Definition at line 315 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

315  {
316  return Entities.getController(e).configureCtrl(
317  new PollsCtrl(constructor), getContact());
318  }
Here is the call graph for this function:

◆ doVotesCtrl()

Object org.turro.students.content.ChallengeContentIterator.doVotesCtrl ( Challenge  e)
protected

Definition at line 279 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

279  {
280  return Entities.getController(e).configureCtrl(
281  new VoteItCtrl(constructor), getContact());
282  }
Here is the call graph for this function:

◆ entity()

Challenge org.turro.students.content.ChallengeContentIterator.entity ( Long  value)
protected

Definition at line 175 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

175  {
176  WhereClause wc = new WhereClause();
177  wc.addClause("select distinct challenge from Challenge as challenge");
178  wc.addClause("left outer join challenge.responses response");
179  wc.addClause("left outer join response.studentIds student");
180  addCriteria(wc);
181  wc.addClause("and challenge.id = :id");
182  wc.addNamedValue("id", value);
183  return (Challenge) dao.getSingleResultOrNull(wc);
184  }
Object getSingleResultOrNull(SqlClause sc)
Definition: Dao.java:419
Here is the call graph for this function:

◆ entityRoot()

String org.turro.students.content.ChallengeContentIterator.entityRoot ( )
protected

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

Definition at line 170 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

170  {
171  return "challenge";
172  }

◆ getCategories()

Collection<Path> org.turro.students.content.ChallengeContentIterator.getCategories ( )

Definition at line 117 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

117  {
118  WhereClause wc = new WhereClause();
119  wc.addClause("select distinct challenge.category from Challenge as challenge");
120  wc.addClause("order by challenge.category");
121  return (Collection<Path>) dao.getResultList(wc).stream()
122  .map((c) -> Path.importFrom((String) c, Chars.backward().toString()))
123  .collect(Collectors.toList());
124  }
Here is the call graph for this function:

◆ getCountClause()

WhereClause org.turro.students.content.ChallengeContentIterator.getCountClause ( )
protected

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

Definition at line 144 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

144  {
145  WhereClause wc = new WhereClause();
146  wc.addClause("select count(distinct challenge) from Challenge as challenge");
147  wc.addClause("left outer join challenge.responses response");
148  wc.addClause("left outer join response.studentIds student");
149  addCriteria(wc);
150  return wc;
151  }
Here is the call graph for this function:

◆ getItemLink()

String org.turro.students.content.ChallengeContentIterator.getItemLink ( Challenge  e)
protected

Definition at line 321 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

321  {
322  return doItemLink(e, e.getId(), true);
323  }
String doItemLink(E entity, ID id, boolean obfuscated)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getReadAllLink()

String org.turro.students.content.ChallengeContentIterator.getReadAllLink ( )
protected

Reimplemented from org.turro.jpa.content.EntityDaoContentIterator< E, ID >.

Definition at line 326 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

326  {
327  String path = getContextPath();
328  if(Strings.isBlank(path)) {
329  path = ElephantContext.getEntityWebContext("/challenge");
330  }
331  if(Strings.isBlank(path)) {
332  return getRestrictedLink();
333  }
334  return path;
335  }
Here is the call graph for this function:

◆ getResponseAttachCtrl()

Object org.turro.students.content.ChallengeContentIterator.getResponseAttachCtrl ( Response  response)

Definition at line 112 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

112  {
113  return Entities.getController(response).configureCtrl(
114  new AttachCtrl(constructor), getContact());
115  }
Here is the call graph for this function:

◆ getRestrictedLink()

String org.turro.students.content.ChallengeContentIterator.getRestrictedLink ( )
protected

Reimplemented from org.turro.jpa.content.EntityDaoContentIterator< E, ID >.

Definition at line 338 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

338  {
339  return "/user/challenges";
340  }
Here is the caller graph for this function:

◆ getStatus()

String org.turro.students.content.ChallengeContentIterator.getStatus ( )

Definition at line 100 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

100  {
101  return status;
102  }

◆ getTemplateRoot()

String org.turro.students.content.ChallengeContentIterator.getTemplateRoot ( )
protected

Reimplemented from org.turro.jpa.content.EntityDaoContentIterator< E, ID >.

Definition at line 274 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

274  {
275  return isMail() ? "content/newsletter/sections/challenges" : "challenge";
276  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getWhereClause()

WhereClause org.turro.students.content.ChallengeContentIterator.getWhereClause ( )
protected

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

Definition at line 127 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

127  {
128  WhereClause wc = new WhereClause();
129  wc.addClause("select distinct challenge from Challenge as challenge");
130  wc.addClause("left outer join challenge.responses response");
131  wc.addClause("left outer join response.studentIds student");
132  return Statistics.load(constructor, "ChallengeRanking", null, wc)
133  .allowMatching(isAllowMatching())
134  .allowRanking(isAllowRanking())
135  .doMatching(isDoMatching())
136  .setContact(getContact())
137  .setEntityFields("challenge", "id")
138  .setDefaultSorting("challenge.creation desc")
139  .onCriteria(w -> addCriteria(w))
140  .getClause();
141  }
Here is the call graph for this function:

◆ isChallengerRelated()

boolean org.turro.students.content.ChallengeContentIterator.isChallengerRelated ( )

Definition at line 92 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

92  {
93  return challengerRelated;
94  }

◆ isMine() [1/2]

boolean org.turro.students.content.ChallengeContentIterator.isMine ( Challenge  challenge,
IContact  contact 
)

Definition at line 72 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

72  {
73  return challenge.getIdChallenger().equals(contact.getId());
74  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isMine() [2/2]

boolean org.turro.students.content.ChallengeContentIterator.isMine ( Response  response,
IContact  contact 
)

Definition at line 76 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

76  {
77  return response.getStudentIds().stream().anyMatch((student) -> (student.equals(contact.getId())));
78  }
Here is the call graph for this function:

◆ isStudentRelated()

boolean org.turro.students.content.ChallengeContentIterator.isStudentRelated ( )

Definition at line 84 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

84  {
85  return studentRelated;
86  }

◆ isValid()

boolean org.turro.students.content.ChallengeContentIterator.isValid ( Challenge  e)
protected

Definition at line 241 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

241  {
242  return super.isValid(e);
243  }

◆ isVisible()

boolean org.turro.students.content.ChallengeContentIterator.isVisible ( Response  response,
IContact  contact 
)

Definition at line 80 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

80  {
81  return contact.isAdmin() || isMine(response, contact) || isMine(response.getChallenge(), contact);
82  }
Here is the call graph for this function:

◆ loadVisuals()

VisualElements org.turro.students.content.ChallengeContentIterator.loadVisuals ( )
protected

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

Definition at line 187 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

187  {
188  return ChallengeVisualElements.load();
189  }
Here is the call graph for this function:

◆ metas()

Collection<String> org.turro.students.content.ChallengeContentIterator.metas ( Challenge  e)
protected

Definition at line 259 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

259  {
260  ArrayList<RepositoryFile> files = new ArrayList<>();
261  String path = getItemLink(e);
262  if(!SocialImageMap.hasImage(path)) {
263  FileAttach fa = new FileAttach(StudentsPU.getObjectPath(e));
264  Repository repository = fa.getPublishableRepository(constructor);
265  files.addAll(repository.getRepositoryFiles("*_social.png,*_social.jpg"));
266  files.addAll(repository.getRepositoryFiles("*.png,*.jpg"));
267  }
268  SocialNet sn;
269  sn = new SocialNet(path, e.getQuestion(), e.getName(), files);
270  return sn.getMetas();
271  }
Here is the call graph for this function:

◆ renderItem()

void org.turro.students.content.ChallengeContentIterator.renderItem ( ElephantMarker  marker,
Challenge  e,
int  page 
)
protected

◆ renderSummary()

void org.turro.students.content.ChallengeContentIterator.renderSummary ( ElephantMarker  marker,
Challenge  e,
int  page 
)
protected

Definition at line 154 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

154  {
155  if(e != null) {
156  marker.put("challenge", e);
157  prepareValues(e, page);
158  }
160  }
Here is the call graph for this function:

◆ setChallengerRelated()

void org.turro.students.content.ChallengeContentIterator.setChallengerRelated ( boolean  challengerRelated)

Definition at line 96 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

96  {
97  this.challengerRelated = challengerRelated;
98  }
Here is the caller graph for this function:

◆ setResponseFrom()

void org.turro.students.content.ChallengeContentIterator.setResponseFrom ( int  days)

Definition at line 108 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

108  {
109  responseFrom = new CheckDate().addDays(-days).getDate();
110  }
Here is the caller graph for this function:

◆ setStatus()

void org.turro.students.content.ChallengeContentIterator.setStatus ( String  status)

Definition at line 104 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

104  {
105  this.status = status;
106  }
Here is the caller graph for this function:

◆ setStudentRelated()

void org.turro.students.content.ChallengeContentIterator.setStudentRelated ( boolean  studentRelated)

Definition at line 88 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

88  {
89  this.studentRelated = studentRelated;
90  }
Here is the caller graph for this function:

◆ title()

String org.turro.students.content.ChallengeContentIterator.title ( Challenge  e)
protected

Definition at line 251 of file elephant-students/src/main/java/org/turro/students/content/ChallengeContentIterator.java.

251  {
252  if(!Strings.isBlank(e.getQuestion())) {
253  return e.getQuestion();
254  }
255  return null;
256  }
Here is the call graph for this function:

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