19 package org.turro.cleanup;
22 import org.turro.dossier.db.DossierPU;
23 import org.turro.dossier.dw.DatawarehouseUtil;
24 import org.turro.dossier.entity.Issue;
25 import org.turro.jpa.Dao;
26 import org.turro.sql.SqlClause;
36 public boolean isMine(Object entity) {
37 return entity instanceof
Issue;
42 if(entity instanceof
Issue issue) {
48 () -> cleanupDuplicates(dao, issue))
62 SqlClause.delete(
"IssueParticipant")
63 .where().append(
"issue").isNull()
66 cleanOrphansFor(
"issue", getEntityPaths(dao, Long.class,
"Issue",
"id",
"issue"));
69 private void cleanupDuplicates(
Dao dao,
Issue issue) {
70 SqlClause.update(
"Issue")
71 .set(
"duplicated",
null)
72 .where().equal(
"duplicated", issue)
void cleanOrphansFor(String root, Set< String > entities)
ICleanupConsole getConsole()
static CleanupAction from(String message, Runnable action)
void execute(ICleanupConsole console, CleanupMode mode)
static void executeForCommons(String entityPath, ICleanupConsole console, CleanupMode mode, Set< IElephantCleanup.Commons > commons)
boolean isMine(Object entity)
void cleanEntity(Object entity, CleanupMode mode)
static String getObjectPath(Object object)
static void remove(Dao dao, Dossier dossier)
void deleteObject(Object obj)
void addMessage(String message)