19 package org.turro.dossier.www;
21 import java.io.IOException;
22 import java.io.PrintWriter;
23 import java.util.List;
24 import javax.servlet.ServletException;
25 import org.turro.string.Strings;
26 import org.turro.dossier.db.DossierPU;
27 import org.turro.dossier.entity.Dossier;
28 import org.turro.dossier.entity.Issue;
29 import org.turro.dossier.entity.IssueParticipant;
30 import org.turro.dossier.entity.IssueResolution;
31 import org.turro.dossier.entity.IssueStatus;
32 import org.turro.dossier.entity.IssueType;
33 import org.turro.dossier.issue.IssueWrapper;
34 import org.turro.dossier.kb.PendingRevisionQuery;
35 import org.turro.elephant.context.ElephantContext;
36 import org.turro.elephant.context.IElement;
37 import org.turro.elephant.impl.abstracts.AbstractElement;
38 import org.turro.elephant.impl.context.AttributeItem;
39 import org.turro.elephant.layout.IManageable;
40 import org.turro.elephant.layout.IRenderable;
41 import org.turro.elephant.security.IDefendable;
42 import org.turro.file.util.FileAttach;
43 import org.turro.marker.ElephantMarker;
44 import org.turro.plugin.contacts.ContactList;
45 import org.turro.www.describeit.DescribeItCtrl;
46 import org.turro.www.starit.StarItCtrl;
47 import org.turro.www.voteit.VoteItCtrl;
55 protected String
sclass, fullTemplate, summaryTemplate, issuePath;
56 protected boolean allowInterest, allowComments, allowVotes, showDescriptions;
60 public void loadData() throws ServletException, IOException {
63 allowComments =
getAttributes().getAttributeBooleanValue(
"attrib:allowComments",
true);
64 allowVotes =
getAttributes().getAttributeBooleanValue(
"attrib:allowVotes",
true);
65 showDescriptions =
getAttributes().getAttributeBooleanValue(
"attrib:showDescriptions",
true);
66 fullTemplate =
getAttributes().getAttributeValue(
"attrib:fullTemplate",
"");
67 summaryTemplate =
getAttributes().getAttributeValue(
"attrib:summaryTemplate",
"");
68 issuePath =
getAttributes().getAttributeValue(
"attrib:issuePath",
"");
89 marker.
put(
"divider",
false);
90 marker.
put(
"header",
true);
91 marker.
put(
"footer",
true);
92 marker.
put(
"empty",
true);
93 marker.
process(
"issue", getSummaryTemplate());
96 marker.
put(
"empty",
false);
98 marker.
put(
"divider", index > 0);
99 marker.
put(
"header", index == 0);
100 marker.
put(
"footer", index == list.size() - 1);
101 prepareValues(marker, ip, 0);
102 marker.
put(
"ip", ip);
103 marker.
process(
"issue", getSummaryTemplate());
114 return "<div class='" +
sclass +
"dossier-web'>";
126 marker.
put(
"issue", issue);
130 String link = getItemLink(issue, page);
132 marker.
put(
"path", link);
133 marker.
put(
"all", getPageLink(page));
135 marker.
put(
"readall", getItemLink(issue, page));
136 marker.
put(
"issueClass", getIssueClass(issue));
140 if(dossier.getType().isVotes()) {
142 vic.setEntityPath(DossierPU.getObjectPath(issue));
144 if(dossier.getType().isSecret()) {
146 vic.setAllowed((ContactList) dossier.getFullParticipants().getVoteIParticipants());
148 marker.
put(
"vic", vic);
153 sic.setEntityPath(DossierPU.getObjectPath(issue));
154 marker.
put(
"sic", sic);
156 if(showDescriptions) {
158 dic.setEntityPath(DossierPU.getObjectPath(issue));
159 marker.
put(
"dic", dic);
162 marker.
put(
"files",
new FileAttach(DossierPU.getObjectPath(issue)));
165 private String getItemLink(Issue issue,
int page) {
166 return ElephantContext.getRootWebPath() + KnowledgeBaseDashboard.createLink(issue);
169 private String getPageLink(
int page) {
173 private String getIssueClass(Issue issue) {
175 (issue.getStatus().equals(IssueStatus.STATUS_NEW) ?
" new" :
"") +
176 (issue.getStatus().equals(IssueStatus.STATUS_STARTED) ?
" started" :
"") +
177 (issue.getStatus().equals(IssueStatus.STATUS_INCOMPLETE) ?
" incomplete" :
"") +
178 (issue.getStatus().equals(IssueStatus.STATUS_REOPENED) ?
" reopened" :
"") +
179 (issue.getStatus().equals(IssueStatus.STATUS_REUNION) ?
" reunion" :
"") +
180 (issue.getStatus().equals(IssueStatus.STATUS_FROZEN) ?
" frozen" :
"") +
181 (issue.getStatus().equals(IssueStatus.STATUS_RESOLVED) ?
" resolved" :
"") +
182 (issue.getStatus().equals(IssueStatus.STATUS_VERIFIED) ?
" verified" :
"") +
183 (issue.getStatus().equals(IssueStatus.STATUS_CLOSED) ?
" closed" :
"") +
185 (issue.getType().equals(IssueType.TYPE_DEFECT) ?
" defect" :
"") +
186 (issue.getType().equals(IssueType.TYPE_ENHANCEMENT) ?
" enhancement" :
"") +
187 (issue.getType().equals(IssueType.TYPE_FEATURE) ?
" feature" :
"") +
188 (issue.getType().equals(IssueType.TYPE_NONCONFORMITY) ?
" nonconformity" :
"") +
189 (issue.getType().equals(IssueType.TYPE_PATCH) ?
" patch" :
"") +
190 (issue.getType().equals(IssueType.TYPE_PREVENTION) ?
" prevention" :
"") +
191 (issue.getType().equals(IssueType.TYPE_QUESTION) ?
" question" :
"") +
192 (issue.getType().equals(IssueType.TYPE_TASK) ?
" task" :
"") +
193 (issue.getType().equals(IssueType.TYPE_DOCUMENT) ?
" document" :
"") +
194 (issue.getType().equals(IssueType.TYPE_BESTPRACTICE) ?
" bestpractice" :
"") +
195 (issue.getType().equals(IssueType.TYPE_PROCESS) ?
" process" :
"") +
196 (issue.getType().equals(IssueType.TYPE_PROPOSITION) ?
" proposition" :
"") +
198 (issue.getResolution().equals(IssueResolution.RESOLUTION_DUPLICATED) ?
" duplicated" :
"") +
199 (issue.getResolution().equals(IssueResolution.RESOLUTION_FIXED) ?
" fixed" :
"") +
200 (issue.getResolution().equals(IssueResolution.RESOLUTION_INVALID) ?
" invalid" :
"") +
201 (issue.getResolution().equals(IssueResolution.RESOLUTION_MOVED) ?
" moved" :
"") +
202 (issue.getResolution().equals(IssueResolution.RESOLUTION_NONE) ?
" none" :
"") +
203 (issue.getResolution().equals(IssueResolution.RESOLUTION_WONTFIX) ?
" wontfix" :
"") +
204 (issue.getResolution().equals(IssueResolution.RESOLUTION_WORKSFORME) ?
" worksforme" :
"");
207 private String getSummaryTemplate() {
208 return Strings.isBlank(summaryTemplate) ?
"prSummary" : summaryTemplate;
211 private String getFullTemplate() {
212 return Strings.isBlank(fullTemplate) ?
"prFull" : fullTemplate;
void archive(long archive)
IContact getByParticipant()
AttributeSupport getAttributes()
static AttributeItem getFromParameter(IConstructor constructor, String name, String defaultValue)
void process(String rootTmpl, String tmpl)
Object put(Object key, Object value)
IConstructor getConstructor()