1 | |
package org.kuali.student.enrollment.class1.lui.dao; |
2 | |
|
3 | |
import java.util.List; |
4 | |
|
5 | |
import org.kuali.student.enrollment.class1.lui.model.LuiEntity; |
6 | |
import org.kuali.student.enrollment.class1.lui.model.LuiLuiRelationEntity; |
7 | |
import org.kuali.student.enrollment.dao.GenericEntityDao; |
8 | |
|
9 | 0 | public class LuiLuiRelationDao extends GenericEntityDao<LuiLuiRelationEntity>{ |
10 | |
@SuppressWarnings({"unchecked"}) |
11 | |
public List<LuiLuiRelationEntity> getLuiLuiRelationsByLui(String luiId) { |
12 | 0 | return (List<LuiLuiRelationEntity>) em.createQuery("from LuiLuiRelationEntity rel where rel.lui.id=:luiId OR rel.relatedLui.id=:luiId").setParameter("luiId", luiId).getResultList(); |
13 | |
} |
14 | |
|
15 | |
@SuppressWarnings({"unchecked"}) |
16 | |
public List<String> getLuiIdsByRelation(String relatedLuiId, String luLuRelationTypeKey){ |
17 | 0 | return (List<String>) em.createQuery("select rel.lui.id from LuiLuiRelationEntity rel where rel.relatedLui.id=:relatedLuiId and rel.luiLuiRelationType=:luLuRelationTypeKey") |
18 | |
.setParameter("relatedLuiId", relatedLuiId) |
19 | |
.setParameter("luLuRelationTypeKey", luLuRelationTypeKey) |
20 | |
.getResultList(); |
21 | |
} |
22 | |
|
23 | |
@SuppressWarnings({"unchecked"}) |
24 | |
public List<LuiEntity> getLuisByRelation(String relatedLuiId, String luLuRelationTypeKey){ |
25 | 0 | return (List<LuiEntity>) em.createQuery("select rel.lui from LuiLuiRelationEntity rel where rel.relatedLui.id=:relatedLuiId and rel.luiLuiRelationType=:luLuRelationTypeKey") |
26 | |
.setParameter("relatedLuiId", relatedLuiId) |
27 | |
.setParameter("luLuRelationTypeKey", luLuRelationTypeKey) |
28 | |
.getResultList(); |
29 | |
} |
30 | |
|
31 | |
@SuppressWarnings({"unchecked"}) |
32 | |
public List<String> getRelatedLuisByLuiId(String luiId, String luLuRelationTypeKey){ |
33 | 0 | return (List<String>) em.createQuery("select rel.relatedLui.id from LuiLuiRelationEntity rel where rel.lui.id=:luiId and rel.luiLuiRelationType=:luLuRelationTypeKey") |
34 | |
.setParameter("luiId", luiId) |
35 | |
.setParameter("luLuRelationTypeKey", luLuRelationTypeKey) |
36 | |
.getResultList(); |
37 | |
} |
38 | |
|
39 | |
|
40 | |
public List<LuiLuiRelationEntity> getLuiLuiRelationsByRelatedLuiAndLuiId(String luiId, String relatedLuiId){ |
41 | 0 | return (List<LuiLuiRelationEntity>) em.createQuery("from LuiLuiRelationEntity rel where rel.lui.id=:luiId AND rel.relatedLui.id=:relatedLuiId").setParameter("luiId", luiId) |
42 | |
.setParameter("relatedLuiId",relatedLuiId).getResultList(); |
43 | |
|
44 | |
} |
45 | |
|
46 | |
public List<LuiEntity> getRelatedLuisByLuiIdAndRelationType(String luiId, String luiLuiRelationTypeKey) { |
47 | 0 | return (List<LuiEntity>) em.createQuery("Select rel.relatedLui from LuiLuiRelationEntity rel where rel.lui.id=:luiId AND rel.luiLuiRelationType=:luiLuiRelationTypeKey").setParameter("luiId", luiId) |
48 | |
.setParameter("luiLuiRelationTypeKey",luiLuiRelationTypeKey).getResultList(); |
49 | |
|
50 | |
} |
51 | |
} |