19 package org.turro.cleanup;
21 import org.turro.contacts.db.ContactsPU;
22 import org.turro.jpa.Dao;
23 import org.turro.sql.SqlClause;
33 public boolean isMine(Object entity) {
45 SqlClause.update(
"Convocation")
46 .append(
"set contact_fk = NULL")
47 .where().isNotNull(
"contact_fk")
48 .and().notExists(SqlClause.select(
"*").from(
"Contact c").where(
"c.identifier = contact_fk"))
51 SqlClause.delete(
"CommentIt")
52 .where().isNotNull(
"creator_fk")
53 .and().notExists(SqlClause.select(
"*").from(
"Contact c").where(
"c.identifier = creator_fk"))
56 SqlClause.delete(
"StarIt")
57 .where().isNotNull(
"creator_fk")
58 .and().notExists(SqlClause.select(
"*").from(
"Contact c").where(
"c.identifier = creator_fk"))
61 SqlClause.delete(
"VoteIt")
62 .where().isNotNull(
"creator_fk")
63 .and().notExists(SqlClause.select(
"*").from(
"Contact c").where(
"c.identifier = creator_fk"))
66 cleanOrphansFor(
"contact", getEntityPaths(dao, String.class,
"Contact",
"id",
"contact"));
void cleanOrphansFor(String root, Set< String > entities)