◆ CategoryResults()
org.turro.dossier.search.CategoryResults.CategoryResults |
( |
| ) |
|
◆ addExistsCategoryAffiliance()
static void org.turro.dossier.search.CategoryResults.addExistsCategoryAffiliance |
( |
WhereClause |
wc, |
|
|
String |
categoryIds, |
|
|
String |
dossierField |
|
) |
| |
|
static |
Definition at line 102 of file CategoryResults.java.
103 wc.addClause(
"and exists (select c from Category as c");
104 wc.addClause(
"where " + dossierField +
".uniquePath like concat(c.uniquePath, '/%')");
105 wc.addClause(
"and c.id in (" + categoryIds +
"))");
◆ addParticipantAffiliance()
static void org.turro.dossier.search.CategoryResults.addParticipantAffiliance |
( |
WhereClause |
wc, |
|
|
String |
sep, |
|
|
String |
idContact, |
|
|
String |
dossierField |
|
) |
| |
|
static |
Definition at line 108 of file CategoryResults.java.
109 wc.addClause(sep +
" exists (");
110 wc.addClause(
"select cp from CategoryParticipant as cp");
111 wc.addClause(
"where cp.idContact = :idContact");
112 wc.addNamedValue(
"idContact", idContact);
113 wc.addClause(
"and (cp.role = :cprole1 or cp.role = :cprole2)");
114 wc.addNamedValue(
"cprole1", ParticipantRole.PARTICIPANT_OWNER);
115 wc.addNamedValue(
"cprole2", ParticipantRole.PARTICIPANT_ASSISTANT);
116 wc.addClause(
"and (");
117 wc.addClause(
"cp.category.uniquePath = " + dossierField +
".category.uniquePath");
118 wc.addClause(
"or " + dossierField +
".category.uniquePath like concat(cp.category.uniquePath, '/%')");
◆ addParticipantCategoryAffiliance()
static void org.turro.dossier.search.CategoryResults.addParticipantCategoryAffiliance |
( |
WhereClause |
wc, |
|
|
String |
sep, |
|
|
String |
idContact, |
|
|
String |
categoryField |
|
) |
| |
|
static |
Definition at line 122 of file CategoryResults.java.
123 wc.addClause(sep +
" ( exists (");
124 wc.addClause(
"select cp from CategoryParticipant as cp");
125 wc.addClause(
"where cp.idContact = :idContact");
126 wc.addNamedValue(
"idContact", idContact);
127 wc.addClause(
"and (cp.role = :cprole1 or cp.role = :cprole2)");
128 wc.addNamedValue(
"cprole1", ParticipantRole.PARTICIPANT_OWNER);
129 wc.addNamedValue(
"cprole2", ParticipantRole.PARTICIPANT_ASSISTANT);
130 wc.addClause(
"and (");
131 wc.addClause(
"cp.category.uniquePath = " + categoryField +
".uniquePath");
132 wc.addClause(
"or cp.category.uniquePath like concat(" + categoryField +
".uniquePath, '/%')");
133 wc.addClause(
"or " + categoryField +
".uniquePath like concat(cp.category.uniquePath, '/%')");
134 wc.addClause(
")) or exists (");
135 wc.addClause(
"select dp from Participant as dp");
136 wc.addClause(
"where (");
137 wc.addClause(
"dp.dossier.category.uniquePath = " + categoryField +
".uniquePath");
138 wc.addClause(
"or dp.dossier.category.uniquePath like concat(" + categoryField +
".uniquePath, '/%')");
140 wc.addClause(
"and dp.idContact = :idContact");
141 wc.addNamedValue(
"idContact", idContact);
142 wc.addClause(
"and (dp.role = :dpdrole1 or dp.role = :dpdrole2)");
143 wc.addNamedValue(
"dpdrole1", ParticipantRole.PARTICIPANT_OWNER);
144 wc.addNamedValue(
"dpdrole2", ParticipantRole.PARTICIPANT_ASSISTANT);
◆ getCategoryList()
java.util.List org.turro.dossier.search.CategoryResults.getCategoryList |
( |
| ) |
|
Definition at line 41 of file CategoryResults.java.
42 WhereClause wc =
new WhereClause();
43 wc.addClause(
"select distinct category");
44 wc.addClause(
"from Category as category");
45 wc.addClause(
"order by category.fullDescription");
46 return new DossierPU().getResultList(wc);
◆ getCategoryRootList()
java.util.List org.turro.dossier.search.CategoryResults.getCategoryRootList |
( |
| ) |
|
Definition at line 49 of file CategoryResults.java.
50 WhereClause wc =
new WhereClause();
51 wc.addClause(
"select distinct category");
52 wc.addClause(
"from Category as category");
53 wc.addClause(
"where parent is null");
54 wc.addClause(
"order by category.fullDescription");
55 return new DossierPU().getResultList(wc);
◆ normalizeUniquePaths() [1/2]
static void org.turro.dossier.search.CategoryResults.normalizeUniquePaths |
( |
| ) |
|
|
static |
Definition at line 65 of file CategoryResults.java.
66 Dao dao =
new DossierPU();
67 Dao execute =
new DossierPU();
68 JpaCriteria criteria =
new JpaCriteria(dao);
69 JpaQuery<Category> jqc = criteria.query(Category.class);
70 dao.getResultList(jqc.select()).forEach((category) -> {
71 String uniquePath =
"/c" + category.getId();
72 String fullDescription = category.getDescription();
73 Category c = category.getParent();
75 uniquePath =
"/c" + c.getId() + uniquePath;
76 fullDescription = c.getDescription() + Chars.backward().spaced() + fullDescription;
79 JpaCriteriaUpdate<Category> juc = criteria.createCriteriaUpdate(Category.class);
80 execute.executeUpdate(juc.set(
"uniquePath", uniquePath)
81 .set(
"fullDescription", fullDescription)
82 .where(criteria.equal(juc.field(
"id"), category.getId())));
84 JpaQuery<Dossier> jqd = criteria.query(Dossier.class);
85 try(Stream<Dossier> dossiers = dao.stream(Dossier.class, jqd.select())) {
86 dossiers.forEach((dossier) -> {
87 JpaCriteriaUpdate<Dossier> jud = criteria.createCriteriaUpdate(Dossier.class);
88 execute.executeUpdate(jud.set(
"uniquePath", dossier.getCategory().getUniquePath() +
"/d" + dossier.getId())
89 .where(criteria.equal(jud.field(
"id"), dossier.getId())));
◆ normalizeUniquePaths() [2/2]
static void org.turro.dossier.search.CategoryResults.normalizeUniquePaths |
( |
Dossier |
dossier | ) |
|
|
static |
Definition at line 94 of file CategoryResults.java.
95 Dao dao =
new DossierPU();
96 JpaCriteria criteria =
new JpaCriteria(dao);
97 JpaCriteriaUpdate<Dossier> jud = criteria.createCriteriaUpdate(Dossier.class);
98 dao.executeUpdate(jud.set(
"uniquePath", dossier.getCategory().getUniquePath() +
"/d" + dossier.getId())
99 .where(criteria.equal(jud.field(
"id"), dossier.getId())));
◆ saveCategory()
static void org.turro.dossier.search.CategoryResults.saveCategory |
( |
Category |
category | ) |
|
|
static |
Definition at line 58 of file CategoryResults.java.
59 Dao dao =
new DossierPU();
60 category.prepareSave();
61 dao.saveObject(category);
static void normalizeUniquePaths()
The documentation for this class was generated from the following file: