1 | |
package org.kuali.student.r2.common.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.common.model.StateProcessRelationEntity; |
10 | |
|
11 | 0 | public class StateProcessRelationDao extends GenericEntityDao<StateProcessRelationEntity>{ |
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 | |
} |