| 1 | |
package org.kuali.student.r2.core.class1.atp.dao; |
| 2 | |
|
| 3 | |
import java.util.List; |
| 4 | |
|
| 5 | |
import org.kuali.student.enrollment.dao.GenericEntityDao; |
| 6 | |
import org.kuali.student.r2.core.class1.atp.model.AtpAtpRelationEntity; |
| 7 | |
|
| 8 | 0 | public class AtpAtpRelationDao extends GenericEntityDao<AtpAtpRelationEntity> { |
| 9 | |
|
| 10 | |
@SuppressWarnings({"unchecked"}) |
| 11 | |
public List<AtpAtpRelationEntity> getAtpAtpRelationsByAtp(String atpId) { |
| 12 | 0 | return (List<AtpAtpRelationEntity>) em |
| 13 | |
.createQuery("from AtpAtpRelationEntity rel where rel.atp.id=:atpId OR rel.relatedAtp.id=:atpId") |
| 14 | |
.setParameter("atpId", atpId).getResultList(); |
| 15 | |
} |
| 16 | |
|
| 17 | |
@SuppressWarnings({"unchecked"}) |
| 18 | |
public List<AtpAtpRelationEntity> getAtpAtpRelationsByAtpAndRelationType(String atpId, String relationType) { |
| 19 | 0 | return (List<AtpAtpRelationEntity>) em |
| 20 | |
.createQuery("from AtpAtpRelationEntity rel where rel.atp.id=:atpId AND rel.atpType=:relationType") |
| 21 | |
.setParameter("atpId", atpId).setParameter("relationType", relationType).getResultList(); |
| 22 | |
} |
| 23 | |
|
| 24 | |
@SuppressWarnings({"unchecked"}) |
| 25 | |
public List<AtpAtpRelationEntity> getAtpAtpRelationsByAtpsAndRelationType(String atpId, String atpPeerId, |
| 26 | |
String relationType) { |
| 27 | 0 | return (List<AtpAtpRelationEntity>) em |
| 28 | |
.createQuery( |
| 29 | |
"from AtpAtpRelationEntity rel where rel.atp.id=:atpId AND rel.relatedAtp.id=:atpPeerId AND rel.atpType=:relationType") |
| 30 | |
.setParameter("atpId", atpId).setParameter("atpPeerId", atpPeerId) |
| 31 | |
.setParameter("relationType", relationType).getResultList(); |
| 32 | |
} |
| 33 | |
} |