BrightSide Workbench Full Report + Source Code
org.turro.erp.resource.ResourceCombobox Class Reference
Inheritance diagram for org.turro.erp.resource.ResourceCombobox:
Collaboration diagram for org.turro.erp.resource.ResourceCombobox:

Public Member Functions

boolean isOnlyActive ()
 
void setOnlyActive (boolean onlyActive)
 
long getContractId ()
 
void setContractId (long contractId)
 
void populateList (String value, LinkedList list, int nRows)
 
String getTextFromObject (Resource value)
 
- 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 34 of file ResourceCombobox.java.

Member Function Documentation

◆ getContractId()

long org.turro.erp.resource.ResourceCombobox.getContractId ( )

Definition at line 47 of file ResourceCombobox.java.

47  {
48  return contractId;
49  }

◆ getTextFromObject()

String org.turro.erp.resource.ResourceCombobox.getTextFromObject ( Resource  value)

Definition at line 82 of file ResourceCombobox.java.

82  {
83  return value.getName();
84  }
Here is the call graph for this function:

◆ isOnlyActive()

boolean org.turro.erp.resource.ResourceCombobox.isOnlyActive ( )

Definition at line 39 of file ResourceCombobox.java.

39  {
40  return onlyActive;
41  }

◆ populateList()

void org.turro.erp.resource.ResourceCombobox.populateList ( String  value,
LinkedList  list,
int  nRows 
)

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

Definition at line 56 of file ResourceCombobox.java.

56  {
57  EntityManager em = new ErpPU().getEntityManager();
58  try {
59  WhereClause wc = SQLHelper.getWhereClause(new String[]{
60  "res.name"
61  }, value);
62  Query q = em.createQuery(
63  "select res from Resource res " +
64  "where active = :active " +
65  (contractId > 0 ? "and (res.idContract = " + contractId + " or res.idContract == 0) " : "") +
66  wc.getClause() +
67  " order by res.name"
68  );
69  wc.addNamedValue("active", onlyActive);
70  q.setMaxResults(nRows);
71  wc.setNamedParameters(q);
72  List<Resource> l = q.getResultList();
73  for(Object o : l) {
74  list.add(((Resource) o).getName());
75  }
76  } finally {
77  em.close();
78  }
79  }
Here is the call graph for this function:

◆ setContractId()

void org.turro.erp.resource.ResourceCombobox.setContractId ( long  contractId)

Definition at line 51 of file ResourceCombobox.java.

51  {
52  this.contractId = contractId;
53  }

◆ setOnlyActive()

void org.turro.erp.resource.ResourceCombobox.setOnlyActive ( boolean  onlyActive)

Definition at line 43 of file ResourceCombobox.java.

43  {
44  this.onlyActive = onlyActive;
45  }

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