19 package org.turro.entities;
21 import org.turro.action.Contacts;
22 import org.turro.action.IElephantInitializer;
23 import org.turro.annotation.ElephantInitializer;
24 import org.turro.attach.db.AttachPU;
25 import org.turro.attach.entity.Attachment;
26 import org.turro.elephant.context.IConstructor;
27 import org.turro.jpa.Dao;
28 import org.turro.jpa.query.JpaCriteria;
29 import org.turro.jpa.query.JpaCriteriaUpdate;
30 import org.turro.jpa.query.JpaQuery;
31 import org.turro.jpa.query.JpaRoot;
32 import org.turro.log.WebLoggers;
33 import org.turro.plugin.contacts.IContact;
45 substituteLoginsForIds();
48 private void substituteLoginsForIds() {
55 jc.
like(attachment.get(
"owner"),
"%\\.%",
'\\'),
56 jc.
like(attachment.get(
"owner"),
"%\\_%",
'\\'),
57 jc.
lt(jc.
length(attachment.get(
"owner")), 30)));
58 dao.getResultList(jqa).forEach((attach) -> {
63 JpaCriteriaUpdate<Attachment> juc = jc.createCriteriaUpdate(Attachment.class);
64 execute.executeUpdate(juc.set(
"owner", contact.getId())
65 .where(jc.equal(juc.field(
"id"), attach.getId())));
67 }
catch(Exception ex) {}
void initialize(IConstructor constructor)
Predicate or(Expression< Boolean > x, Expression< Boolean > y)
Predicate lt(Expression<? extends Number > x, Expression<? extends Number > y)
Expression< Integer > length(Expression< String > x)
Predicate like(Expression< String > x, Expression< String > pattern)
WebLoggers message(String text, Object... parameters)
static WebLoggers info(Object entity)