19 package org.turro.jpa.entity;
21 import org.turro.elephant.db.ElephantPU;
22 import org.turro.elephant.db.WhereClause;
23 import org.turro.elephant.entities.db.EntityWebUrl;
24 import org.turro.entities.Entities;
25 import org.turro.jpa.Dao;
26 import org.turro.util.CompareUtil;
34 public static Object
getEntity(String entityRoot, String url) {
39 if(url.contains(
"?")) {
40 url = url.substring(0, url.indexOf(
"?"));
44 wc.
addClause(
"select w.entityPath from EntityWebUrl w");
47 wc.
addClause(
"and w.entityPath like :path");
56 public static String
getUrl(String entityPath) {
59 wc.
addClause(
"select w.entityUrl from EntityWebUrl w");
60 wc.
addClause(
"where w.entityPath = :path");
85 wc.
addClause(
"select w from EntityWebUrl w");
86 wc.
addClause(
"where w.entityPath = :path");
88 return !dao.getResultList(wc).isEmpty();
94 wc.
addClause(
"select count(w) from EntityWebUrl w");
95 wc.
addClause(
"where w.entityPath like :path");
100 public static boolean sameURL(String url1, String url2) {
101 if(url1.endsWith(
"/")) url1 = url1.substring(0, url1.length() - 1);
102 if(url2.endsWith(
"/")) url2 = url2.substring(0, url2.length() - 1);
103 return CompareUtil.compare(url1, url2) == 0;
void addClause(String clause)
void addNamedValue(String name, Object value)
void setEntityUrl(String entityUrl)
void setEntityPath(String entityPath)
static IElephantEntity getController(String path)
int executeUpdate(String query)
Object getSingleResultOrNull(SqlClause sc)
static boolean existsAnyOf(String entityPath)
static void removeEntityUrl(String entityPath)
static EntityWebUrl addWebUrl(String entityPath, String url)
static boolean existsEntity(String entityPath)
static String getUrlFromEntity(Object entity)
static Object getEntity(String entityRoot, String url)
static boolean sameURL(String url1, String url2)
static String getUrl(String entityPath)
static String getEntityPath(String entityRoot, String url)