BrightSide Workbench Full Report + Source Code
org.turro.dossier.www.KnowledgeBaseDashboard Class Reference
Inheritance diagram for org.turro.dossier.www.KnowledgeBaseDashboard:
Collaboration diagram for org.turro.dossier.www.KnowledgeBaseDashboard:

Public Member Functions

void loadData () throws ServletException, IOException
 
void startConstruction () throws ServletException, IOException
 
String getStart ()
 
String getEnd ()
 
- Public Member Functions inherited from org.turro.elephant.impl.abstracts.AbstractElement
 AbstractElement ()
 
String getId ()
 
String getType ()
 
String getTitle ()
 
void setTitle (String title)
 
Collection< String > getMetas ()
 
void setMetas (Collection< String > metas)
 
ElContext getContext ()
 
IConstructor getConstructor ()
 
void setConfiguration (IConstructor constructor, ElContext context)
 
String getStartTitle ()
 
String getEndTitle ()
 
String getStartBody ()
 
String getEndBody ()
 
String getStartFooter ()
 
String getEndFooter ()
 
String getStartOption ()
 
String getEndOption ()
 
boolean canDisplay ()
 
boolean isSelectable ()
 
boolean isInRole ()
 
boolean canPrint ()
 
String getElementFolder ()
 
boolean isOriginalContext ()
 
void setRootCategories (ElContext root)
 
String getTypeName ()
 
AttributeSupport getAttributes ()
 
void applyChanges ()
 
void populateFromParent ()
 
void setDefaultMetas ()
 
void setConfiguration (Element conf, Element factory)
 

Static Public Member Functions

static String createLink (String searchValue, boolean onlyTitle, Set< IssueType > type, Set< IssueStatus > status, Set< IssueResolution > resolution, Long dossierId)
 
static String createLink (Issue issue)
 

Protected Attributes

String sclass
 
List< String > issueTypes
 
long categoryId
 
int count
 
boolean allowInterest
 
KnowledgeBaseQuery kbq
 
KnowledgeBaseList kbl
 
IContact contact
 
Long item
 
Issue issue
 
- Protected Attributes inherited from org.turro.elephant.impl.abstracts.AbstractElement
IConstructor constructor
 
ElContext context
 
AttributeSupport attrSupport
 
Element conf = null
 
String[] types
 
String title
 
Collection< String > metas
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 68 of file KnowledgeBaseDashboard.java.

Member Function Documentation

◆ createLink() [1/2]

static String org.turro.dossier.www.KnowledgeBaseDashboard.createLink ( Issue  issue)
static

Definition at line 342 of file KnowledgeBaseDashboard.java.

342  {
343  StringBuilder sb = new StringBuilder();
344  String sep = "?";
345  sb.append("/user/kbase");
346  if(issue != null) {
347  sb.append(sep); sep = "&";
348  sb.append(MarkerHelper.setObfuscatedPars("item=" + issue.getId()));
349  }
350  return sb.toString();
351  }
Here is the call graph for this function:

◆ createLink() [2/2]

static String org.turro.dossier.www.KnowledgeBaseDashboard.createLink ( String  searchValue,
boolean  onlyTitle,
Set< IssueType type,
Set< IssueStatus status,
Set< IssueResolution resolution,
Long  dossierId 
)
static

Definition at line 302 of file KnowledgeBaseDashboard.java.

