19 package org.turro.fieldit;
21 import java.util.Collection;
22 import java.util.Date;
23 import java.util.List;
24 import org.turro.string.Strings;
25 import org.turro.contacts.FieldIt;
26 import org.turro.contacts.ValueIt;
27 import org.turro.contacts.db.ContactsPU;
28 import org.turro.entities.Entities;
29 import org.turro.i18n.I_;
30 import org.turro.jpa.Dao;
31 import org.turro.path.Path;
49 List l = dao.getResultList(
50 " select v from FieldIt v " +
69 List l = dao.getResultList(
70 " select v from ValueIt v " +
82 " select v from ValueIt v " +
83 " where path = ? and v.fieldIt = ? ",
84 new Object[] { path, field }
87 vi = field.createValue();
96 " select v from ValueIt v " +
97 " where path = ? and v.fieldIt.name = ? ",
98 new Object[] { path, field }
104 if(String.class.equals(javaClass)) {
105 return I_.
get(
"String");
106 }
else if(Long.class.equals(javaClass)) {
107 return I_.
get(
"Long integer");
108 }
else if(Double.class.equals(javaClass)) {
109 return I_.
get(
"Double");
110 }
else if(Date.class.equals(javaClass)) {
111 return I_.
get(
"Date");
112 }
else if(Boolean.class.equals(javaClass)) {
113 return I_.
get(
"Boolean");
114 }
else if(
StringList.class.equals(javaClass)) {
115 return I_.
get(
"String list");
117 return I_.
get(
"Auto fill list");
124 dao.
executeUpdate(
"delete from ValueIt where fieldIt = ?",
new Object[] { field });
133 }
else if(!Strings.isBlank(v.getId())) {
140 public static Collection<String>
related(String path) {
141 Path p =
new Path(path);
143 return dao.getResultList(
144 " select v.path from ValueIt v " +
145 " where path <> ? " +
146 " and path like ? " +
150 new Object[] { path, p.getRoot() +
"/" }
155 public static Collection<String>
search(String path, String value) {
156 Path p =
new Path(path);
158 return dao.getResultList(
159 " select v.path from ValueIt v " +
160 " where path like ? " +
161 " and v.value like ? ",
162 new Object[] { p.getRoot() +
"/", value }
170 return v ==
null ?
"" : v;
static IElephantEntity getController(String path)
static ValueItSet values(Object entity)
static ValueIt value(FieldIt field, String path)
static FieldItSet fields(Object entity)
static Collection< String > related(String path)
static ValueIt value(String field, String path)
static FieldItSet fields(String path)
static void saveValues(Collection< ValueIt > values)
static Object getFieldValue(String label, String entityPath)
static ValueItSet values(String path)
static Collection< String > search(String path, String value)
static String getLabel(Class javaClass)
static String get(String msg)
void deleteObject(Object obj)
int executeUpdate(String query)
Object getSingleResultOrNull(SqlClause sc)