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

📄 add.java

📁 分布式议程管理系统
💻 JAVA
字号:
/**
 * 
 */
package sysu.agenda.command;

import java.io.IOException;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.text.ParseException;

import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;

import org.xml.sax.SAXException;

import sysu.agenda.ctrl.InputHelper;
import sysu.agenda.ctrl.Service;
import sysu.agenda.ctrl.XMLHelper;
import sysu.agenda.exception.ParameterException;
import sysu.agenda.model.Meeting;

/**
 * @author Administrator
 * 
 */
public class Add extends UnicastRemoteObject implements ICommand {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7925550873846433487L;

	/**
	 * 
	 */
	public Add() throws RemoteException {
		// TODO Auto-generated constructor stub
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

	@Override
	public String excute(String[] args) throws ParameterException,
			ParserConfigurationException, SAXException, IOException,
			ParseException, SecurityException, TransformerException {
		// TODO Auto-generated method stub
		XMLHelper.getInstance().read();
		if (args.length == 6) {
			if (!Service.getInstance().login(args[0], args[1])
					&& !Service.getInstance().isContainedUser(args[2]))
				throw new ParameterException("User do not exist.");
			if (!Service.getInstance().addMeeting(
					new Meeting(args[0], args[2], args[5], InputHelper
							.getInstance().StingToDate(args[3]), InputHelper
							.getInstance().StingToDate(args[4]))))
				throw new ParameterException("Add meeting error.");
			System.out.println("Add Meeting:\n"
					+ Service.getInstance().vecMeeting.get(
							Service.getInstance().vecMeeting.size() - 1)
							.toString());
			String res = new String("Add Meeting:\n"
					+ Service.getInstance().vecMeeting.get(
							Service.getInstance().vecMeeting.size() - 1)
							.toString());
			XMLHelper.getInstance().write(Service.getInstance().getPath());
			return res;
		} else
			throw new ParameterException("Command invalid.");
	}

}

⌨️ 快捷键说明

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