1 package org.hibernate.impl; 3 4 import java.util.Iterator ; 5 import java.util.List ; 6 import java.util.Map ; 7 8 import org.hibernate.HibernateException; 9 import org.hibernate.ScrollableResults; 10 import org.hibernate.engine.SessionImplementor; 11 import org.hibernate.type.Type; 12 13 17 public class CollectionFilterImpl extends QueryImpl { 18 19 private Object collection; 20 21 public CollectionFilterImpl(String queryString, Object collection, SessionImplementor session) { 22 super(queryString, session); 23 this.collection = collection; 24 } 25 26 27 30 public Iterator iterate() throws HibernateException { 31 verifyParameters(); 32 Map namedParams = getNamedParams(); 33 return getSession().iterateFilter( 34 collection, 35 bindParameterLists(namedParams), 36 getQueryParameters(namedParams) 37 ); 38 } 39 40 43 public List list() throws HibernateException { 44 verifyParameters(); 45 Map namedParams = getNamedParams(); 46 return getSession().listFilter( 47 collection, 48 bindParameterLists(namedParams), 49 getQueryParameters(namedParams) 50 ); 51 } 52 53 56 public ScrollableResults scroll() throws HibernateException { 57 throw new UnsupportedOperationException ("Can't scroll filters"); 58 } 59 60 public Type[] typeArray() { 61 List typeList = getTypes(); 62 int size = typeList.size(); 63 Type[] result = new Type[size+1]; 64 for (int i=0; i<size; i++) result[i+1] = (Type) typeList.get(i); 65 return result; 66 } 67 68 public Object [] valueArray() { 69 List valueList = getValues(); 70 int size = valueList.size(); 71 Object [] result = new Object [size+1]; 72 for (int i=0; i<size; i++) result[i+1] = valueList.get(i); 73 return result; 74 } 75 76 } 77 | Popular Tags |