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.enrollment.class1.lui.model.LuiLuiRelationEntity; 5 import org.kuali.student.r2.common.dao.GenericEntityDao; 6 7 import java.util.List; 8 9 public class LuiLuiRelationDao extends GenericEntityDao<LuiLuiRelationEntity> { 10 @SuppressWarnings({"unchecked"}) 11 public List<LuiLuiRelationEntity> getLuiLuiRelationsByLui(String luiId) { 12 return (List<LuiLuiRelationEntity>) em.createNamedQuery("LuiLuiRelationENR.getLuiLuiRelationsByLui") 13 .setParameter("luiId", luiId) 14 .getResultList(); 15 } 16 17 @SuppressWarnings({"unchecked"}) 18 public List<String> getLuiIdsByRelation(String relatedLuiId, String luLuRelationTypeKey){ 19 return (List<String>) em.createNamedQuery("LuiLuiRelationENR.getLuiIdsByRelation") 20 .setParameter("relatedLuiId", relatedLuiId) 21 .setParameter("luLuRelationTypeKey", luLuRelationTypeKey) 22 .getResultList(); 23 } 24 25 @SuppressWarnings({"unchecked"}) 26 public List<LuiEntity> getLuisByRelation(String relatedLuiId, String luLuRelationTypeKey){ 27 return (List<LuiEntity>) em.createNamedQuery("LuiLuiRelationENR.getLuisByRelation") 28 .setParameter("relatedLuiId", relatedLuiId) 29 .setParameter("luLuRelationTypeKey", luLuRelationTypeKey) 30 .getResultList(); 31 } 32 33 @SuppressWarnings({"unchecked"}) 34 public List<String> getRelatedLuisByLuiId(String luiId, String luLuRelationTypeKey){ 35 return (List<String>) em.createNamedQuery("LuiLuiRelationENR.getRelatedLuisByLuiId") 36 .setParameter("luiId", luiId) 37 .setParameter("luLuRelationTypeKey", luLuRelationTypeKey) 38 .getResultList(); 39 } 40 41 42 public List<LuiLuiRelationEntity> getLuiLuiRelationsByRelatedLuiAndLuiId(String luiId, String relatedLuiId){ 43 return (List<LuiLuiRelationEntity>) em.createNamedQuery("LuiLuiRelationENR.getLuiLuiRelationsByRelatedLuiAndLuiId") 44 .setParameter("luiId", luiId) 45 .setParameter("relatedLuiId",relatedLuiId) 46 .getResultList(); 47 48 } 49 50 public List<LuiEntity> getRelatedLuisByLuiIdAndRelationType(String luiId, String luiLuiRelationTypeKey) { 51 return (List<LuiEntity>) em.createNamedQuery("LuiLuiRelationENR.getRelatedLuisByLuiIdAndRelationType") 52 .setParameter("luiId", luiId) 53 .setParameter("luiLuiRelationTypeKey",luiLuiRelationTypeKey) 54 .getResultList(); 55 56 } 57 }