Package bg.smoc.model.manager

Examples of bg.smoc.model.manager.PrintManager


        if (userId == null) {
            response.sendRedirect("index.jsp");
            return;
        }

        PrintManager printManager = SessionUtil.getInstance().getPrintManager();
        ContestManager contestManager = SessionUtil.getInstance().getContestManager();
       
        Contest currContest = contestManager.getContest(request);
        // do not allow printing in open contests
        if (currContest.isOpenContest()) {
            response.sendRedirect("main?error=52");
            return;
        }

        try {
            // request parsing
            HttpPostFileParser postFileParser = new HttpPostFileParser();
            // convert from KBytes to bytes
            int maxFileSize = printManager.getMaxFileSize() * 1024;
            postFileParser.init(request, maxFileSize);

            if (postFileParser.nFile == 0) {
                response.sendRedirect("main?error=12");
                return;
            }

            File fileSrcFile = postFileParser.upFile[0].GetTmpFile();

            boolean bResult = printManager.print(fileSrcFile, userId);
            if (!bResult) {
                response.sendRedirect("main?error=52");
            } else {
                response.sendRedirect("main?error=50");
            }
View Full Code Here


        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);

        contestManager.initActiveUsers();
View Full Code Here

    public void service(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        SessionUtil sessionUtil = SessionUtil.getInstance();
        String userLogin = sessionUtil.getLoginManager().getActiveUserLogin(request);
        ContestManager contestManager = sessionUtil.getContestManager();
        PrintManager printManager = sessionUtil.getPrintManager();
        Contest contest = contestManager.getContest(request);
        if (contest == null) {
            response.sendRedirect("");
            return;
        }
        User user = contestManager.getUser(contest.getId(), userLogin);
        if (!contest.isRunning()) {
            user.getGeneralState().setOutputNow("Print failed: Contest not running");
            request.getSession().setAttribute("tab", "General");
            response.sendRedirect("main");
            return;
        }
       
        // do not allow printing in open contests
        if (contest.isOpenContest()) {
            user.getGeneralState().setOutputNow("Print failed: No printing in open contests");
            request.getSession().setAttribute("tab", "General");
            response.sendRedirect("main");
            return;
        }

        try {
            // request parsing
            HttpPostFileParser postFileParser = new HttpPostFileParser();
            // convert from KBytes to bytes
            int maxFileSize = printManager.getMaxFileSize() * 1024;
            postFileParser.init(request, maxFileSize);

            if (postFileParser.nFile == 0) {
                user.getGeneralState().setOutputNow("Print failed: No file selected");
                request.getSession().setAttribute("tab", "General");
                response.sendRedirect("main");
                return;
            }

            File fileSrcFile = postFileParser.upFile[0].GetTmpFile();

            boolean bResult = printManager.print(fileSrcFile, userLogin);
            if (!bResult) {
                user.getGeneralState().setOutputNow("Print failed");
                request.getSession().setAttribute("tab", "General");
                response.sendRedirect("main");
                return;
View Full Code Here

TOP

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

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.