1 package org.kuali.student.enrollment.class1.lui.dao; 2 3 import org.kuali.student.enrollment.class1.lui.model.LuiEntity; 4 import org.kuali.student.r2.common.dao.GenericEntityDao; 5 6 import java.util.ArrayList; 7 import java.util.List; 8 9 public class LuiDao extends GenericEntityDao<LuiEntity> { 10 public List<LuiEntity> getLuisByType(String typeId) { 11 return (List<LuiEntity>) em.createNamedQuery("Lui.getLuisByType").setParameter("typeId", typeId).getResultList(); 12 } 13 14 public List<LuiEntity> getLuisByClu(String cluId) { 15 return (List<LuiEntity>) em.createNamedQuery("Lui.getLuisByClu").setParameter("cluId", cluId).getResultList(); 16 17 } 18 19 public List<LuiEntity> getLuisByAtpAndType(String atpId, String typeKey) { 20 return (List<LuiEntity>) em.createNamedQuery("Lui.getLuisByAtpAndType").setParameter("typeKey", typeKey).setParameter("atpId", atpId).getResultList(); 21 22 } 23 24 public List<LuiEntity> getLuisByAtpAndClu(String atpId, String cluId) { 25 return (List<LuiEntity>) em.createNamedQuery("Lui.getLuisByAtpAndClu").setParameter("cluId", cluId).setParameter("atpId", atpId).getResultList(); 26 27 } 28 29 public List<String> getLuisIdsByAtpAndType(String atpId, String typeKey) { 30 return (List<String>) em.createNamedQuery("Lui.getLuiIdsByAtpAndType").setParameter("typeKey", typeKey).setParameter("atpId", atpId).getResultList(); 31 } 32 33 public List<String> getScheduleIdsByLuiId(String aoId) { 34 List<LuiEntity> luis = (List<LuiEntity>) em.createNamedQuery("Lui.getLuisByLuiId").setParameter("aoId", aoId).getResultList(); 35 List<String> scheduleIds = new ArrayList<String>(); 36 if(luis != null && !luis.isEmpty()) { 37 LuiEntity lui = luis.get(0); 38 scheduleIds.addAll(lui.getScheduleIds()); 39 } 40 return scheduleIds; 41 } 42 43 }