18 package org.turro.erp.resource;
20 import java.util.LinkedList;
21 import java.util.List;
22 import javax.persistence.EntityManager;
23 import javax.persistence.Query;
24 import org.turro.elephant.db.SQLHelper;
25 import org.turro.elephant.db.WhereClause;
26 import org.turro.erp.db.ErpPU;
27 import org.turro.erp.entity.Resource;
28 import org.turro.zkoss.input.GenericCombobox;
36 private boolean onlyActive =
true;
37 private long contractId;
44 this.onlyActive = onlyActive;
52 this.contractId = contractId;
56 public void populateList(String value, LinkedList list,
int nRows) {
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) " :
"") +
70 q.setMaxResults(nRows);
72 List<Resource> l = q.getResultList();
static WhereClause getWhereClause(String[] fields, String value)
void setNamedParameters(Query q)
void addNamedValue(String name, Object value)
void setContractId(long contractId)
String getTextFromObject(Resource value)
void setOnlyActive(boolean onlyActive)
void populateList(String value, LinkedList list, int nRows)
EntityManager getEntityManager()