Package bg.smoc.model.manager

Examples of bg.smoc.model.manager.ContestManager


        FileUtils.copyStreams(bis, sos);
        bis.close();
    }

    public byte[] getInputStream(HttpServletRequest request, String userLogin) throws IOException {
        ContestManager contestManager = SessionUtil.getInstance().getContestManager();
        Contest contest = contestManager.getContest(request);

        String taskname = request.getParameter("taskname");
        if (taskname == null || contest == null)
            return null;

        byte[] bytearray = contestManager.getSourceCodeAsByteArray(contest, userLogin, taskname);
        if (bytearray == null)
            return null;

        return bytearray;
    }
View Full Code Here


    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        ServletFileUpload servletFileUpload = setUpServletFileUpload();
        ContestManager contestManager = SessionUtil.getInstance().getContestManager();

        List<FileItem> fileItemsList = null;
        try {
            fileItemsList = servletFileUpload.parseRequest(request);
        } catch (FileUploadException e) {
View Full Code Here

    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        SessionUtil sessionUtil = SessionUtil.getInstance();
        String userLogin = sessionUtil.getLoginManager().getActiveUserLogin(request);
        ContestManager contestManager = sessionUtil.getContestManager();
        Contest contest = contestManager.getContest(request);
        if (contest == null) {
            response.sendRedirect("");
            return;
        }

        request.setAttribute("userLogin", userLogin);
        request.setAttribute("contest", contest);
        request.setAttribute("time", Util.DATETIME_FORMAT.format(new java.util.Date()));

        User user = contestManager.getUser(contest.getId(), userLogin);
        Hashtable<String, String> hash = user.getStatus();
        generateTable(request, hash, contest.getTasks());

        request.setAttribute("announcement", generateAnnouncement(contest.getAnnouncement()));
        request.setAttribute("languages", Contest.Language.values());
View Full Code Here

    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        String contestId = request.getParameter("id");
        ContestManager contestManager = SessionUtil.getInstance().getContestManager();
        Contest contest = contestManager.getContest(contestId);
        contest.setRunning(true);
        contest.setTestingOn(true);
        contest.setFeedbackOn(true);
        contest.setLastStartTime(Util.DATETIME_FORMAT.format(new java.util.Date()));
        contestManager.updateContest(contest);
        contestManager.scheduleContest(contest);
        response.sendRedirect("contestSetup");
    }
View Full Code Here

    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        String contestId = request.getParameter("contestId");
        SessionUtil sessionUtil = SessionUtil.getInstance();
        ContestManager contestManager = sessionUtil.getContestManager();
        Contest contest = contestManager.getContest(contestId);
        if (contest == null) {
            response.sendRedirect("");
        }
       
        ContestReportGenerator generator = new ContestReportGenerator();
View Full Code Here

    protected void service(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        boolean value = Boolean.parseBoolean(request.getParameter("value"));
        String contestId = request.getParameter("id");

        ContestManager contestManager = SessionUtil.getInstance().getContestManager();
        Contest contest = contestManager.getContest(contestId);
        updateContestProperty(contest, value);
        contestManager.updateContest(contest);

        response.sendRedirect("contestSetup");
    }
View Full Code Here

    protected void service(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        String userLogin = request.getParameter("login");
        UserAccount userAccount = SessionUtil.getInstance().getUserAccountManager()
                .getUserAccount(userLogin);
        ContestManager contestManager = SessionUtil.getInstance().getContestManager();
        if (userAccount != null) {
            if (request.getParameter("password") != null && request.getParameter("password") != "") {
                userAccount.setPassword(request.getParameter("password"));
                userAccount.setPasswordHash(ServletUtil.encryptPassword(userAccount.getPassword()));
            }
            if (request.getParameter("contest") != null) {
                userAccount.getContestIds().add(request.getParameter("contest"));
                contestManager.registerUserForContest(request.getParameter("contest"), userLogin);
            }
            else if (request.getParameterValues("contests") != null) {
                userAccount.getContestIds().clear();
                for (String contest : request.getParameterValues("contests")) {
                    userAccount.getContestIds().add(contest);
                    contestManager.registerUserForContest(contest, userLogin);
                }
            } else {
                userAccount.setContestIds(null);
            }
            SessionUtil.getInstance().getUserAccountManager().update(userAccount);
View Full Code Here

    private void setUpManagers() {
        userAccountManager = new UserAccountManager(userAccountSerializer);
        loginManager = new LoginManager();
        personManager = new PersonManager(personSerializer);
        graderManager = new GraderManager(gradingPort, workingDirectory);
        contestManager = new ContestManager(workingDirectory, contestSerializer);
        printManager = new PrintManager(workingDirectory);
       
        mediator = new ManagerMediator();
        mediator.setManagersFromSessionUtil(this);
View Full Code Here

    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        SessionUtil sessionUtil = SessionUtil.getInstance();
        String userLogin = sessionUtil.getLoginManager().getActiveUserLogin(request);
        ContestManager contestManager = sessionUtil.getContestManager();
        Contest contest = contestManager.getContest(request);
        if (contest == null) {
            response.sendRedirect("");
            return;
        }
        User user = contestManager.getUser(contest.getId(), userLogin);
        if (!contest.isRunning()) {
            user.getGeneralState().setOutputNow("Backup failed: Contest not running");
            request.getSession().setAttribute("tab", "General");
            response.sendRedirect("main");
            return;
View Full Code Here

    private void display(HttpServletRequest request, HttpServletResponse response,
            Properties propertyBackup) throws ServletException, IOException {
        SessionUtil sessionUtil = SessionUtil.getInstance();
        String userLogin = sessionUtil.getLoginManager().getActiveUserLogin(request);
        ContestManager contestManager = sessionUtil.getContestManager();
        Contest contest = contestManager.getContest(request);
        if (contest == null) {
            response.sendRedirect("");
            return;
        }
View Full Code Here

TOP

Related Classes of bg.smoc.model.manager.ContestManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.