Search in sources :

Example 6 with ContestPersistence

use of cn.edu.zju.acm.onlinejudge.persistence.ContestPersistence in project zoj by licheng.

the class ContestManager method getContests.

public List<AbstractContest> getContests(int contestType) throws PersistenceException {
    Object key = new Integer(contestType);
    synchronized (this.contestsCache) {
        List<AbstractContest> contests = this.contestsCache.get(key);
        if (contests == null) {
            ContestPersistence contestPersistence = PersistenceManager.getInstance().getContestPersistence();
            if (contestType == 1) {
                contests = contestPersistence.getAllProblemsets();
            } else if (contestType == 0) {
                contests = contestPersistence.getAllContests();
            } else {
                contests = contestPersistence.getAllCourses();
            }
            this.contestsCache.put(key, contests);
        }
        return contests;
    }
}
Also used : AbstractContest(cn.edu.zju.acm.onlinejudge.bean.AbstractContest) ContestPersistence(cn.edu.zju.acm.onlinejudge.persistence.ContestPersistence)

Aggregations

ContestPersistence (cn.edu.zju.acm.onlinejudge.persistence.ContestPersistence)6 AbstractContest (cn.edu.zju.acm.onlinejudge.bean.AbstractContest)5 ActionMessage (org.apache.struts.action.ActionMessage)4 ActionMessages (org.apache.struts.action.ActionMessages)4 ActionForward (org.apache.struts.action.ActionForward)3 ContestForm (cn.edu.zju.acm.onlinejudge.form.ContestForm)2