18 package org.turro.contacts.util;
20 import org.turro.contacts.db.ContactsPU;
21 import org.turro.elephant.db.SQLHelper;
22 import org.turro.elephant.db.WhereClause;
23 import org.turro.jpa.Dao;
31 public static String
getConnector(String choices, String defaultChoice) {
34 wc.
addClause(
"select connector.description, count(connector.description)");
37 wc.
addClause(
"group by connector.description");
38 wc.
addClause(
"order by count(connector.description) DESC");
40 return (String) ((o ==
null || o.length == 0 || o[0] ==
null) ? defaultChoice : o[0]);
43 public static String
getAddress(String choices, String defaultChoice) {
46 wc.
addClause(
"select address.description, count(address.description)");
49 wc.
addClause(
"group by address.description");
50 wc.
addClause(
"order by count(address.description) DESC");
52 return (String) ((o ==
null || o.length == 0 || o[0] ==
null) ? defaultChoice : o[0]);
static String quoteTokensForIn(String inValue)
void addClause(String clause)
Object getSingleResult(WhereClause wc)