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

📄 submitsoapbindingimpl.java

📁 远程学生作业提交系统,所用技术JSP,Servelet,Ajax,Web Services,MySql
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/**
 * SubmitSoapBindingImpl.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
 */

package com.sixtwenty;

import java.sql.*;
import java.util.*;

/**
 * The Webservice called submit which is the based for a
 * submissions system.
 */
public class SubmitSoapBindingImpl implements com.sixtwenty.Submit {
    /**
     * The SQL requests engine
     */
    protected SQLRequests _sqlReq;

    /**
     * The database's location
     */
    protected String _source = "jdbc:mysql://127.0.0.1/test";

    /**
     * The database's user
     */
    protected String _dbmUser = "root";

    /**
     * The database's password
     */
    protected String _dbmPassword = "admin";

    /**
     * The mail notification system
     */
    protected MailNotifier _mailNotifier;

    /**
     * The smtp server's host
     */
    protected String _smtpServerHost = "127.0.0.1";

    /**
     * The user's login to connect to the smtp server
     */
    protected String _smtpUserLogin = "";

    /**
     * The password to connect to the smtp server
     */
    protected String _smtpPassword = "";

    /**
     * The author of the email
     */
    protected String _mailAuthor = "NotificationSystem";

    /**
     * Constructor: initialise the SQL request engine and the mail notifier system
     */
    public SubmitSoapBindingImpl() {
        _mailNotifier = new MailNotifier(_smtpServerHost, _smtpUserLogin, _smtpPassword, _mailAuthor);
        _sqlReq = new SQLRequests(_source, _dbmUser, _dbmPassword);
    }

