19 package org.turro.contacts.content;
21 import java.io.Writer;
22 import java.util.ArrayList;
23 import java.util.Collection;
24 import org.turro.string.Strings;
25 import org.turro.attach.www.AttachCtrl;
26 import org.turro.contacts.Convocation;
27 import org.turro.contacts.db.ContactsPU;
28 import org.turro.elephant.context.ElephantContext;
29 import org.turro.elephant.context.IConstructor;
30 import org.turro.elephant.db.WhereClause;
31 import org.turro.elephant.impl.repository.Repository;
32 import org.turro.elephant.impl.repository.RepositoryFile;
33 import org.turro.elephant.web.SocialImageMap;
34 import org.turro.elephant.web.SocialNet;
35 import org.turro.entities.Entities;
36 import org.turro.file.util.FileAttach;
37 import org.turro.jpa.content.EntityDaoContentIterator;
38 import org.turro.jpa.search.DaoHtmlSearch;
39 import org.turro.jpa.search.DaoSearchKey;
40 import org.turro.marker.ElephantMarker;
41 import org.turro.plugin.contacts.IContact;
42 import org.turro.polls.PollsCtrl;
43 import org.turro.www.commentit.CommentItCtrl;
44 import org.turro.www.convocation.ConvocationCtrl;
45 import org.turro.www.describeit.DescribeItCtrl;
46 import org.turro.www.starit.StarItCtrl;
47 import org.turro.www.voteit.VoteItCtrl;
55 private boolean publishable;
67 this.publishable = publishable;
85 wc.
addClause(
"select distinct convocation from Convocation as convocation");
86 wc.
addClause(
"left outer join convocation.attendees attendee");
88 if(
"open".equals(mode)) {
89 wc.
addClause(
"order by convocation.callDate");
91 wc.
addClause(
"order by convocation.callDate desc");
99 wc.
addClause(
"select count(distinct convocation) from Convocation as convocation");
100 wc.
addClause(
"left outer join convocation.attendees attendee");
113 prepareValues(e, page);
125 prepareValues(e, page);
131 return "convocation";
137 wc.
addClause(
"select distinct convocation from Convocation as convocation");
138 wc.
addClause(
"left outer join convocation.attendees attendee");
140 wc.
addClause(
"and convocation.id = :id");
152 String searchValue = dsk.
getValue();
153 if(!Strings.isBlank(searchValue)) {
154 wc.
addClause(
"and convocation.name like :search01");
162 wc.
addClause(
"convocation.organizer.id = :idContact");
163 wc.
addClause(
"or attendee.contact.id = :idContact");
164 wc.
addClause(
") or convocation.publishable = TRUE");
169 wc.
addClause(
"and convocation.publishable = TRUE");
171 if(
"open".equals(mode)) {
172 wc.
addClause(
"and convocation.endDate >= current_timestamp");
173 }
else if(
"closed".equals(mode)) {
174 wc.
addClause(
"and convocation.endDate < current_timestamp");
180 return super.isValid(e);
183 private void prepareValues(
final Convocation e,
int page) {
189 if(!Strings.isBlank(e.
getName())) {
197 ArrayList<RepositoryFile> files =
new ArrayList<>();
212 return isMail() ?
"content/newsletter/sections/convocations" :
"convocation";
265 if(Strings.isBlank(path)) {
268 if(Strings.isBlank(path)) {
276 return "/user/convocations";
Object doCommentsCtrl(Convocation e)
String title(Convocation e)
String getRestrictedLink()
Object doDescriptionsCtrl(Convocation e)
String getItemLink(Convocation e)
ConvocationContentIterator(IConstructor constructor, Writer writer, IContact contact, boolean mail, String contextPath)
Convocation entity(String value)
void renderSummary(ElephantMarker marker, Convocation e, int page)
Object doFilesCtrl(Convocation e)
Object doPollsCtrl(Convocation e)
Object doAttachmentsCtrl(Convocation e)
void setMode(String mode)
Object doVotesCtrl(Convocation e)
boolean isAssistant(Convocation convocation, IContact contact)
Collection< String > metas(Convocation e)
void renderItem(ElephantMarker marker, Convocation e, int page)
WhereClause getCountClause()
boolean isValid(Convocation e)
WhereClause getWhereClause()
void setPublishable(boolean publishable)
Object doInterestCtrl(Convocation e)
static String getContextVariable(IConstructor constructor)
static String getEntityWebContext(String path)
void addClause(String clause)
void addNamedValue(String name, Object value)
void setEntityPath(String entityPath)
void setConstructor(IConstructor constructor)
Set< RepositoryFile > getRepositoryFiles(String pattern)
static boolean hasImage(String url)
List< String > getMetas()
static IElephantEntity getController(String path)
Repository getPublishableRepository(IConstructor constructor)
Object getSingleResultOrNull(SqlClause sc)
void prepareControls(E entity, int page)
String doItemLink(E entity, ID id, boolean obfuscated)
String getSummaryTemplate()
static DaoHtmlSearch getInstance(IConstructor constructor, String context)
void process(String rootTmpl, String tmpl)
Object put(Object key, Object value)
Object configureCtrl(Object ctrl, IContact contact)