304  {
305  StringBuilder sb = new StringBuilder();
306  String sep = "?";
307  sb.append("/user/kbase");
308  if(!Strings.isBlank(searchValue)) {
309  sb.append(sep); sep = "&";
310  try {
311  sb.append("search-value=").append(URLEncoder.encode(searchValue, "UTF-8"));
312  } catch (UnsupportedEncodingException ex) {
313  Logger.getLogger(KnowledgeBaseDashboard.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
314  }
315  }
316  if(onlyTitle) {
317  sb.append(sep); sep = "&";
318  sb.append("only-title=true");
319  }
320  if(dossierId != null && dossierId > 0) {
321  sb.append(sep); sep = "&";
322  sb.append("dossier-id=" + dossierId);
323  }
324  if(type != null && !type.isEmpty()) {
325  sb.append(sep); sep = "&";
326  sb.append("type=");
327  sb.append(CollectionUtil.from(type).getCSV(t -> t.toString()));
328  }
329  if(status != null && !status.isEmpty()) {
330  sb.append(sep); sep = "&";
331  sb.append("status=");
332  sb.append(CollectionUtil.from(status).getCSV(t -> t.toString()));
333  }
334  if(resolution != null && !resolution.isEmpty()) {
335  sb.append(sep); sep = "&";
336  sb.append("resolution=");
337  sb.append(CollectionUtil.from(resolution).getCSV(t -> t.toString()));
338  }
339  return sb.toString();
340  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getEnd()

String org.turro.dossier.www.KnowledgeBaseDashboard.getEnd ( )

Reimplemented from org.turro.elephant.impl.abstracts.AbstractElement.

Definition at line 199 of file KnowledgeBaseDashboard.java.

199  {
200  return "</div>";
201  }
Here is the caller graph for this function:

◆ getStart()

String org.turro.dossier.www.KnowledgeBaseDashboard.getStart ( )

Reimplemented from org.turro.elephant.impl.abstracts.AbstractElement.

Definition at line 194 of file KnowledgeBaseDashboard.java.

194  {
195  return "<div class='" + sclass + "dossier-web'>";
196  }
Here is the caller graph for this function:

◆ loadData()

void org.turro.dossier.www.KnowledgeBaseDashboard.loadData ( ) throws ServletException, IOException

This method loads element's data. It gets called within IConstructor.startConstruction() and before element's startConstruction() method.

Exceptions
javax.servlet.ServletException
java.io.IOException

Implements org.turro.elephant.context.IElement.

Definition at line 82 of file KnowledgeBaseDashboard.java.

82  {
83  sclass = getAttributes().getAttributeValue("attrib:sclass", "");
84  categoryId = getAttributes().getAttributeIntegerValue("attrib:categoryId", 0);
85  dossierId = getAttributes().getAttributeIntegerValue("attrib:dossierId", 0);
86  // TYPE_DEFECT,TYPE_ENHANCEMENT,TYPE_FEATURE,TYPE_NONCONFORMITY,TYPE_PREVENTION,TYPE_TASK,TYPE_PATCH,TYPE_QUESTION,TYPE_DOCUMENT,TYPE_BESTPRACTICE,TYPE_PROCES,TYPE_PROPOSITION
87  issueTypes = getAttributes().getAttributeListValue("attrib:issueTypes", "");
88  // STATUS_NEW,STATUS_STARTED,STATUS_INCOMPLETE,STATUS_REOPENED,STATUS_REUNION,STATUS_FROZEN,STATUS_RESOLVED,STATUS_VERIFIED,STATUS_CLOSED
89  issueStatus = getAttributes().getAttributeListValue("attrib:issueStatus", "");
90  count = getAttributes().getAttributeIntegerValue("attrib:count", 10);
91  allowInterest = getAttributes().getAttributeBooleanValue("attrib:allowInterest", true);
92  allowComments = getAttributes().getAttributeBooleanValue("attrib:allowComments", true);
93  allowVotes = getAttributes().getAttributeBooleanValue("attrib:allowVotes", true);
94  showDescriptions = getAttributes().getAttributeBooleanValue("attrib:showDescriptions", true);
95  showFiles = getAttributes().getAttributeBooleanValue("attrib:showFiles", true);
96  fullTemplate = getAttributes().getAttributeValue("attrib:fullTemplate", "");
97  summaryTemplate = getAttributes().getAttributeValue("attrib:summaryTemplate", "");
98  issuePath = getAttributes().getAttributeValue("attrib:issuePath", "");
99 
100  contact = Authentication.getIContact();
101  kbq = new KnowledgeBaseQuery();
102  kbq.setSearchValue(AttributeItem.getFromParameter(getConstructor(), "search-value", "").getValue());
103  kbq.setOnlyTitle(AttributeItem.getFromParameter(getConstructor(), "only-title", null).getBooleanValue(false));
104  kbq.setMaxResults(AttributeItem.getFromParameter(getConstructor(), "max-results", null).getIntegerValue(300));
105  kbq.setTypes(AttributeItem.getFromParameter(getConstructor(), "type", null).getEnumSet(IssueType.class));
106  kbq.setStatus(AttributeItem.getFromParameter(getConstructor(), "status", null).getEnumSet(IssueStatus.class));
107  kbq.setResolutions(AttributeItem.getFromParameter(getConstructor(), "resolution", null).getEnumSet(IssueResolution.class));
108  kbq.setDossierId(AttributeItem.getFromParameter(getConstructor(), "dossier-id", null).getLongValue(0));
109 
110  KeyValueMap kvm = MarkerHelper.getObfuscatedParameters();
111  if(kvm != null && !kvm.isEmpty() && kvm.containsKey("item")) {
112  item = kvm.get(Long.class, "item");
113  } else {
114  item = (Long) ObjectString.parseString(getConstructor().getParameter("item"), Long.class, true);
115  }
116 
117  if(item > 0) {
118  issue = new DossierPU().find(Issue.class, item);
119  if(!canLink(new IssueWrapper(issue, contact))) {
120  issue = null;
121  }
122  }
123 
124  if(issue != null) {
126  } else {
127  item = 0L;
128  if(categoryId > 0) {
129  Category category = new DossierPU().find(Category.class, categoryId);
130  kbq.setCategory(category);
131  }
132  if(dossierId > 0) {
133  Dossier dossier = new DossierPU().find(Dossier.class, dossierId);
134  kbq.setDossier(dossier);
135  }
136  kbq.setByParticipant(null);
137  kbl = kbq.getResultList();
138  }
139 
140  }
void setResolutions(Set< IssueResolution > resolutions)
void setByParticipant(IContact byParticipant)
void setStatus(Set< IssueStatus > status)
Here is the call graph for this function:

◆ startConstruction()

void org.turro.dossier.www.KnowledgeBaseDashboard.startConstruction ( ) throws ServletException, IOException

This method start element's construction. It gets called within IConstructor.startConstruction().

Exceptions
javax.servlet.ServletException
java.io.IOException

Implements org.turro.elephant.context.IElement.

Definition at line 143 of file KnowledgeBaseDashboard.java.

143  {
144  PrintWriter out = getConstructor().getOut();
145  out.print(getStart());
146  out.print(getStartBody());
147 
148  ElephantMarker marker = new ElephantMarker(getConstructor());
149  marker.put("searchValue", kbq.getSearchValue());
150  marker.put("onlyTitle", kbq.isOnlyTitle());
151  marker.put("maxResults", kbq.getMaxResults());
152  marker.put("types", kbq.getTypes());
153  marker.put("status", kbq.getStatus());
154  marker.put("resolutions", kbq.getResolutions());
155  marker.put("ntypes", EnumSet.complementOf(EnumSet.copyOf(kbq.getTypes())));
156  marker.put("nstatus", EnumSet.complementOf(EnumSet.copyOf(kbq.getStatus())));
157  marker.put("nresolutions", EnumSet.complementOf(EnumSet.copyOf(kbq.getResolutions())));
158  marker.put("dossierId", kbq.getDossierId());
159  if(item > 0) {
160  IssueWrapper wrapper = new IssueWrapper(issue, contact);
161  prepareValues(marker, wrapper.getIssue(), 0);
162  marker.put("wrapper", wrapper);
163  marker.put("issue", wrapper.getIssue());
164  if(contact.isWebUser() && (Application.getApplication().isInRole("issue:edit") || wrapper.isFullParticipant())) {
165  marker.put("addInfo", AddInformationCtrl.addInformation(wrapper, getItemLink(wrapper.getIssue(), 0)));
166  }
167  marker.process("issue", getFullTemplate());
168  } else if(kbl.isEmpty()) {
169  marker.put("divider", false);
170  marker.put("header", true);
171  marker.put("footer", true);
172  marker.put("empty", true);
173  marker.process("issue", getSummaryTemplate());
174  } else {
175  int index = 0;
176  marker.put("empty", false);
177  for(IssueWrapper wrapper : kbl) {
178  marker.put("divider", index > 0);
179  marker.put("header", index == 0);
180  marker.put("footer", index == kbl.size() - 1);
181  prepareValues(marker, wrapper.getIssue(), 0);
182  marker.put("wrapper", wrapper);
183  marker.put("issue", wrapper.getIssue());
184  marker.process("issue", getSummaryTemplate());
185  index++;
186  }
187  }
188 
189  out.print(getEndBody());
190  out.print(getEnd());
191  }
Here is the call graph for this function:

Member Data Documentation

◆ allowInterest

boolean org.turro.dossier.www.KnowledgeBaseDashboard.allowInterest
protected

Definition at line 74 of file KnowledgeBaseDashboard.java.

◆ categoryId

long org.turro.dossier.www.KnowledgeBaseDashboard.categoryId
protected

Definition at line 72 of file KnowledgeBaseDashboard.java.

◆ contact

IContact org.turro.dossier.www.KnowledgeBaseDashboard.contact
protected

Definition at line 77 of file KnowledgeBaseDashboard.java.

◆ count

int org.turro.dossier.www.KnowledgeBaseDashboard.count
protected

Definition at line 73 of file KnowledgeBaseDashboard.java.

◆ issue

Issue org.turro.dossier.www.KnowledgeBaseDashboard.issue
protected

Definition at line 79 of file KnowledgeBaseDashboard.java.

◆ issueTypes

List<String> org.turro.dossier.www.KnowledgeBaseDashboard.issueTypes
protected

Definition at line 71 of file KnowledgeBaseDashboard.java.

◆ item

Long org.turro.dossier.www.KnowledgeBaseDashboard.item
protected

Definition at line 78 of file KnowledgeBaseDashboard.java.

◆ kbl

KnowledgeBaseList org.turro.dossier.www.KnowledgeBaseDashboard.kbl
protected

Definition at line 76 of file KnowledgeBaseDashboard.java.

◆ kbq

KnowledgeBaseQuery org.turro.dossier.www.KnowledgeBaseDashboard.kbq
protected

Definition at line 75 of file KnowledgeBaseDashboard.java.

◆ sclass

String org.turro.dossier.www.KnowledgeBaseDashboard.sclass
protected

Definition at line 70 of file KnowledgeBaseDashboard.java.


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