    /**
     * The service to get a specific project belonging to a given subject
     * @param subj_code The subject code
     * @param year The year that the project has been given
     * @param semester The semester that the project has been given
     * @proj_name The project's name
     * @return An instance of Project containing all the informations about this project
     */
    public com.sixtwenty.Projects getProject(java.lang.String subj_code, java.lang.String year, java.lang.String semester, java.lang.String proj_name) throws java.rmi.RemoteException {
        // The project to return
        Projects project;

        StringBuffer projDesc = new StringBuffer(""); // The project's description
        StringBuffer projId = new StringBuffer(""); // The project's identifier
        StringBuffer url = new StringBuffer(""); // The project's url

        try {
            // Make the sql request
            projId.append(_sqlReq.getProject(Integer.parseInt(subj_code), year, semester, proj_name, projDesc, url));

            // Creation of the project to return
            project = new Projects(projDesc.toString(), projId.toString(), proj_name, url.toString(), semester, subj_code, year);

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

        return project;
    }

    /**
     * The service to add a project belonging to a given subject
     * @param subj_code The subject code
     * @param year The year that the project has been given
     * @param semester The semester that the project has been given
     * @param proj_name The project's name
     * @param proj_description The project's description
     * @param proj_url The project's url
     * @return The identifier of the project just added
     */
    public java.lang.String addProject(java.lang.String subj_code, java.lang.String year, java.lang.String semester, java.lang.String proj_name, java.lang.String proj_description, java.lang.String proj_url) throws java.rmi.RemoteException {
        String projId; // The project's identifier
        String[] emails; // The user's emails to send the notification

        try {
            // Make the sql request
            projId = String.valueOf(_sqlReq.addProject(Integer.parseInt(subj_code), year, semester, proj_name, proj_description, proj_url));

            // Get the list of emails
            emails = _sqlReq.getUserEmailsProject(Integer.parseInt(subj_code));

            // sending of the emails
            _mailNotifier.newProjectNot(proj_name, projId, null, null, proj_description, proj_url, emails);

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

        return projId;
    }

    /**
     * The service to get all the informations of project by its identifier
     * @param proj_id The project's identifier
     * @return A Project object containing all the informations about the project with this id
     */
    public com.sixtwenty.Projects getProjectByID(java.lang.String proj_id) throws java.rmi.RemoteException {
        // The project to return
        Projects project;

        StringBuffer projDesc = new StringBuffer(""); // The project's description
        StringBuffer url = new StringBuffer(""); // The project's url
        StringBuffer subjCode = new StringBuffer(""); // The subject's code
        StringBuffer year = new StringBuffer(""); // The project's year
        StringBuffer semester = new StringBuffer(""); // The project's semester
        StringBuffer name = new StringBuffer(""); // The project's name

        try {
            // Make the sql request
            _sqlReq.getProjectById(Integer.parseInt(proj_id), subjCode, year, semester, name, projDesc, url);

            // Creation of the project to return
            project = new Projects(projDesc.toString(), proj_id, name.toString(), url.toString(), semester.toString(), subjCode.toString(), year.toString());

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

        return project;
    }

    /**
     * The service to get all the projects of a specific user
     * @param user_id The user's login name
     * @return The list of projects of this user
     */
    public com.sixtwenty.Projects[] getProjectUser(java.lang.String user_id, java.lang.String status) throws java.rmi.RemoteException {
        // The projects to return
        Projects[] projects;

        try {
            // Make the sql request
            projects = _sqlReq.getProjectUser(user_id, status);

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

        return projects;
    }

    /**
     * The service to get all the projects of a specific staff
     * @param user_id The staff's login name
     * @return The list of projects of this user
     */
    public com.sixtwenty.Projects[] getProjectStaff(java.lang.String user_id) throws java.rmi.RemoteException {
        // The projects to return
        Projects[] projects;

        try {
            // Make the sql request
            projects = _sqlReq.getProjectStaff(user_id);

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

        return projects;
    }

    /**
     * The service to get all the projects of the system
     */
    public com.sixtwenty.Projects[] getProjectList() throws java.rmi.RemoteException {
        // The projects to return
        Projects[] projects;

        try {
            // Make the sql request
            projects = _sqlReq.getProjectList();

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

        return projects;
    }

    /**
     * The service to get all the users of the system with a specific role
     * @param role The users's role expected
     * @return The list of users with this role
     */
    public com.sixtwenty.Users[] getUserList(java.lang.String role) throws java.rmi.RemoteException {
        // The projects to return
        Users[] users;

        try {
            // Make the sql request
            users = _sqlReq.getUserList(role);

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

        return users;
    }

    /**
     * The service to set the status of the project. In other word if submissions can still be done
     * for this project or not.
     * "open" for yes
     * "close" for no
     * @param proj_id The project in question
     * @param status The new status of this project
     */
    public void setProjectStatus(java.lang.String proj_id, java.lang.String status) 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 openDate; // The project's open date
        String[] emails; // The user's emails to send the notification

        try {
            // Make the sql request
            _sqlReq.setProjectStatus(Integer.parseInt(proj_id), status);

            // Send the email notification to all the users concern by this project
            if (status.equals("O")) {
                // Get the project's informations
                _sqlReq.getProjectById(Integer.parseInt(proj_id), subjectId, year, semester, projectName, projDesc, url);
                openDate = _sqlReq.getProjectOpendate(Integer.parseInt(proj_id));

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

                // sending of the emails
                _mailNotifier.projOpenAssignNot(projectName.toString(), proj_id, openDate, null, projDesc.toString(), url.toString(), emails);
            }

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

    /**
     * The service to get the status of a project. In other word if submissions can still be done
     * for this project or not.
     * "open" for yes
     * "close" for no
     * @param proj_id The project in question
     */
    public java.lang.String getProjectStatus(java.lang.String proj_id) throws java.rmi.RemoteException {
        // The project's status to return
        String status;

        try {
            // Make the sql query
            status = _sqlReq.getProjectStatus(Integer.parseInt(proj_id));

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

        return status;
    }

    /**
     * The service to set the project's opendate
     * @param proj_id The project's identifier
     * @param proj_time The date
     */
    public void setProjectOpendate(java.lang.String proj_id, java.util.Calendar proj_time) throws java.rmi.RemoteException {
        try {
            java.sql.Date date;

            // Make the sql query
            if (proj_time != null) {
                date = new java.sql.Date(proj_time.getTime().getTime());
            } else {
                date = null;
            }

            _sqlReq.setProjectOpendate(Integer.parseInt(proj_id), date);

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

    /**

⌨️ 快捷键说明

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