⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 submitsoapbindingimpl.java.svn-base

📁 远程学生作业提交系统,所用技术JSP,Servelet,Ajax,Web Services,MySql
💻 SVN-BASE
📖 第 1 页 / 共 2 页
字号:
     * The service to get the project's opendate
     * @param proj_id The project's identifier
     * @return proj_time The date
     */
    public java.util.Calendar getProjectOpendate(java.lang.String proj_id) throws java.rmi.RemoteException {
        Calendar cal = Calendar.getInstance(); // The calendar to return
        java.sql.Date date;

        try {
            // Make the sql query
            date = _sqlReq.getProjectOpendate(Integer.parseInt(proj_id));
            if (date == null)
               return null;
            else
                cal.setTime(date);

            // Save the modification
            _sqlReq.doCommit();
        } catch (SQLException e) {
            throw new java.rmi.RemoteException(e.toString());
        }

        return cal;
    }

    /**
     * The service to set the project's closedate
     * @param proj_id The project's identifier
     * @param proj_time The date
     */
    public void setProjectClosedate(java.lang.String proj_id, java.util.Calendar proj_time) throws java.rmi.RemoteException {
        Statement stmtForMail = null;
        ResultSet results = null;

        StringBuffer subjectId = new StringBuffer(""); // The subject's identifier of this project
        StringBuffer projDesc = new StringBuffer(""); // The project's description
        StringBuffer projectName = new StringBuffer(""); // The project's name
        StringBuffer year = new StringBuffer(""); // The project's year
        StringBuffer semester = new StringBuffer(""); // The project's semester
        StringBuffer url = new StringBuffer(""); // The project's url
        java.sql.Date closeDate; // The project's open date
        String[] emails; // The user's emails to send the notification

        try {
            // Make the sql query
            if (proj_time != null) {
                _sqlReq.setProjectClosedate(Integer.parseInt(proj_id), new java.sql.Date(proj_time.getTime().getTime()));

                // Get the project's informations
                _sqlReq.getProjectById(Integer.parseInt(proj_id), subjectId, year, semester, projectName, projDesc, url);
                closeDate = _sqlReq.getProjectClosedate(Integer.parseInt(proj_id));

                // Get the emails
                emails = _sqlReq.getUserEmailsProject(Integer.parseInt(subjectId.toString()));

                // sending of the emails
                _mailNotifier.projChangeDueDateAssignNot(projectName.toString(), proj_id, null, closeDate, projDesc.toString(), url.toString(), emails);
            } else {
                _sqlReq.setProjectClosedate(Integer.parseInt(proj_id), null);
            }

            // Save the modification
            _sqlReq.doCommit();
        } catch (SQLException e) {
            throw new java.rmi.RemoteException(e.toString());
        }
    }

    /**
     * The service to get the project's closedate
     * @param proj_id The project's identifier
     * @return proj_time The date
     */
    public java.util.Calendar getProjectClosedate(java.lang.String proj_id) throws java.rmi.RemoteException {
        Calendar cal = Calendar.getInstance(); // The calendar to return
        java.sql.Date date;

        try {
            // Make the sql query
            date = _sqlReq.getProjectClosedate(Integer.parseInt(proj_id));
            if (date == null)
               return null;
            else
                cal.setTime(date);

            // Save the modification
            _sqlReq.doCommit();
        } catch (SQLException e) {
            throw new java.rmi.RemoteException(e.toString());
        }

        return cal;
    }

    /**
     * The service to get all the subjects of the system
     * @return The list of subjects
     */
    public com.sixtwenty.Subjects[] getSubjectList() throws java.rmi.RemoteException {
        // The subjects to return
        Subjects[] subjects;

        try {
            // Make the sql request
            subjects = _sqlReq.getSubjectList();

            // Save the modification
            _sqlReq.doCommit();
        } catch (SQLException e) {
            throw new java.rmi.RemoteException(e.toString());
        }

        return subjects;
    }

    /**
     * The service to add a user in the system
     * @param loginName The login name of the user
     * @param password Its password
     * @param role Its role (can be: "student", "staff" or "admin")
     * @param name The user's name
     * @param email The user's email
     */
    public void addUser(java.lang.String loginName, java.lang.String password, java.lang.String role, java.lang.String name, java.lang.String email) throws java.rmi.RemoteException {
        try {
            // Make the sql query
            _sqlReq.addUser(loginName, password, role, name, email);

            // Save the modification
            _sqlReq.doCommit();
        } catch (SQLException e) {
            throw new java.rmi.RemoteException(e.toString());
        }
    }

    /**
     * The service to add a subject in the system
     * @param name The subject's name
     * @param lecturer_id The lecturer's login name
     */
    public void addSubject(java.lang.String name, java.lang.String lecturer_id) throws java.rmi.RemoteException {
        try {
            // Make the sql query
            _sqlReq.addSubject(name, lecturer_id);

            // Save the modification
            _sqlReq.doCommit();
        } catch (SQLException e) {
            throw new java.rmi.RemoteException(e.toString());
        }
    }

    /**
     * The service to assign a subject to a user
     * @param loginName The login name of the user
     * @param subjectId The subject's identifier
     */
    public void setUserSubject(java.lang.String loginName, java.lang.String subjectId) throws java.rmi.RemoteException {
        try {
            // Make the sql query
            _sqlReq.setUserSubject(loginName, Integer.parseInt(subjectId));

            // Save the modification
            _sqlReq.doCommit();
        } catch (SQLException e) {
            throw new java.rmi.RemoteException(e.toString());
        }
    }

    /**
     * The service to add a submission from a user to a project of the system
     * @param proj_id The project identifier of this submission
     * @param submission The submission containing all the informations to add to the system
     * @param submit_timestamp The time when the file has been submitted
     */
    public java.lang.String addSubmission(java.lang.String proj_id, com.sixtwenty.Submissions submission, java.util.Calendar submit_timestamp) throws java.rmi.RemoteException {
        int subId; // The submission's identifier
        SubmitFiles[] files; // The files of the submission

        try {
            // Make the sql query
            //throw new java.rmi.RemoteException(String.valueOf(Integer.parseInt(proj_id)));
             subId = _sqlReq.createSubmission(Integer.parseInt(proj_id), submission.getSub_user(), new java.sql.Date(submit_timestamp.getTime().getTime()), submission.getSub_ipaddress());

            // Now we add the files of this submission
            files = submission.getSub_files();
            for (int i=0; i < files.length; i++) {
                // Make the sql query
                //throw new java.rmi.RemoteException("size: " + String.valueOf(files[i].getFilesize()));
                _sqlReq.addSubmissionFile(subId, files[i].getFilename(), files[i].getFileContents(), files[i].getFilesize());
            }

            // Save the modification
            _sqlReq.doCommit();
        } catch (SQLException e) {
            throw new java.rmi.RemoteException(e.toString());
        }

        return String.valueOf(subId);
    }

    /**
     * The service to verify that a submission has been submitted correctly into the system
     * @param sub_id The submission identifier
     */
    public java.lang.String verifySubmission(java.lang.String sub_id) throws java.rmi.RemoteException {
        String result; // the submission is present in the system or not ?

        try {
            // Make the sql query
            result = _sqlReq.verifySubmission(Integer.parseInt(sub_id));

            // Save the modification
            _sqlReq.doCommit();
        } catch (SQLException e) {
            throw new java.rmi.RemoteException(e.toString());
        }

        return result;
    }

    /**
     * The service to get a submission from the system
     * @param sub_id The submission's identifier
     */
    public com.sixtwenty.Submissions getSubmission(java.lang.String sub_id) throws java.rmi.RemoteException {
        // The submission to return
        Submissions submission;
        SubmitFiles[] files; // the files of the submission
        int nbFiles; // the number of submit files
        Calendar cal = Calendar.getInstance(); // The submission's calendar

        StringBuffer subIpAd = new StringBuffer(""); // The submission's ip address
        java.sql.Date subTime = new java.sql.Date(0); // The submission's date
        StringBuffer subUser = new StringBuffer(""); // The submission's user
        StringBuffer subjId = new StringBuffer(""); // The submission's subject
        StringBuffer projId = new StringBuffer(""); // The submission's project id
        String filename; // The name of a submission's file
        int length; // The size of a submission's file
        byte[] fileData; // The data of a submission's file

        try {
            // Make the sql query
            _sqlReq.getSubmission(Integer.parseInt(sub_id), subjId, projId, subUser, subTime, subIpAd);

            // Get all the files of this submission
            // Make the sql query
            files = _sqlReq.getSubmissionFiles(Integer.parseInt(sub_id));

            cal.setTime(subTime);
            // Creation of the submission to return
            submission = new Submissions(files, sub_id.toString(), subIpAd.toString(), files.length, cal, subUser.toString());

            // Save the modification
            _sqlReq.doCommit();
        } catch (SQLException e) {
            throw new java.rmi.RemoteException(e.toString());
        }

        return submission;
    }

    /**
     * The service to get all the submissions a user has made
     * @param username The login name of the user
     */
    public com.sixtwenty.Submissions[] getSubmissionList(java.lang.String username) throws java.rmi.RemoteException {
        // The submissions to return
        Submissions[] submissions;

        try {
            // Make the sql query
            submissions = _sqlReq.getSubmissionList(username);

            // Save the modification
            _sqlReq.doCommit();
        } catch (SQLException e) {
            throw new java.rmi.RemoteException(e.toString());
        }

        return submissions;
    }

    /**
     * The service to get all the submissions regarding a given project
     * @param proj_id The project's identifier in question
     */
    public com.sixtwenty.Submissions[] getProjectSubmissions(java.lang.String proj_id) throws java.rmi.RemoteException {
        // The submissions to return
        Submissions[] submissions;

        try {
            // Make the sql query
            submissions = _sqlReq.getProjectSubmissions(proj_id);

            // Save the modification
            _sqlReq.doCommit();
        } catch (SQLException e) {
            throw new java.rmi.RemoteException(e.toString());
        }

        return submissions;
    }

    /**
     * The service to authenticate a user
     * @param username The userName to check
     * @param password The password to check
     * @return true is the user is known, false otherwise
     */
    public boolean authenticateUser(java.lang.String username, java.lang.String password) throws java.rmi.RemoteException {
        String result;

        try {
            // Make the sql query
            result = _sqlReq.authenticateUser(username, password);

            // Save the modification
            _sqlReq.doCommit();
        } catch (SQLException e) {
            throw new java.rmi.RemoteException(e.toString());
        }

        return !result.equals("Unknown");
    }

    /**
     * The service to get the access level of a given user
     * @param username The login of the user
     */
    public int accessLevel(java.lang.String username) throws java.rmi.RemoteException {
        int result;

        try {
            // Make the sql query
            result = _sqlReq.accessLevel(username);

            // Save the modification
            _sqlReq.doCommit();
        } catch (SQLException e) {
            throw new java.rmi.RemoteException(e.toString());
        }

        return result;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -