19 package org.turro.dossier.content;
21 import java.io.Writer;
22 import java.util.ArrayList;
23 import java.util.Arrays;
24 import java.util.Collection;
25 import java.util.HashSet;
26 import java.util.List;
27 import org.turro.string.Strings;
28 import org.turro.attach.www.AttachCtrl;
29 import org.turro.dossier.db.DossierPU;
30 import org.turro.dossier.entity.Dossier;
31 import org.turro.dossier.entity.DossierStatus;
32 import org.turro.dossier.entity.Issue;
33 import org.turro.dossier.entity.IssueResolution;
34 import org.turro.dossier.entity.IssueStatus;
35 import org.turro.dossier.entity.IssueType;
36 import org.turro.dossier.issue.IssueWrapper;
37 import org.turro.dossier.kb.KnowledgeBaseQuery;
38 import org.turro.elephant.context.IConstructor;
39 import org.turro.elephant.impl.repository.Repository;
40 import org.turro.elephant.impl.repository.RepositoryFile;
41 import org.turro.elephant.web.SocialImageMap;
42 import org.turro.elephant.web.SocialNet;
43 import org.turro.entities.Entities;
44 import org.turro.file.util.FileAttach;
45 import org.turro.jpa.content.EntityItemContentIterator;
46 import org.turro.marker.ElephantMarker;
47 import org.turro.plugin.contacts.IContact;
48 import org.turro.www.commentit.CommentItCtrl;
49 import org.turro.www.describeit.DescribeItCtrl;
50 import org.turro.www.starit.StarItCtrl;
51 import org.turro.www.voteit.VoteItCtrl;
59 private boolean showSubject;
60 private final boolean all;
63 super(getKnowledgeBase(contact),
constructor, writer, contact, mail, pubPath);
72 this.showSubject = showSubject;
80 prepareValues(e, page);
89 prepareValues(e, page);
96 if(wrapper.getIssue().getId().equals(value)) {
108 return super.isValid(e);
112 private void prepareValues(
IssueWrapper wrapper,
int page) {
122 private String getIssueClass(Issue issue) {
124 (issue.getStatus().equals(IssueStatus.STATUS_NEW) ?
" new" :
"") +
125 (issue.getStatus().equals(IssueStatus.STATUS_STARTED) ?
" started" :
"") +
126 (issue.getStatus().equals(IssueStatus.STATUS_INCOMPLETE) ?
" incomplete" :
"") +
127 (issue.getStatus().equals(IssueStatus.STATUS_REOPENED) ?
" reopened" :
"") +
128 (issue.getStatus().equals(IssueStatus.STATUS_REUNION) ?
" reunion" :
"") +
129 (issue.getStatus().equals(IssueStatus.STATUS_FROZEN) ?
" frozen" :
"") +
130 (issue.getStatus().equals(IssueStatus.STATUS_RESOLVED) ?
" resolved" :
"") +
131 (issue.getStatus().equals(IssueStatus.STATUS_VERIFIED) ?
" verified" :
"") +
132 (issue.getStatus().equals(IssueStatus.STATUS_CLOSED) ?
" closed" :
"") +
134 (issue.getType().equals(IssueType.TYPE_DEFECT) ?
" defect" :
"") +
135 (issue.getType().equals(IssueType.TYPE_ENHANCEMENT) ?
" enhancement" :
"") +
136 (issue.getType().equals(IssueType.TYPE_FEATURE) ?
" feature" :
"") +
137 (issue.getType().equals(IssueType.TYPE_NONCONFORMITY) ?
" nonconformity" :
"") +
138 (issue.getType().equals(IssueType.TYPE_PATCH) ?
" patch" :
"") +
139 (issue.getType().equals(IssueType.TYPE_PREVENTION) ?
" prevention" :
"") +
140 (issue.getType().equals(IssueType.TYPE_QUESTION) ?
" question" :
"") +
141 (issue.getType().equals(IssueType.TYPE_TASK) ?
" task" :
"") +
142 (issue.getType().equals(IssueType.TYPE_DOCUMENT) ?
" document" :
"") +
143 (issue.getType().equals(IssueType.TYPE_BESTPRACTICE) ?
" bestpractice" :
"") +
144 (issue.getType().equals(IssueType.TYPE_PROCESS) ?
" process" :
"") +
145 (issue.getType().equals(IssueType.TYPE_PROPOSITION) ?
" proposition" :
"") +
147 (issue.getResolution().equals(IssueResolution.RESOLUTION_DUPLICATED) ?
" duplicated" :
"") +
148 (issue.getResolution().equals(IssueResolution.RESOLUTION_FIXED) ?
" fixed" :
"") +
149 (issue.getResolution().equals(IssueResolution.RESOLUTION_INVALID) ?
" invalid" :
"") +
150 (issue.getResolution().equals(IssueResolution.RESOLUTION_MOVED) ?
" moved" :
"") +
151 (issue.getResolution().equals(IssueResolution.RESOLUTION_NONE) ?
" none" :
"") +
152 (issue.getResolution().equals(IssueResolution.RESOLUTION_WONTFIX) ?
" wontfix" :
"") +
153 (issue.getResolution().equals(IssueResolution.RESOLUTION_WORKSFORME) ?
" worksforme" :
"");
166 ArrayList<RepositoryFile> files =
new ArrayList<>();
178 private static List<IssueWrapper> getKnowledgeBase(
IContact contact) {
192 return isMail() ?
"content/newsletter/sections/knowledgeBase" :
"issue";
233 throw new UnsupportedOperationException(
"Not supported yet.");
251 return "/user/kbase";
String getSummaryTemplate()
String getItemLink(IssueWrapper e)
Object doFilesCtrl(IssueWrapper e)
boolean isValid(IssueWrapper e)
String getRestrictedLink()
String title(IssueWrapper e)
void renderItem(ElephantMarker marker, IssueWrapper e, int page)
KnowledgeBaseContentIterator(IConstructor constructor, Writer writer, IContact contact, boolean mail, String pubPath)
Object doVotesCtrl(IssueWrapper e)
Object doCommentsCtrl(IssueWrapper e)
Collection< String > metas(IssueWrapper e)
Object doPollsCtrl(IssueWrapper e)
Object doInterestCtrl(IssueWrapper e)
Object doDescriptionsCtrl(IssueWrapper e)
void setShowSubject(boolean showSubject)
Object doAttachmentsCtrl(IssueWrapper e)
IssueWrapper entity(Long value)
void renderSummary(ElephantMarker marker, IssueWrapper e, int page)
static String getObjectPath(Object object)
DossierStatus getStatus()
boolean isKnowledgeBase()
String getFullDescription()
boolean isFullParticipant()
void setSearchValue(String searchValue)
void setResolutions(Set< IssueResolution > resolutions)
void setTypes(Set< IssueType > types)
KnowledgeBaseList getResultList()
void setStatus(Set< IssueStatus > status)
void setDossierId(Long dossierId)
void setOnlyTitle(boolean onlyTitle)
void setMaxResults(int maxResults)
Set< RepositoryFile > getRepositoryFiles(String pattern)
static boolean hasImage(String url)
List< String > getMetas()
static IElephantEntity getController(String path)
Repository getPublishableRepository(IConstructor constructor)
void prepareControls(E entity, int page)
void process(String rootTmpl, String tmpl)
Object put(Object key, Object value)
boolean isInRole(String role)
Object configureCtrl(Object ctrl, IContact contact)