1 package com.dotmarketing.portlets.event_registrations.factories; 2 3 import java.util.ArrayList ; 4 import java.util.List ; 5 6 import com.dotmarketing.db.DotHibernate; 7 import com.dotmarketing.factories.InodeFactory; 8 import com.dotmarketing.portlets.event_registrations.model.WebEventAttendee; 9 import com.dotmarketing.portlets.event_registrations.model.WebEventRegistration; 10 11 15 public class WebEventAttendeeFactory { 16 17 public static java.util.List getAllWebEventAttendees() { 18 DotHibernate dh = new DotHibernate(WebEventAttendee.class); 19 dh.setQuery( 20 "from inode in class com.dotmarketing.portlets.event_registrations.model.WebEventAttendee order by first_name, last_name"); 21 return dh.list(); 22 } 23 public static java.util.List getAllWebEventAttendees(String orderby) { 24 DotHibernate dh = new DotHibernate(WebEventAttendee.class); 25 dh.setQuery( 26 "from inode in class com.dotmarketing.portlets.event_registrations.model.WebEventAttendee order by " + orderby); 27 return dh.list(); 28 } 29 30 public static java.util.List <WebEventAttendee> getWebEventAttendeesByKeyword(String keyword) { 31 DotHibernate dh = new DotHibernate(WebEventAttendee.class); 32 dh.setQuery( 33 "from inode in class com.dotmarketing.portlets.event_registrations.model.WebEventAttendee where lower(first_name) = ? or lower(last_name) = ? or lower(email) = ?"); 34 dh.setParam(keyword.toLowerCase()); 35 dh.setParam(keyword.toLowerCase()); 36 dh.setParam(keyword.toLowerCase()); 37 return dh.list(); 38 } 39 40 public static java.util.List <WebEventAttendee> getWebEventAttendeesByEventRegistration(List <WebEventRegistration> eventsRegistration) 41 { 42 List returnValue = new ArrayList (); 43 DotHibernate dh = new DotHibernate(WebEventAttendee.class); 44 String eventsRegistrationInode = ""; 45 if(eventsRegistration!=null && eventsRegistration.size() > 0) 46 { 47 for(WebEventRegistration registration : eventsRegistration) 48 { 49 eventsRegistrationInode += "'" + registration.getInode() + "',"; 50 } 51 eventsRegistrationInode = eventsRegistrationInode.substring(0,eventsRegistrationInode.lastIndexOf(",")); 52 String query = "from inode in class com.dotmarketing.portlets.event_registrations.model.WebEventAttendee where event_registration_inode in (" + eventsRegistrationInode + ")"; 53 dh.setQuery(query); 54 returnValue = dh.list(); 55 return returnValue; 56 } 57 else { 58 return new ArrayList <WebEventAttendee>(); 59 } 60 } 61 62 public static WebEventRegistration getWebEventRegistration(WebEventAttendee webEventAttendee) { 63 return (WebEventRegistration) InodeFactory.getInode(webEventAttendee.getEventRegistrationInode(), WebEventRegistration.class); 64 } 65 66 public static WebEventAttendee getWebEventAttendee(long inode) { 67 return (WebEventAttendee) InodeFactory.getInode(inode, WebEventAttendee.class); 68 } 69 70 public static WebEventAttendee getWebEventAttendee(String inode) { 71 return (WebEventAttendee) InodeFactory.getInode(inode, WebEventAttendee.class); 72 } 73 74 public static WebEventAttendee newInstance() { 75 WebEventAttendee m = new WebEventAttendee(); 76 return m; 77 } 78 79 public static void saveWebEventAttendee(WebEventAttendee WebEventAttendee) { 80 InodeFactory.saveInode(WebEventAttendee); 81 } 82 83 public static void deleteWebEventAttendee(WebEventAttendee WebEventAttendee) { 84 InodeFactory.deleteInode(WebEventAttendee); 85 } 86 87 } | Popular Tags |