📄 clear.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.Service;
import sysu.agenda.ctrl.XMLHelper;
import sysu.agenda.exception.ParameterException;
import sysu.agenda.model.Meeting;
/**
* @author Administrator
*
*/
public class Clear extends UnicastRemoteObject implements ICommand {
/**
*
*/
private static final long serialVersionUID = 5779964624993263808L;
/**
*
*/
public Clear() 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 == 2) {
if (!Service.getInstance().login(args[0], args[1]))
throw new ParameterException("User do not exist.");
for (Meeting mt : Service.getInstance().getMeetingByUserName(
args[0]))
if (Service.getInstance().vecMeeting.remove(mt))
System.out.println("\nMeeting remove:\n" + mt.toString());
XMLHelper.getInstance().write(Service.getInstance().getPath());
return "\nMeeting remove\n";
} else
throw new ParameterException("Command invalid.");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -