19 package org.turro.dossier.content;
21 import java.io.StringWriter;
22 import java.io.Writer;
23 import java.util.Arrays;
24 import org.turro.action.content.AbstractContentProvider;
25 import org.turro.action.content.ContentRenderer;
26 import org.turro.action.content.IContentIterator;
27 import org.turro.annotation.ContentProvider;
28 import org.turro.command.MacroCommand;
29 import org.turro.dossier.www.IssueOrdering;
30 import org.turro.elephant.context.HeadlessApplication;
31 import org.turro.plugin.contacts.IContact;
44 private void addCommands() {
46 MacroCommand mc =
new MacroCommand(
"dossiers");
47 mc.addParameter(
"status",
"onwork",
true)
48 .setPossibleValuesString(
"onwork|closed|all");
49 mc.addParameter(
"context",
"",
true);
50 mc.addParameter(
"categoryIds",
"",
true);
51 mc.addParameter(
"dossierId", Long.valueOf(0),
true);
52 mc.addParameter(
"count", Integer.valueOf(10),
true);
53 mc.addParameter(
"restricted", Boolean.FALSE,
true);
54 mc.addParameter(
"direct", Boolean.FALSE,
true);
55 mc.addParameter(
"related", Boolean.FALSE,
true);
56 mc.addParameter(
"template",
"summary",
true);
60 mc =
new MacroCommand(
"projects");
61 mc.addParameter(
"status",
"onwork",
false)
62 .setPossibleValuesString(
"onwork|closed|all");
63 mc.addParameter(
"context",
"",
false);
64 mc.addParameter(
"categoryIds",
"",
true);
65 mc.addParameter(
"dossierId", Long.valueOf(0),
true);
66 mc.addParameter(
"count", Integer.valueOf(10),
true);
67 mc.addParameter(
"restricted", Boolean.FALSE,
true);
68 mc.addParameter(
"direct", Boolean.FALSE,
true);
69 mc.addParameter(
"related", Boolean.FALSE,
true);
70 mc.addParameter(
"template",
"summary",
true);
74 mc =
new MacroCommand(
"issues");
75 mc.addParameter(
"status",
"onwork",
false)
76 .setPossibleValuesString(
"onwork|closed|all");
77 mc.addParameter(
"context",
"",
false);
78 mc.addParameter(
"categoryId", Long.valueOf(0),
true);
79 mc.addParameter(
"dossierId", Long.valueOf(0),
true);
80 mc.addParameter(
"count", Integer.valueOf(10),
true);
81 mc.addParameter(
"restricted", Boolean.FALSE,
true);
82 mc.addParameter(
"template",
"summary",
true);
86 mc =
new MacroCommand(
"workload");
87 mc.addParameter(
"context",
"",
false);
88 mc.addParameter(
"count", Integer.valueOf(10),
true);
89 mc.addParameter(
"template",
"summary",
true);
93 mc =
new MacroCommand(
"kb");
94 mc.addParameter(
"context",
"",
false);
95 mc.addParameter(
"count", Integer.valueOf(10),
true);
96 mc.addParameter(
"template",
"summary",
true);
102 if(macroCommand.itsMe(
"dossiers(") || macroCommand.itsMe(
"projects(")) {
103 StringWriter sw =
new StringWriter();
107 macroCommand.getParameterValue(String.class,
"context"));
108 if(macroCommand.getParameterValue(String.class,
"status").equals(
"onwork")) {
109 di.
setDossierStatus(Arrays.asList(
"DOSSIER_OPENED,DOSSIER_FROZEN".split(
",")));
110 }
else if(macroCommand.getParameterValue(String.class,
"status").equals(
"closed")) {
113 if(macroCommand.itsMe(
"projects(")) {
117 di.
setDossierId(macroCommand.getParameterValue(Long.class,
"dossierId"));
118 di.
setPage(macroCommand.getParameterValue(Integer.class,
"count"));
127 di.
setRestricted(macroCommand.getParameterValue(Boolean.class,
"restricted"));
128 di.
setDirect(macroCommand.getParameterValue(Boolean.class,
"direct"));
129 if(macroCommand.getParameterValue(Boolean.class,
"related")) {
137 return writer.toString();
139 }
else if(macroCommand.itsMe(
"issues(")) {
140 StringWriter sw =
new StringWriter();
144 macroCommand.getParameterValue(String.class,
"context"));
145 if(macroCommand.getParameterValue(String.class,
"status").equals(
"onwork")) {
146 ii.
setIssueStatus(Arrays.asList(
"STATUS_NEW,STATUS_STARTED,STATUS_INCOMPLETE,STATUS_REOPENED,STATUS_REUNION,STATUS_FROZEN,STATUS_RESOLVED,STATUS_VERIFIED".split(
",")));
147 }
else if(macroCommand.getParameterValue(String.class,
"status").equals(
"closed")) {
150 ii.
setCategoryId(macroCommand.getParameterValue(Long.class,
"categoryId"));
151 ii.
setDossierId(macroCommand.getParameterValue(Long.class,
"dossierId"));
152 ii.
setPage(macroCommand.getParameterValue(Integer.class,
"count"));
160 ii.
setRestricted(macroCommand.getParameterValue(Boolean.class,
"restricted"));
162 if(macroCommand.getParameterValue(Boolean.class,
"restricted")) {
170 return writer.toString();
172 }
else if(macroCommand.itsMe(
"workload(")) {
173 StringWriter sw =
new StringWriter();
177 macroCommand.getParameterValue(String.class,
"context"));
178 wi.
setPage(macroCommand.getParameterValue(Integer.class,
"count"));
191 return writer.toString();
193 }
else if(macroCommand.itsMe(
"kb(")) {
194 StringWriter sw =
new StringWriter();
198 macroCommand.getParameterValue(String.class,
"context"));
199 wi.
setPage(macroCommand.getParameterValue(Integer.class,
"count"));
212 return writer.toString();
final List< MacroCommand > commands
void setSummaryTemplate(String summaryTemplate)
void setNavigatorTop(boolean navigatorTop)
void setNavigatorBottom(boolean navigatorBottom)
void setDossierTypes(List< String > dossierTypes)
void setAllowedCategories(String allowedCategories)
void setDirect(boolean direct)
void setRelated(Collection< IContact > related)
void setDossierId(long dossierId)
void setDossierStatus(List< String > dossierStatus)
ContentRenderer loadCommand(MacroCommand macroCommand, IContact contact, String idContext)
void setDossierId(long dossierId)
void setIssueStatus(List< String > issueStatus)
void setOrderBy(IssueOrdering orderBy)
void setCategoryId(long categoryId)
static HeadlessApplication getInstance()
IConstructor getConstructor()
void setAllowAttachments(boolean allowAttachments)
void setAllowPolls(boolean allowPolls)
void setAllowVotes(boolean allowVotes)
void setAllowInterest(boolean allowInterest)
void setAllowComments(boolean allowComments)
void setAllowDescriptions(boolean allowDescriptions)
void setAllowAttachments(boolean allowAttachments)
void setAllowInterest(boolean allowInterest)
void setAllowDescriptions(boolean allowDescriptions)
void setRestricted(boolean restricted)
void setAllowComments(boolean allowComments)
void setNavigatorBottom(boolean navigatorBottom)
void setSummaryTemplate(String summaryTemplate)
void setNavigatorTop(boolean navigatorTop)
void setAllowVotes(boolean allowVotes)
void setAllowFiles(boolean allowFiles)
void setAllowPolls(boolean allowPolls)