Search in sources :

Example 31 with AbstractContest

use of cn.edu.zju.acm.onlinejudge.bean.AbstractContest 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

AbstractContest (cn.edu.zju.acm.onlinejudge.bean.AbstractContest)31 ActionForward (org.apache.struts.action.ActionForward)16 Problem (cn.edu.zju.acm.onlinejudge.bean.Problem)10 ActionMessages (org.apache.struts.action.ActionMessages)10 ArrayList (java.util.ArrayList)8 ActionMessage (org.apache.struts.action.ActionMessage)8 Contest (cn.edu.zju.acm.onlinejudge.bean.Contest)5 ContestPersistence (cn.edu.zju.acm.onlinejudge.persistence.ContestPersistence)5 Course (cn.edu.zju.acm.onlinejudge.bean.Course)4 Language (cn.edu.zju.acm.onlinejudge.bean.enumeration.Language)4 Date (java.util.Date)4 Limit (cn.edu.zju.acm.onlinejudge.bean.Limit)3 Problemset (cn.edu.zju.acm.onlinejudge.bean.Problemset)3 UserProfile (cn.edu.zju.acm.onlinejudge.bean.UserProfile)3 UserSecurity (cn.edu.zju.acm.onlinejudge.security.UserSecurity)3 PreparedStatement (java.sql.PreparedStatement)3 ResultSet (java.sql.ResultSet)3 Reference (cn.edu.zju.acm.onlinejudge.bean.Reference)2 Submission (cn.edu.zju.acm.onlinejudge.bean.Submission)2 ContestForm (cn.edu.zju.acm.onlinejudge.form.ContestForm)2