BrightSide Workbench Full Report + Source Code
org.turro.jpa.entity.EntityWebUrls Class Reference

Static Public Member Functions

static Object getEntity (String entityRoot, String url)
 
static String getEntityPath (String entityRoot, String url)
 
static String getUrlFromEntity (Object entity)
 
static String getUrl (String entityPath)
 
static EntityWebUrl addWebUrl (String entityPath, String url)
 
static void removeEntityUrl (String entityPath)
 
static boolean existsEntity (String entityPath)
 
static boolean existsAnyOf (String entityPath)
 
static boolean sameURL (String url1, String url2)
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 32 of file EntityWebUrls.java.

Member Function Documentation

◆ addWebUrl()

static EntityWebUrl org.turro.jpa.entity.EntityWebUrls.addWebUrl ( String  entityPath,
String  url 
)
static

Definition at line 65 of file EntityWebUrls.java.

65  {
66  removeEntityUrl(entityPath);
67  EntityWebUrl ewu = new EntityWebUrl();
68  ewu.setEntityPath(entityPath);
69  ewu.setEntityUrl(url);
70  return new ElephantPU().saveObject(ewu);
71  }
static void removeEntityUrl(String entityPath)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ existsAnyOf()

static boolean org.turro.jpa.entity.EntityWebUrls.existsAnyOf ( String  entityPath)
static

Definition at line 91 of file EntityWebUrls.java.

91  {
92  Dao dao = new ElephantPU();
93  WhereClause wc = new WhereClause();
94  wc.addClause("select count(w) from EntityWebUrl w");
95  wc.addClause("where w.entityPath like :path");
96  wc.addNamedValue("path", entityPath + "%");
97  return ((Long) dao.getSingleResultOrNull(wc)) > 0;
98  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ existsEntity()

static boolean org.turro.jpa.entity.EntityWebUrls.existsEntity ( String  entityPath)
static

Definition at line 82 of file EntityWebUrls.java.

82  {
83  Dao dao = new ElephantPU();
84  WhereClause wc = new WhereClause();
85  wc.addClause("select w from EntityWebUrl w");
86  wc.addClause("where w.entityPath = :path");
87  wc.addNamedValue("path", entityPath);
88  return !dao.getResultList(wc).isEmpty();
89  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getEntity()

static Object org.turro.jpa.entity.EntityWebUrls.getEntity ( String  entityRoot,
String  url 
)
static

Definition at line 34 of file EntityWebUrls.java.

34  {
35  return Entities.getController(getEntityPath(entityRoot, url)).getEntity();
36  }
static String getEntityPath(String entityRoot, String url)
Here is the call graph for this function:

◆ getEntityPath()

static String org.turro.jpa.entity.EntityWebUrls.getEntityPath ( String  entityRoot,
String  url 
)
static

Definition at line 38 of file EntityWebUrls.java.

38  {
39  if(url.contains("?")) {
40  url = url.substring(0, url.indexOf("?"));
41  }
42  Dao dao = new ElephantPU();
43  WhereClause wc = new WhereClause();
44  wc.addClause("select w.entityPath from EntityWebUrl w");
45  wc.addClause("where w.entityUrl = :url");
46  wc.addNamedValue("url", url);
47  wc.addClause("and w.entityPath like :path");
48  wc.addNamedValue("path", entityRoot + "%");
49  return (String) dao.getSingleResultOrNull(wc);
50  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getUrl()

static String org.turro.jpa.entity.EntityWebUrls.getUrl ( String  entityPath)
static

Definition at line 56 of file EntityWebUrls.java.

56  {
57  Dao dao = new ElephantPU();
58  WhereClause wc = new WhereClause();
59  wc.addClause("select w.entityUrl from EntityWebUrl w");
60  wc.addClause("where w.entityPath = :path");
61  wc.addNamedValue("path", entityPath);
62  return (String) dao.getSingleResultOrNull(wc);
63  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getUrlFromEntity()

static String org.turro.jpa.entity.EntityWebUrls.getUrlFromEntity ( Object  entity)
static

Definition at line 52 of file EntityWebUrls.java.

52  {
53  return getUrl(Entities.getController(entity).getPath());
54  }
static String getUrl(String entityPath)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeEntityUrl()

static void org.turro.jpa.entity.EntityWebUrls.removeEntityUrl ( String  entityPath)
static

Definition at line 73 of file EntityWebUrls.java.

73  {
74  Dao dao = new ElephantPU();
75  WhereClause wc = new WhereClause();
76  wc.addClause("delete from EntityWebUrl");
77  wc.addClause("where entityPath = :path");
78  wc.addNamedValue("path", entityPath);
79  dao.executeUpdate(wc);
80  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sameURL()

static boolean org.turro.jpa.entity.EntityWebUrls.sameURL ( String  url1,
String  url2 
)
static

Definition at line 100 of file EntityWebUrls.java.

100  {
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;
104  }
Here is the caller graph for this function:

The documentation for this class was generated from the following file: