Java 类javax.persistence.PostRemove 实例源码
项目:vars
文件:KeyNullifier.java
@PostRemove
public void nullifyKey(Object object) {
/*
* We use reflection to locate the setId method since it's not defined in
* any of the base interfaces of the VARS JPAEntities. This is deliberate
* we don't normally want developers playing with the setId method.
*/
if (object instanceof JPAEntity) {
Class params[] = {Long.class};
Object args[] = {null};
try {
Method method = object.getClass().getDeclaredMethod("setId", params);
method.invoke(object, args);
}
catch (Exception e) {
log.error("Failed to set primary key on " + object + " to null", e);
}
}
}
项目:buenojo
文件:ImageResourceListener.java
@PostRemove
public void removeImagesFromDisk(ImageResource image){
if (image.getHiResImagePath() != null){
delete(image.getHiResImagePath());
}
if (image.getLoResImagePath() != null){
delete(image.getLoResImagePath());
}
}
项目:Pet-Supply-Store
文件:PersistenceOrderItem.java
/**
* Clear products and orders from cache post remove.
*/
@PostRemove
private void clearCaches() {
CacheManager.MANAGER.clearCache(PersistenceProduct.class);
CacheManager.MANAGER.clearCache(PersistenceOrder.class);
CacheManager.MANAGER.clearRemoteCache(PersistenceOrderItem.class);
}
项目:Pet-Supply-Store
文件:PersistenceOrder.java
/**
* Clear users and order items from cache post remove.
*/
@PostRemove
private void clearCaches() {
CacheManager.MANAGER.clearCache(PersistenceUser.class);
CacheManager.MANAGER.clearCache(PersistenceOrderItem.class);
CacheManager.MANAGER.clearRemoteCache(PersistenceOrder.class);
}
项目:lams
文件:EntityClass.java
private void processDefaultJpaCallbacks(String instanceCallbackClassName, List<JpaCallbackClass> jpaCallbackClassList) {
ClassInfo callbackClassInfo = getLocalBindingContext().getClassInfo( instanceCallbackClassName );
// Process superclass first if available and not excluded
if ( JandexHelper.getSingleAnnotation( callbackClassInfo, JPADotNames.EXCLUDE_SUPERCLASS_LISTENERS ) != null ) {
DotName superName = callbackClassInfo.superName();
if ( superName != null ) {
processDefaultJpaCallbacks( instanceCallbackClassName, jpaCallbackClassList );
}
}
String callbackClassName = callbackClassInfo.name().toString();
Map<Class<?>, String> callbacksByType = new HashMap<Class<?>, String>();
createDefaultCallback(
PrePersist.class, PseudoJpaDotNames.DEFAULT_PRE_PERSIST, callbackClassName, callbacksByType
);
createDefaultCallback(
PreRemove.class, PseudoJpaDotNames.DEFAULT_PRE_REMOVE, callbackClassName, callbacksByType
);
createDefaultCallback(
PreUpdate.class, PseudoJpaDotNames.DEFAULT_PRE_UPDATE, callbackClassName, callbacksByType
);
createDefaultCallback(
PostLoad.class, PseudoJpaDotNames.DEFAULT_POST_LOAD, callbackClassName, callbacksByType
);
createDefaultCallback(
PostPersist.class, PseudoJpaDotNames.DEFAULT_POST_PERSIST, callbackClassName, callbacksByType
);
createDefaultCallback(
PostRemove.class, PseudoJpaDotNames.DEFAULT_POST_REMOVE, callbackClassName, callbacksByType
);
createDefaultCallback(
PostUpdate.class, PseudoJpaDotNames.DEFAULT_POST_UPDATE, callbackClassName, callbacksByType
);
if ( !callbacksByType.isEmpty() ) {
jpaCallbackClassList.add( new JpaCallbackClassImpl( instanceCallbackClassName, callbacksByType, true ) );
}
}
项目:lams
文件:EntityClass.java
private void processJpaCallbacks(String instanceCallbackClassName, boolean isListener, List<JpaCallbackClass> callbackClassList) {
ClassInfo callbackClassInfo = getLocalBindingContext().getClassInfo( instanceCallbackClassName );
// Process superclass first if available and not excluded
if ( JandexHelper.getSingleAnnotation( callbackClassInfo, JPADotNames.EXCLUDE_SUPERCLASS_LISTENERS ) != null ) {
DotName superName = callbackClassInfo.superName();
if ( superName != null ) {
processJpaCallbacks(
instanceCallbackClassName,
isListener,
callbackClassList
);
}
}
Map<Class<?>, String> callbacksByType = new HashMap<Class<?>, String>();
createCallback( PrePersist.class, JPADotNames.PRE_PERSIST, callbacksByType, callbackClassInfo, isListener );
createCallback( PreRemove.class, JPADotNames.PRE_REMOVE, callbacksByType, callbackClassInfo, isListener );
createCallback( PreUpdate.class, JPADotNames.PRE_UPDATE, callbacksByType, callbackClassInfo, isListener );
createCallback( PostLoad.class, JPADotNames.POST_LOAD, callbacksByType, callbackClassInfo, isListener );
createCallback( PostPersist.class, JPADotNames.POST_PERSIST, callbacksByType, callbackClassInfo, isListener );
createCallback( PostRemove.class, JPADotNames.POST_REMOVE, callbacksByType, callbackClassInfo, isListener );
createCallback( PostUpdate.class, JPADotNames.POST_UPDATE, callbacksByType, callbackClassInfo, isListener );
if ( !callbacksByType.isEmpty() ) {
callbackClassList.add( new JpaCallbackClassImpl( instanceCallbackClassName, callbacksByType, isListener ) );
}
}
项目:jpasecurity
文件:FieldAccessAnnotationTestBean.java
@PostRemove
public void postRemoveLifecycleMethod() {
postRemoveCount++;
if (postRemoveCount != preRemoveCount) {
throw new IllegalStateException("postRemoveCount(" + postRemoveCount + ") != preRemoveCount(" + preRemoveCount + ")");
}
}
项目:clap
文件:BaseEntityListener.java
@PostRemove
public void postRemove(E entity) {
T delegate = getDelegate();
if (delegate != null) {
delegate.postRemove(entity);
}
}
项目:Pet-Supply-Store
文件:PersistenceProduct.java
/**
* Clear categories and order items from cache post remove.
*/
@PostRemove
private void clearCaches() {
CacheManager.MANAGER.clearCache(PersistenceCategory.class);
CacheManager.MANAGER.clearRemoteCache(PersistenceProduct.class);
}
项目:Pet-Supply-Store
文件:PersistenceUser.java
/**
* Clear users and order items from cache post remove.
*/
@PostRemove
private void clearCaches() {
CacheManager.MANAGER.clearCache(PersistenceOrder.class);
CacheManager.MANAGER.clearRemoteCache(PersistenceUser.class);
}
项目:Pet-Supply-Store
文件:PersistenceCategory.java
/**
* Clear products from cache to update relationships.
*/
@PostRemove
private void clearCaches() {
CacheManager.MANAGER.clearCache(PersistenceProduct.class);
CacheManager.MANAGER.clearRemoteCache(PersistenceCategory.class);
}
项目:esup-ecandidat
文件:EntityPushEntityListener.java
@PostRemove
public void postRemove(Object entity) {
notifyEntityPushers(EntityAction.REMOVED, entity);
}
项目:spring-data-rest-webhook
文件:WebhookEntityListener.java
@PostRemove
public void postRemove(Object object) {
LOG.info("Listening to post remove for object:" + object);
}
项目:DanielDias-MongoDB
文件:JPADebugListener.java
@PostRemove
private void postRemove(Object object) {
logger.debug("### DebugListener.postRemove({})", object);
}
项目:warpdb
文件:User.java
@PostRemove
void postRemove() {
callbacks.add(PostRemove.class);
}
项目:OpenCyclos
文件:WriteDetectEventListener.java
@PostRemove
@PostPersist
@PostUpdate
public void onPostModyfingOperation(final Object o) {
markWrite();
}
项目:apolo
文件:AuditLogListener.java
@PostRemove
void postDelete(AuditableBaseEntity e) {
createLog(DatabaseTransactionType.DELETE, e);
}
项目:spring-entity-listener
文件:SpringListener.java
@PostRemove
public void postRemove(TwitterUser entity) {
System.out.println("Spring PostRemove, key: " + key);
}
项目:spring-entity-listener
文件:HibernateEntityListenersAdapter.java
public void findMethodsForListener(Object listener) {
Class<?> c = listener.getClass();
for (Method m : c.getMethods()) {
if (Void.TYPE.equals(m.getReturnType())) {
Class<?>[] types = m.getParameterTypes();
if (types.length == 1) {
// check for all annotations now...
if (m.getAnnotation(PrePersist.class) != null) {
if (!preInsert.containsKey(types[0])) {
preInsert.put(types[0], new LinkedHashMap<Method, Object>());
}
preInsert.get(types[0]).put(m, listener);
}
if (m.getAnnotation(PostPersist.class) != null) {
if (!postInsert.containsKey(types[0])) {
postInsert.put(types[0], new LinkedHashMap<Method, Object>());
}
postInsert.get(types[0]).put(m, listener);
}
if (m.getAnnotation(PreUpdate.class) != null) {
if (!preUpdate.containsKey(types[0])) {
preUpdate.put(types[0], new LinkedHashMap<Method, Object>());
}
preUpdate.get(types[0]).put(m, listener);
}
if (m.getAnnotation(PostUpdate.class) != null) {
if (!postUpdate.containsKey(types[0])) {
postUpdate.put(types[0], new LinkedHashMap<Method, Object>());
}
postUpdate.get(types[0]).put(m, listener);
}
if (m.getAnnotation(PreRemove.class) != null) {
if (!preRemove.containsKey(types[0])) {
preRemove.put(types[0], new LinkedHashMap<Method, Object>());
}
preRemove.get(types[0]).put(m, listener);
}
if (m.getAnnotation(PostRemove.class) != null) {
if (!postRemove.containsKey(types[0])) {
postRemove.put(types[0], new LinkedHashMap<Method, Object>());
}
postRemove.get(types[0]).put(m, listener);
}
if (m.getAnnotation(PostLoad.class) != null) {
if (!postLoad.containsKey(types[0])) {
postLoad.put(types[0], new LinkedHashMap<Method, Object>());
}
postLoad.get(types[0]).put(m, listener);
}
}
}
}
}
项目:spring-entity-listener
文件:JPAListener.java
@PostRemove
public void postRemove(TwitterUser entity) {
System.out.println("JPA PostRemove");
}
项目:study-ocbcd
文件:DefaultCallback.java
@PostRemove
public void postRemove(Object obj) {
System.out.println("PostRemove: " + obj);
}
项目:study-ocbcd
文件:CatLifecycleCallback.java
@PostRemove
public void postRemove() {
System.out.println("A cat was abandoned: " + this);
}
项目:Reconciliation-and-Matching-Framework
文件:CloneMe.java
@PostRemove
public void loggRemoval() {
logger.info("Deleted {}", this);
}
项目:openhds-server
文件:SocialGroup.java
@PostRemove
public String getExtId() {
return extId;
}
项目:kc-rice
文件:DocumentBase.java
/**
* This overridden method is used to delete the {@link DocumentHeader} object due to the system not being able to
* manage the {@link DocumentHeader} object via mapping files
*
* @see org.kuali.rice.krad.bo.PersistableBusinessObjectBase#postRemove()
*/
@PostRemove
protected void postRemove() {
KRADServiceLocatorWeb.getDocumentHeaderService().deleteDocumentHeader(getDocumentHeader());
}
项目:kc-rice
文件:PersistableBusinessObjectBase.java
/**
* Default implementation of the JPA {@link PostRemove} hook. This implementation currently does nothing,
* however sub-classes can override and implement this method if needed.
*
* <p>This method is currently invoked by the corresponding OJB {@link #afterDelete(PersistenceBroker)} hook.
*/
@PostRemove
protected void postRemove() {
// do nothing
}
项目:hawkbit
文件:EntityInterceptorListener.java
/**
* Callback for lifecyle event <i>post remove</i>.
*
* @param entity
* the JPA entity which this listener is associated with
*/
@PostRemove
public void postRemove(final Object entity) {
notifyAll(interceptor -> interceptor.postRemove(entity));
}
项目:rice
文件:DocumentBase.java
/**
* This overridden method is used to delete the {@link DocumentHeader} object due to the system not being able to
* manage the {@link DocumentHeader} object via mapping files
*
* @see org.kuali.rice.krad.bo.PersistableBusinessObjectBase#postRemove()
*/
@PostRemove
protected void postRemove() {
KRADServiceLocatorWeb.getDocumentHeaderService().deleteDocumentHeader(getDocumentHeader());
}
项目:rice
文件:PersistableBusinessObjectBase.java
/**
* Default implementation of the JPA {@link PostRemove} hook. This implementation currently does nothing,
* however sub-classes can override and implement this method if needed.
*
* <p>This method is currently invoked by the corresponding OJB {@link #afterDelete(PersistenceBroker)} hook.
*/
@PostRemove
protected void postRemove() {
// do nothing
}
项目:kuali_rice
文件:PersistableBusinessObjectBase.java
/**
* Default implementation of the JPA {@link PostRemove} hook. This implementation currently does nothing,
* however sub-classes can override and implement this method if needed.
*
* <p>This method is currently invoked by the corresponding OJB {@link #afterDelete(PersistenceBroker)} hook.
*/
@PostRemove
protected void postRemove() {
// do nothing
}