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: 4572 $ $Date: 2009-07-09 12:51:05 +0100 (Thu, 09 Jul 2009) $)
Author:
Josh Moore      josh.moore@gmx.de

Nested Class Summary
static class ProxyCleanupFilter.Interceptor
          wraps a filter for each invocation
 
Field Summary
protected  Map unloadedObjectCache
           
 
Fields inherited from class ome.util.ContextFilter
_cache, _context
 
Constructor Summary
ProxyCleanupFilter()
           
 
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
Constructor Detail

ProxyCleanupFilter

public ProxyCleanupFilter()
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: Beta-4.1.1-r5927-b91

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