19 package org.turro.jpa;
21 import java.util.Collection;
22 import org.turro.string.Strings;
23 import org.turro.collections.ItemOf;
24 import org.turro.collections.SetOf;
25 import org.turro.elephant.db.WhereClause;
26 import org.turro.path.Path;
27 import org.turro.reflection.JSONSerializer;
40 public static boolean isEmpty(
Dao dao, String table, String condition) {
45 public static boolean isEmpty(
Dao dao, String table, String condition, Object... pars) {
46 Long
count =
count(dao, table, condition, pars);
50 public static Long
count(
Dao dao, String table) {
55 public static Long
count(
Dao dao, String table, String condition) {
60 public static Long
count(
Dao dao, String table, String condition, Object... pars) {
73 public String getFrom(String e) {
81 for(String s : values) {
82 if(quoted) s =
"\"" + s +
"\"";
83 result += (String) (Strings.isBlank(result) ? s :
"," + s);
89 return new Path(e).getNode(1);
92 public static String
getJson(
Dao dao, Class javaClass, Object identifier,
final JSONSerializer json) {
93 final StringBuilder sb =
new StringBuilder();
96 public void before(Object value) {
99 public void after(Object oldValue, Object newValue) {
100 json.setObject(newValue);
101 sb.append(json.toJson());
104 return sb.length() > 0 ? sb.toString() :
null;
static String getInClauseFromPaths(Collection< String > paths, boolean quoted)
static String getCommaSeparatedValues(Collection< String > values, boolean quoted)
static Long count(Dao dao, String table, String condition)
static Long count(Dao dao, WhereClause wc)
static boolean isEmpty(Dao dao, String table)
static Long count(Dao dao, String table)
static boolean isEmpty(Dao dao, String table, String condition)
static Long count(Dao dao, String table, String condition, Object... pars)
static String getJson(Dao dao, Class javaClass, Object identifier, final JSONSerializer json)
static boolean isEmpty(Dao dao, String table, String condition, Object... pars)
static String getIdentifierFromPath(String e)
Object getSingleResultOrNull(SqlClause sc)