1 6 package com.nightlabs.ipanema.person.util; 7 import java.util.ArrayList ; 8 import java.util.List ; 9 10 import com.nightlabs.ipanema.person.id.PersonStructFieldID; 11 import com.nightlabs.jdo.search.SearchFilterItem; 12 13 14 28 public abstract class PersonSearchFilterItem extends SearchFilterItem { 29 30 34 protected PersonSearchFilterItem(PersonStructFieldID personStructFieldID, int matchType, String needle) { 35 super(matchType, needle); 36 this.personStructFieldIDs.clear(); 37 this.personStructFieldIDs.add(personStructFieldID); 38 } 39 40 44 protected PersonSearchFilterItem(PersonStructFieldID[] personStructFieldIDs, int matchType, String needle) { 45 super(matchType, needle); 46 if (personStructFieldIDs.length == 0) 47 throw new IllegalArgumentException ("At least one PersonStructFieldID has to be defined in the given array."); 48 this.personStructFieldIDs.clear(); 49 for (int i = 0; i < personStructFieldIDs.length; i++) { 50 this.personStructFieldIDs.add(personStructFieldIDs[i]); 51 } 52 } 53 54 protected PersonSearchFilterItem(int matchType, String needle) { 55 super(matchType, needle); 56 } 57 58 public static final String QUERY_DATAFIELD_VARNAME = "personDataField"; 59 60 62 protected List personStructFieldIDs = new ArrayList (); 63 64 public PersonStructFieldID getPersonStructFieldID() { 65 return (PersonStructFieldID)personStructFieldIDs.get(0); 66 } 67 68 public List getPersonStructFieldIDs() { 69 return personStructFieldIDs; 70 } 71 72 76 public Object getSearchField() { 77 throw new UnsupportedOperationException ("Do not use getSearchField for PersonSearchFilterItem. Use getPersonStructFieldIDs instead."); 78 } 79 } 80 | Popular Tags |