18 package org.turro.dossier.db;
20 import java.util.List;
21 import javax.persistence.EntityManager;
22 import javax.persistence.EntityManagerFactory;
23 import org.turro.string.Strings;
24 import org.turro.dossier.entity.Category;
25 import org.turro.dossier.entity.Dossier;
26 import org.turro.dossier.entity.Issue;
27 import org.turro.dossier.entity.IssueComment;
28 import org.turro.dossier.entity.IssueParticipant;
29 import org.turro.dossier.entity.Participant;
30 import org.turro.dossier.entity.ProjectGrant;
31 import org.turro.elephant.db.WhereClause;
32 import org.turro.jpa.Dao;
33 import org.turro.jpa.DaoFactory;
34 import org.turro.jpa.entity.EntityWebUrls;
35 import org.turro.version.Module;
36 import org.turro.version.Version;
68 return "/dossier/" + ((
Dossier)
object).getId();
69 }
else if(
object instanceof
Issue) {
70 return "/issue/" + ((
Issue)
object).getId();
72 return "/issue-comment/" + ((
IssueComment)
object).getId();
74 return "/dossier-participant/" + ((
Participant)
object).getId();
77 }
else if(
object instanceof
Category) {
78 return "/dossier-category/" + ((
Category)
object).getId();
80 return "/project-grant/" + ((
ProjectGrant)
object).getId();
87 return createCategoryPath(((
Dossier)
object).getCategory());
88 }
else if(
object instanceof
Issue) {
89 return getObjectPath(((
Issue)
object).getDossier()) + createCategoryPath(((
Issue)
object).getDossier().getCategory());
90 }
else if(
object instanceof
Category) {
91 return createCategoryPath(((
Category)
object).getParent());
97 return new Module(
new Version(
"1.9.5"),
"BrightSide Dossier");
104 wc.
addClause(
"select d.id from Dossier as d");
105 List<Long> list = (List<Long>) dao.getResultList(wc);
106 if(!list.isEmpty()) {
107 for(Long
id : list) {
122 private static String createCategoryPath(
Category category) {
123 if(category !=
null) {
124 String path =
"/dossier-category/" + category.
getId();
127 path +=
"/dossier-category/" + category.
getId();
static String getObjectPath(Object object)
EntityManager createCachedEntityManager()
EntityManager createEntityManager()
EntityManagerFactory getFactory()
static void convertUrls()
String getPath(Object object)
static Module getModule()
static String getObjectExtendedPath(Object object)
void addClause(String clause)
EntityManagerFactory getEmf()
EntityManager createEntityManager(String pu, String conf)
synchronized EntityManager createCachedEntityManager(String pu, String conf)
static boolean existsAnyOf(String entityPath)
static EntityWebUrl addWebUrl(String entityPath, String url)
static boolean existsEntity(String entityPath)