18 package org.turro.usual;
20 import java.util.List;
21 import javax.persistence.NoResultException;
22 import org.turro.string.Strings;
23 import org.turro.contacts.Usually;
24 import org.turro.contacts.db.ContactsPU;
25 import org.turro.jpa.Dao;
34 if(!Strings.isBlank(path)) {
35 if(path.length() > 255) {
36 path = path.substring(0, 255);
38 if(path.endsWith(
":null")) {
39 path = path.substring(0, path.length() - 4);
45 "select u from Usually as u " +
51 u = dao.saveObject(u);
52 }
catch(NoResultException ex) {
56 u = dao.saveObject(u);
64 if(!Strings.isBlank(path)) {
65 if(path.length() > 255) {
66 path = path.substring(0, 255);
71 "select u from Usually as u " +
76 }
catch(NoResultException ex) {}
87 if(!Strings.isBlank(path)) {
88 if(path.length() > 255) {
89 path = path.substring(0, 255);
93 List<Usually> l = dao.getResultList(
94 "select u from Usually as u " +
95 "where u.path like ? " +
97 " select max(u2.usages) from Usually as u2 " +
98 " where u2.path like ? " +
101 path +
"%", path +
"%"
106 }
catch(NoResultException ex) {}
113 return u ==
null ? null : u.
getPath().substring(path.length());
117 if(!Strings.isBlank(path)) {
118 if(path.length() > 255) {
119 path = path.substring(0, 255);
123 "delete from Usually " +
int executeUpdate(String query)
Object getSingleResult(WhereClause wc)
static Usually getUsage(String path)
static Usually addUsage(String path)
static Usually getMostUsed(String path)
static void clearUsuals(String path)
static String getMostUsedvalue(String path)
static long getUsageCount(String path)