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

Public Member Functions

void populateList (String value, LinkedList list, int nRows)
 
String getTextFromObject (Issue value)
 
String getNameFromText (String text)
 
String getDossierFromText (String text)
 
long getIdFromText (String text)
 
- Public Member Functions inherited from org.turro.zkoss.input.GenericCombobox< V >
 GenericCombobox ()
 
getObjectValue ()
 
void setObjectValue (V value)
 
boolean isAllowNotInModelValues ()
 
void setAllowNotInModelValues (boolean allowNotInModelValues)
 
void refreshModel ()
 
abstract String getTextFromObject (V value)
 
Object getRelatedEntity ()
 
void setRelatedEntity (Object relatedEntity)
 
void render (Comboitem item, Object data, int index) throws Exception
 

Detailed Description

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

Definition at line 35 of file IssueCombobox.java.

Member Function Documentation

◆ getDossierFromText()

String org.turro.dossier.issue.IssueCombobox.getDossierFromText ( String  text)

Definition at line 84 of file IssueCombobox.java.

84  {
85  String[] s = text.split(Chars.forward().regexp().spaced().toString());
86  if(s.length == 2) {
87  // name - dossier
88  return s[1];
89  }
90  return getNameFromText(text);
91  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getIdFromText()

long org.turro.dossier.issue.IssueCombobox.getIdFromText ( String  text)

Definition at line 93 of file IssueCombobox.java.

93  {
94  long id = 0;
95  try {
96  id = Long.valueOf(text);
97  } catch(Exception ex) {}
98  return id;
99  }
Here is the caller graph for this function:

◆ getNameFromText()

String org.turro.dossier.issue.IssueCombobox.getNameFromText ( String  text)

Definition at line 75 of file IssueCombobox.java.

75  {
76  String[] s = text.split(Chars.forward().regexp().spaced().toString());
77  if(s.length == 2) {
78  // name - dossier
79  return s[0];
80  }
81  return text;
82  }
Here is the caller graph for this function:

◆ getTextFromObject()

String org.turro.dossier.issue.IssueCombobox.getTextFromObject ( Issue  value)

Definition at line 68 of file IssueCombobox.java.

68  {
69  return value.getDescription() +
70  (value.getDossier() != null ?
71  Chars.forward().spaced() + value.getDossier().getDescription() :
72  "");
73  }
Here is the call graph for this function:

◆ populateList()

void org.turro.dossier.issue.IssueCombobox.populateList ( String  value,
LinkedList  list,
int  nRows 
)

Reimplemented from org.turro.zkoss.input.GenericCombobox< V >.

Definition at line 38 of file IssueCombobox.java.

38  {
39  boolean all = Application.getApplication().isInRole("issue:all");
40  Dao dao = new DossierPU();
41  long id = getIdFromText(value);
42  WhereClause wc = new WhereClause();
43  wc.addClause("select distinct issue from Issue as issue");
44  if(id > 0) {
45  wc.addClause("where issue.id = :id");
46  wc.addNamedValue("id", id);
47  } else {
48  wc.addClause("where 1=1");
49  if(!Strings.isBlank(value)) {
50  wc.addClause("and (");
51  wc.setPrefix("");
52  wc.addLikeFields(new String[] {"issue.description"}, getNameFromText(value));
53  wc.setPrefix("or");
54  wc.addLikeFields(new String[] {"issue.dossier.description"}, getDossierFromText(value));
55  wc.setPrefix(null);
56  wc.addClause(")");
57  }
58  wc.addClause("order by issue.description");
59  }
60  for(Object o : dao.getResultList(wc, nRows)) {
61  if(all || new IssueWrapper((Issue) (o)).isFullParticipant()) {
62  list.add((Issue) o);
63  }
64  }
65  }
Here is the call graph for this function:

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