use of cn.edu.zju.acm.onlinejudge.bean.request.ProblemCriteria in project zoj by licheng.
the class ContestManager method getContestProblems.
public List<Problem> getContestProblems(long contestId) throws PersistenceException {
ProblemCriteria criteria = new ProblemCriteria();
criteria.setContestId(new Long(contestId));
return this.searchProblems(criteria, 0, Integer.MAX_VALUE);
}
use of cn.edu.zju.acm.onlinejudge.bean.request.ProblemCriteria in project zoj by licheng.
the class ContestManager method refreshContest.
public void refreshContest(long contestId) {
synchronized (this.contestProblemsCache) {
for (Object key : this.contestProblemsCache.getKeys()) {
ProblemCriteria criteria = ((List<ProblemCriteria>) key).iterator().next();
if (criteria.getContestId() == contestId) {
this.contestProblemsCache.remove(key);
}
}
}
this.contestCache.remove(contestId);
this.problemCountCache.remove(contestId);
this.contestsCache.remove(true);
this.contestsCache.remove(false);
}
use of cn.edu.zju.acm.onlinejudge.bean.request.ProblemCriteria in project zoj by licheng.
the class ContestManager method getContestProblems.
public List<Problem> getContestProblems(long contestId, int offset, int count) throws PersistenceException {
ProblemCriteria criteria = new ProblemCriteria();
criteria.setContestId(new Long(contestId));
return this.searchProblems(criteria, offset, count);
}
use of cn.edu.zju.acm.onlinejudge.bean.request.ProblemCriteria in project zoj by licheng.
the class ContextAdapter method getProblem.
public Problem getProblem() throws PersistenceException {
if (this.getAttribute("problem") instanceof Problem) {
return (Problem) this.getAttribute("problem");
}
long problemId = -1;
String stringCode = this.request.getParameter("problemCode");
String stringId = this.request.getParameter("problemId");
if (stringCode != null) {
ProblemCriteria pc = new ProblemCriteria();
pc.setContestId(new Long(ConfigManager.getDefaultProblemSetId()));
pc.setCode(stringCode);
ProblemPersistence problemPersistence = PersistenceManager.getInstance().getProblemPersistence();
List problems = problemPersistence.searchProblems(pc, 0, 1);
if (problems.size() != 0) {
problemId = ((Problem) (problems.get(0))).getId();
stringId = "" + problemId;
}
}
this.setAttribute("problemId", stringId);
if (stringId != null) {
try {
problemId = Long.parseLong(stringId);
} catch (NumberFormatException e) {
}
}
if (problemId < 0) {
return null;
}
Problem problem = ContestManager.getInstance().getProblem(problemId);
this.setAttribute("problem", problem);
return problem;
}
Aggregations