ActionForward forward = this.checkAdmin(mapping, context);
if (forward != null) {
return forward;
}
ContestPersistence contestPersistence = PersistenceManager.getInstance().getContestPersistence();
ContestForm contestForm = (ContestForm) form;
if (contestForm == null || contestForm.getId() == null) {
return this.handleSuccess(mapping, context, "failure");
}
context.setAttribute("ContestForm", contestForm);
// create user profile
AbstractContest contest = contestForm.toContest();
contestPersistence.createContest(contest, context.getUserProfile().getId());
ContestManager.getInstance().refreshContest(contest.getId());
ActionMessages messages = new ActionMessages();
messages.add("message", new ActionMessage("onlinejudge.createContest.success"));
this.saveErrors(context.getRequest(), messages);