ome.tools.hibernate
Class ProxyCleanupFilter

java.lang.Object
  extended by ome.util.ContextFilter
      extended by ome.tools.hibernate.ProxyCleanupFilter
All Implemented Interfaces:
ome.util.Filter

public class ProxyCleanupFilter
extends ome.util.ContextFilter

removes all proxies from a return graph to prevent ClassCastExceptions and Session Closed exceptions. You need to be careful with printing. Calling toString() on an unitialized object will break before filtering is complete. Note: we aren't setting the filtered collections here because it's "either null/unloaded or filtered". We will definitiely filter here, so it would just increase bandwidth.

Since:
1.0
Version:
1.0 (Internal version: $Rev$ $Date$)
Author:
Josh Moore      josh.moore@gmx.de

Nested Class Summary
static class ProxyCleanupFilter.Interceptor
          wraps a filter for each invocation
 
Field Summary
protected  CurrentDetails currentDetails
           
protected  Map unloadedObjectCache
           
 
Fields inherited from class ome.util.ContextFilter
_cache, _context
 
Constructor Summary
ProxyCleanupFilter()
          Passes null to ProxyCleanupFilter(CurrentDetails) such that all restricted objects will be unloaded.
ProxyCleanupFilter(CurrentDetails cd)
          Constructor take a CurrentDetails object in order to check the security restrictions on certain objects.
 
Method Summary
protected  void doFilter(String arg0, Object arg1)
           
 Collection filter(String fieldId, Collection c)
           
 ome.util.Filterable filter(String fieldId, ome.util.Filterable f)
           
 Map filter(String fieldId, Map m)
           
 
Methods inherited from class ome.util.ContextFilter
addSeen, afterFilter, beforeFilter, currentContext, doFilter, doFilter, enter, exit, filter, filter, hasntSeen, pop, previousContext, push
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

unloadedObjectCache

protected Map unloadedObjectCache

currentDetails

protected final CurrentDetails currentDetails
Constructor Detail

ProxyCleanupFilter

public ProxyCleanupFilter()
Passes null to ProxyCleanupFilter(CurrentDetails) such that all restricted objects will be unloaded.


ProxyCleanupFilter

public ProxyCleanupFilter(CurrentDetails cd)
Constructor take a CurrentDetails object in order to check the security restrictions on certain objects.

Method Detail

filter

public ome.util.Filterable filter(String fieldId,
                                  ome.util.Filterable f)
Specified by:
filter in interface ome.util.Filter
Overrides:
filter in class ome.util.ContextFilter

filter

public Collection filter(String fieldId,
                         Collection c)
Specified by:
filter in interface ome.util.Filter
Overrides:
filter in class ome.util.ContextFilter

filter

public Map filter(String fieldId,
                  Map m)
Specified by:
filter in interface ome.util.Filter
Overrides:
filter in class ome.util.ContextFilter

doFilter

protected void doFilter(String arg0,
                        Object arg1)
Overrides:
doFilter in class ome.util.ContextFilter


OmeroJava Api

Version: 4.3.3-00d1137e-b2894

Copyright © 2009 The University of Dundee. All Rights Reserved.