1 | |
package org.kuali.student.r2.core.class1.state.dao; |
2 | |
|
3 | |
import java.util.List; |
4 | |
|
5 | |
import javax.persistence.Query; |
6 | |
|
7 | |
import org.kuali.student.enrollment.dao.GenericEntityDao; |
8 | |
import org.kuali.student.r2.core.class1.state.model.StateEntity; |
9 | |
import org.kuali.student.r2.core.class1.state.model.StateLifecycleRelationEntity; |
10 | |
|
11 | 0 | public class StateLifecycleRelationDao extends GenericEntityDao<StateLifecycleRelationEntity> { |
12 | |
@SuppressWarnings("unchecked") |
13 | |
public List<StateEntity> getInitialValidStates(String processKey) { |
14 | 0 | Query query = em.createNamedQuery("StateProcess.getInitialValidStates"); |
15 | 0 | query.setParameter("processKey", processKey); |
16 | 0 | List<StateEntity> initStates = query.getResultList(); |
17 | 0 | return initStates; |
18 | |
} |
19 | |
|
20 | |
public StateEntity getNextHappyState(String processKey, String currentStateKey) { |
21 | 0 | Query query = em.createNamedQuery("StateProcess.getNextHappyState"); |
22 | 0 | query.setParameter("processKey", processKey); |
23 | 0 | query.setParameter("stateKey", currentStateKey); |
24 | 0 | StateEntity nextState = (StateEntity) query.getSingleResult(); |
25 | 0 | return nextState; |
26 | |
} |
27 | |
|
28 | |
@SuppressWarnings("unchecked") |
29 | |
public List<StateLifecycleRelationEntity> getStateLifecycleRelationsByState(String stateKey) { |
30 | 0 | Query query = em.createNamedQuery("StateProcess.getStateLifecycleRelationsByState"); |
31 | 0 | query.setParameter("stateKey", stateKey); |
32 | 0 | List<StateLifecycleRelationEntity> relStates = query.getResultList(); |
33 | 0 | return relStates; |
34 | |
} |
35 | |
|
36 | |
@SuppressWarnings("unchecked") |
37 | |
public List<StateLifecycleRelationEntity> getStateLifecycleRelationsByLifecycle(String lifecycleKey) { |
38 | 0 | Query query = em.createNamedQuery("StateProcess.getStateLifecycleRelationsByLifecycle"); |
39 | 0 | query.setParameter("lifecycleKey", lifecycleKey); |
40 | 0 | List<StateLifecycleRelationEntity> relStates = query.getResultList(); |
41 | 0 | return relStates; |
42 | |
} |
43 | |
} |