@Component(value="cuba_UserEntityListener") public class UserEntityListener extends java.lang.Object implements BeforeInsertEntityListener<User>, BeforeUpdateEntityListener<User>, AfterDeleteEntityListener<User>
Modifier and Type | Field and Description |
---|---|
protected Events |
events |
protected Metadata |
metadata |
protected PasswordEncryption |
passwordEncryption |
protected PersistenceTools |
persistenceTools |
Constructor and Description |
---|
UserEntityListener() |
Modifier and Type | Method and Description |
---|---|
protected void |
addDefaultRoles(User user,
EntityManager entityManager) |
void |
onAfterDelete(User entity,
java.sql.Connection connection)
Executes after the object has been deleted or marked as deleted in DB.
|
void |
onBeforeInsert(User entity,
EntityManager entityManager)
Executes before the object has been inserted into DB.
|
void |
onBeforeUpdate(User entity,
EntityManager entityManager)
Executes before the object has been updated in DB.
|
protected void |
updateLoginLowerCase(User user) |
protected void |
updatePasswordEncryption(User user) |
@Inject protected Events events
@Inject protected PersistenceTools persistenceTools
@Inject protected Metadata metadata
@Inject protected PasswordEncryption passwordEncryption
public void onBeforeInsert(User entity, EntityManager entityManager)
BeforeInsertEntityListener
onBeforeInsert
in interface BeforeInsertEntityListener<User>
entity
- inserted entity instanceentityManager
- EntityManager that owns the entity instanceprotected void addDefaultRoles(User user, EntityManager entityManager)
public void onBeforeUpdate(User entity, EntityManager entityManager)
BeforeUpdateEntityListener
onBeforeUpdate
in interface BeforeUpdateEntityListener<User>
entity
- updated entity instanceentityManager
- EntityManager that owns the entity instanceprotected void updateLoginLowerCase(User user)
protected void updatePasswordEncryption(User user)
public void onAfterDelete(User entity, java.sql.Connection connection)
AfterDeleteEntityListener
Modification of the entity state or using EntityManager
is impossible here. Use connection
if you
need to make changes in the database.
onAfterDelete
in interface AfterDeleteEntityListener<User>
entity
- deleted entityconnection
- JDBC connection to the database of the deleted entity