EntityLog auto invalidation #PL-4435

This commit is contained in:
Gleb Gorelov 2015-02-02 07:28:19 +00:00
parent e7a068e456
commit c76aaffe73
4 changed files with 1 additions and 81 deletions

View File

@ -1,35 +0,0 @@
/*
* Copyright (c) 2008-2015 Haulmont. All rights reserved.
* Use is subject to license terms, see http://www.cuba-platform.com/license for details.
*/
package com.haulmont.cuba.core.app.entitylog;
import com.haulmont.cuba.core.listener.AfterDeleteEntityListener;
import com.haulmont.cuba.core.listener.AfterInsertEntityListener;
import com.haulmont.cuba.security.app.EntityLogAPI;
import com.haulmont.cuba.security.entity.LoggedAttribute;
import javax.annotation.ManagedBean;
import javax.inject.Inject;
/**
* @author gorelov
* @version $Id$
*/
@ManagedBean("cuba_LoggedAttributeListener")
public class LoggedAttributeListener implements AfterInsertEntityListener<LoggedAttribute>,
AfterDeleteEntityListener<LoggedAttribute> {
@Inject
protected EntityLogAPI logAPI;
@Override
public void onAfterInsert(LoggedAttribute entity) {
logAPI.invalidateCache();
}
@Override
public void onAfterDelete(LoggedAttribute entity) {
logAPI.invalidateCache();
}
}

View File

@ -1,41 +0,0 @@
/*
* Copyright (c) 2008-2015 Haulmont. All rights reserved.
* Use is subject to license terms, see http://www.cuba-platform.com/license for details.
*/
package com.haulmont.cuba.core.app.entitylog;
import com.haulmont.cuba.core.listener.AfterDeleteEntityListener;
import com.haulmont.cuba.core.listener.AfterInsertEntityListener;
import com.haulmont.cuba.core.listener.AfterUpdateEntityListener;
import com.haulmont.cuba.security.app.EntityLogAPI;
import com.haulmont.cuba.security.entity.LoggedEntity;
import javax.annotation.ManagedBean;
import javax.inject.Inject;
/**
* @author gorelov
* @version $Id$
*/
@ManagedBean("cuba_LoggedEntityListener")
public class LoggedEntityListener implements AfterInsertEntityListener<LoggedEntity>,
AfterUpdateEntityListener<LoggedEntity>, AfterDeleteEntityListener<LoggedEntity> {
@Inject
protected EntityLogAPI logAPI;
@Override
public void onAfterInsert(LoggedEntity entity) {
logAPI.invalidateCache();
}
@Override
public void onAfterUpdate(LoggedEntity entity) {
logAPI.invalidateCache();
}
@Override
public void onAfterDelete(LoggedEntity entity) {
logAPI.invalidateCache();
}
}

View File

@ -5,7 +5,6 @@
package com.haulmont.cuba.security.entity;
import com.haulmont.cuba.core.entity.BaseUuidEntity;
import com.haulmont.cuba.core.entity.annotation.Listeners;
import com.haulmont.cuba.core.entity.annotation.SystemLevel;
import javax.persistence.*;
@ -19,7 +18,6 @@ import javax.persistence.Entity;
*/
@Entity(name = "sec$LoggedAttribute")
@Table(name = "SEC_LOGGED_ATTR")
@Listeners("cuba_LoggedAttributeListener")
@SystemLevel
public class LoggedAttribute extends BaseUuidEntity {

View File

@ -5,12 +5,11 @@
package com.haulmont.cuba.security.entity;
import com.haulmont.cuba.core.entity.BaseUuidEntity;
import com.haulmont.cuba.core.entity.annotation.SystemLevel;
import javax.persistence.*;
import java.util.Set;
import com.haulmont.cuba.core.entity.annotation.Listeners;
import com.haulmont.cuba.core.entity.annotation.SystemLevel;
/**
* Configuration element of <code>EntityLog</code> bean.
@ -20,7 +19,6 @@ import com.haulmont.cuba.core.entity.annotation.SystemLevel;
*/
@Entity(name = "sec$LoggedEntity")
@Table(name = "SEC_LOGGED_ENTITY")
@Listeners("cuba_LoggedEntityListener")
@SystemLevel
public class LoggedEntity extends BaseUuidEntity {