use of com.haulmont.cuba.core.entity.SoftDelete in project cuba by cuba-platform.
the class EntityRestoreServiceBean method restoreEntities.
@Override
public void restoreEntities(Collection<Entity> entities) {
for (Entity entity : entities) {
if (!(entity instanceof SoftDelete))
continue;
String storeName = metadata.getTools().getStoreName(metadata.getClassNN(entity.getClass()));
if (storeName == null) {
log.warn("Unable to restore entity {}: cannot determine data store", entity);
continue;
}
Transaction tx = persistence.createTransaction(storeName);
try {
persistence.getEntityManager(storeName).setSoftDeletion(false);
restoreEntity(entity, storeName);
tx.commit();
} finally {
tx.end();
}
}
}
Aggregations