| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.kuali.student.r2.core.class1.organization.dao; |
| 17 | |
|
| 18 | |
import java.util.List; |
| 19 | |
|
| 20 | |
import org.kuali.student.core.organization.entity.Org; |
| 21 | |
import org.kuali.student.core.organization.entity.OrgHierarchy; |
| 22 | |
import org.kuali.student.core.organization.entity.OrgOrgRelation; |
| 23 | |
import org.kuali.student.core.organization.entity.OrgPersonRelation; |
| 24 | |
import org.kuali.student.core.organization.entity.OrgPositionRestriction; |
| 25 | |
import org.kuali.student.enrollment.dao.GenericEntityDao; |
| 26 | |
|
| 27 | |
|
| 28 | |
|
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | 0 | public class ExtendedOrgDao extends GenericEntityDao<OrgPersonRelation> { |
| 33 | |
|
| 34 | |
@SuppressWarnings("unchecked") |
| 35 | |
public List<OrgPersonRelation> getOrgPersonRelationsByType(String orgPersonRelationTypeKey) { |
| 36 | 0 | return em.createQuery("from OrgPersonRelation r where r.orgPersonRelationType.id = :orgPersonRelationTypeKey") |
| 37 | |
.setParameter("orgPersonRelationTypeKey", orgPersonRelationTypeKey).getResultList(); |
| 38 | |
} |
| 39 | |
|
| 40 | |
@SuppressWarnings("unchecked") |
| 41 | |
public List<OrgPersonRelation> getOrgPersonRelationsByTypeAndOrg(String orgPersonRelationTypeKey, String orgId) { |
| 42 | 0 | return em.createQuery("from OrgPersonRelation r where r.orgPersonRelationType.id = :orgPersonRelationTypeKey and" + |
| 43 | |
" r.org.id = :orgId") |
| 44 | |
.setParameter("orgPersonRelationTypeKey", orgPersonRelationTypeKey).setParameter("orgId", orgId).getResultList(); |
| 45 | |
} |
| 46 | |
|
| 47 | |
@SuppressWarnings("unchecked") |
| 48 | |
public List<OrgPersonRelation> getOrgPersonRelationsByPerson(String personId) { |
| 49 | 0 | return em.createQuery("from OrgPersonRelation r where r.personId = :personId") |
| 50 | |
.setParameter("personId", personId).getResultList(); |
| 51 | |
} |
| 52 | |
|
| 53 | |
@SuppressWarnings("unchecked") |
| 54 | |
public List<OrgPersonRelation> getOrgPersonRelationsByTypeAndPerson(String orgPersonRelationTypeKey, String personId) { |
| 55 | 0 | return em.createQuery("from OrgPersonRelation r where r.orgPersonRelationType.id = :orgPersonRelationTypeKey and" + |
| 56 | |
" r.personId = :personId") |
| 57 | |
.setParameter("orgPersonRelationTypeKey", orgPersonRelationTypeKey).setParameter("personId", personId).getResultList(); |
| 58 | |
} |
| 59 | |
|
| 60 | |
@SuppressWarnings("unchecked") |
| 61 | |
public List<OrgPersonRelation> getOrgPersonRelationsByOrgAndPerson(String orgId, String personId) { |
| 62 | 0 | return em.createQuery("from OrgPersonRelation r where r.org.id = :orgId and r.personId = :personId") |
| 63 | |
.setParameter("orgId", orgId).setParameter("personId", personId).getResultList(); |
| 64 | |
} |
| 65 | |
|
| 66 | |
@SuppressWarnings("unchecked") |
| 67 | |
public List<OrgPersonRelation> getOrgPersonRelationsByTypeAndOrgAndPerson(String orgPersonRelationTypeKey, String orgId, String personId) { |
| 68 | 0 | return em.createQuery("from OrgPersonRelation r where r.orgPersonRelationType.id = :orgPersonRelationTypeKey and" + |
| 69 | |
" r.org.id = :orgId and r.personId = :personId") |
| 70 | |
.setParameter("orgPersonRelationTypeKey", orgPersonRelationTypeKey).setParameter("orgId", orgId) |
| 71 | |
.setParameter("personId", personId).getResultList(); |
| 72 | |
} |
| 73 | |
|
| 74 | |
@SuppressWarnings("unchecked") |
| 75 | |
public List<Org> getOrgsByType(String orgTypeKey) { |
| 76 | 0 | return em.createQuery("from Org r where r.type.id = :orgTypeKey") |
| 77 | |
.setParameter("orgTypeKey", orgTypeKey).getResultList(); |
| 78 | |
} |
| 79 | |
|
| 80 | |
@SuppressWarnings("unchecked") |
| 81 | |
public List<OrgOrgRelation> getOrgOrgRelationsByTypeAndOrg(String orgId, String orgOrgRelationTypeKey){ |
| 82 | 0 | return em.createQuery("from OrgOrgRelation r where r.type.id = :orgOrgRelationTypeKey and r.org.id = :orgId") |
| 83 | |
.setParameter("orgOrgRelationTypeKey", orgOrgRelationTypeKey).setParameter("orgId", orgId).getResultList(); |
| 84 | |
} |
| 85 | |
|
| 86 | |
@SuppressWarnings("unchecked") |
| 87 | |
public List<OrgOrgRelation> getOrgOrgRelationsByType(String orgOrgRelationTypeKey) { |
| 88 | 0 | return em.createQuery("from OrgOrgRelation r where r.type.id = :orgOrgRelationTypeKey") |
| 89 | |
.setParameter("orgOrgRelationTypeKey", orgOrgRelationTypeKey).getResultList(); |
| 90 | |
} |
| 91 | |
|
| 92 | |
@SuppressWarnings("unchecked") |
| 93 | |
public List<OrgPositionRestriction> getOrgPositionRestrictionsByIds(List<String> orgPositionRestrictionIds) { |
| 94 | 0 | return em.createQuery("from OrgPositionRestriction r where r.id in (:orgPositionRestrictionIds)") |
| 95 | |
.setParameter("orgPositionRestrictionIds", orgPositionRestrictionIds).getResultList(); |
| 96 | |
} |
| 97 | |
|
| 98 | |
@SuppressWarnings("unchecked") |
| 99 | |
public List<OrgPositionRestriction> getOrgPositionRestrictionsByType(String orgPositionRestrictionTypeKey) { |
| 100 | 0 | return em.createQuery("from OrgPositionRestriction r where r.personRelationType.id = :orgPositionRestrictionTypeKey") |
| 101 | |
.setParameter("orgPositionRestrictionTypeKey", orgPositionRestrictionTypeKey).getResultList(); |
| 102 | |
} |
| 103 | |
|
| 104 | |
@SuppressWarnings("unchecked") |
| 105 | |
public List<OrgHierarchy> getOrgHierarchiesByIds(List<String> orgHierarchyIds){ |
| 106 | 0 | return em.createQuery("from OrgHierarchy r where r.id in (:orgHierarchyIds)") |
| 107 | |
.setParameter("orgHierarchyIds", orgHierarchyIds).getResultList(); |
| 108 | |
} |
| 109 | |
|
| 110 | |
@SuppressWarnings("unchecked") |
| 111 | |
public List<OrgHierarchy> getOrgHierarchiesByType(String orgHierarchyTypeKey) { |
| 112 | 0 | return em.createQuery("from OrgHierarchy r where r.id = :orgHierarchyTypeKey") |
| 113 | |
.setParameter("orgHierarchyTypeKey", orgHierarchyTypeKey).getResultList(); |
| 114 | |
} |
| 115 | |
|
| 116 | |
} |