-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
617 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...server-app/src/main/java/judgels/sandalphon/persistence/BaseProgrammingSubmissionDao.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
...ckends/judgels-server-app/src/main/java/judgels/uriel/contest/dump/ContestDumpModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package judgels.uriel.contest.dump; | ||
|
||
import dagger.Module; | ||
import dagger.Provides; | ||
import io.dropwizard.hibernate.UnitOfWorkAwareProxyFactory; | ||
import javax.inject.Singleton; | ||
import judgels.uriel.persistence.ContestAnnouncementDao; | ||
import judgels.uriel.persistence.ContestClarificationDao; | ||
import judgels.uriel.persistence.ContestContestantDao; | ||
import judgels.uriel.persistence.ContestDao; | ||
import judgels.uriel.persistence.ContestLogDao; | ||
import judgels.uriel.persistence.ContestManagerDao; | ||
import judgels.uriel.persistence.ContestModuleDao; | ||
import judgels.uriel.persistence.ContestProblemDao; | ||
import judgels.uriel.persistence.ContestProgrammingGradingDao; | ||
import judgels.uriel.persistence.ContestProgrammingSubmissionDao; | ||
import judgels.uriel.persistence.ContestScoreboardDao; | ||
import judgels.uriel.persistence.ContestSupervisorDao; | ||
|
||
@Module | ||
public class ContestDumpModule { | ||
private ContestDumpModule() {} | ||
|
||
@Provides | ||
@Singleton | ||
static ContestDumpTask contestDumpTask( | ||
UnitOfWorkAwareProxyFactory unitOfWorkAwareProxyFactory, | ||
ContestDao contestDao, | ||
ContestModuleDao moduleDao, | ||
ContestManagerDao managerDao, | ||
ContestSupervisorDao supervisorDao, | ||
ContestContestantDao contestantDao, | ||
ContestProblemDao problemDao, | ||
ContestAnnouncementDao announcementDao, | ||
ContestClarificationDao clarificationDao, | ||
ContestScoreboardDao scoreboardDao, | ||
ContestLogDao logDao, | ||
ContestProgrammingSubmissionDao programmingSubmissionDao, | ||
ContestProgrammingGradingDao programmingGradingDao) { | ||
|
||
return unitOfWorkAwareProxyFactory.create( | ||
ContestDumpTask.class, | ||
new Class<?>[] { | ||
ContestDao.class, | ||
ContestModuleDao.class, | ||
ContestManagerDao.class, | ||
ContestSupervisorDao.class, | ||
ContestContestantDao.class, | ||
ContestProblemDao.class, | ||
ContestAnnouncementDao.class, | ||
ContestClarificationDao.class, | ||
ContestScoreboardDao.class, | ||
ContestLogDao.class, | ||
ContestProgrammingSubmissionDao.class, | ||
ContestProgrammingGradingDao.class}, | ||
new Object[] { | ||
contestDao, | ||
moduleDao, | ||
managerDao, | ||
supervisorDao, | ||
contestantDao, | ||
problemDao, | ||
announcementDao, | ||
clarificationDao, | ||
scoreboardDao, | ||
logDao, | ||
programmingSubmissionDao, | ||
programmingGradingDao}); | ||
} | ||
} |
97 changes: 97 additions & 0 deletions
97
...backends/judgels-server-app/src/main/java/judgels/uriel/contest/dump/ContestDumpTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
package judgels.uriel.contest.dump; | ||
|
||
import io.dropwizard.hibernate.UnitOfWork; | ||
import io.dropwizard.servlets.tasks.Task; | ||
import java.io.PrintWriter; | ||
import java.util.Collection; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
import judgels.uriel.persistence.ContestAnnouncementDao; | ||
import judgels.uriel.persistence.ContestClarificationDao; | ||
import judgels.uriel.persistence.ContestContestantDao; | ||
import judgels.uriel.persistence.ContestDao; | ||
import judgels.uriel.persistence.ContestLogDao; | ||
import judgels.uriel.persistence.ContestManagerDao; | ||
import judgels.uriel.persistence.ContestModel; | ||
import judgels.uriel.persistence.ContestModuleDao; | ||
import judgels.uriel.persistence.ContestProblemDao; | ||
import judgels.uriel.persistence.ContestProgrammingGradingDao; | ||
import judgels.uriel.persistence.ContestProgrammingSubmissionDao; | ||
import judgels.uriel.persistence.ContestScoreboardDao; | ||
import judgels.uriel.persistence.ContestSupervisorDao; | ||
|
||
public class ContestDumpTask extends Task { | ||
private final ContestDao contestDao; | ||
private final ContestModuleDao moduleDao; | ||
private final ContestManagerDao managerDao; | ||
private final ContestSupervisorDao supervisorDao; | ||
private final ContestContestantDao contestantDao; | ||
private final ContestProblemDao problemDao; | ||
private final ContestAnnouncementDao announcementDao; | ||
private final ContestClarificationDao clarificationDao; | ||
private final ContestProgrammingSubmissionDao programmingSubmissionDao; | ||
private final ContestProgrammingGradingDao programmingGradingDao; | ||
private final ContestScoreboardDao scoreboardDao; | ||
private final ContestLogDao logDao; | ||
|
||
public ContestDumpTask( | ||
ContestDao contestDao, | ||
ContestModuleDao moduleDao, | ||
ContestManagerDao managerDao, | ||
ContestSupervisorDao supervisorDao, | ||
ContestContestantDao contestantDao, | ||
ContestProblemDao problemDao, | ||
ContestAnnouncementDao announcementDao, | ||
ContestClarificationDao clarificationDao, | ||
ContestScoreboardDao scoreboardDao, | ||
ContestLogDao logDao, | ||
ContestProgrammingSubmissionDao programmingSubmissionDao, | ||
ContestProgrammingGradingDao programmingGradingDao) { | ||
|
||
super("contest-dump"); | ||
|
||
this.contestDao = contestDao; | ||
this.moduleDao = moduleDao; | ||
this.managerDao = managerDao; | ||
this.supervisorDao = supervisorDao; | ||
this.contestantDao = contestantDao; | ||
this.problemDao = problemDao; | ||
this.announcementDao = announcementDao; | ||
this.clarificationDao = clarificationDao; | ||
this.scoreboardDao = scoreboardDao; | ||
this.logDao = logDao; | ||
this.programmingSubmissionDao = programmingSubmissionDao; | ||
this.programmingGradingDao = programmingGradingDao; | ||
} | ||
|
||
@Override | ||
@UnitOfWork(readOnly = true) | ||
public void execute(Map<String, List<String>> parameters, PrintWriter output) { | ||
List<String> contestSlugs = parameters.get("contestSlug"); | ||
if (contestSlugs == null || contestSlugs.isEmpty()) { | ||
return; | ||
} | ||
String contestSlug = contestSlugs.get(0); | ||
Optional<ContestModel> maybeModel = contestDao.selectBySlug(contestSlug); | ||
if (maybeModel.isEmpty()) { | ||
return; | ||
} | ||
|
||
String contestJid = maybeModel.get().jid; | ||
|
||
contestDao.dump(output, contestJid); | ||
moduleDao.dump(output, contestJid); | ||
managerDao.dump(output, contestJid); | ||
supervisorDao.dump(output, contestJid); | ||
contestantDao.dump(output, contestJid); | ||
problemDao.dump(output, contestJid); | ||
announcementDao.dump(output, contestJid); | ||
clarificationDao.dump(output, contestJid); | ||
scoreboardDao.dump(output, contestJid); | ||
logDao.dump(output, contestJid); | ||
|
||
Collection<String> submissionJids = programmingSubmissionDao.dump(output, contestJid); | ||
programmingGradingDao.dump(output, submissionJids); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.