-
Notifications
You must be signed in to change notification settings - Fork 0
/
CmdTakeProject.java
29 lines (25 loc) · 968 Bytes
/
CmdTakeProject.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
public class CmdTakeProject extends RecordedCommand{
private Company company;
private Team team;
private Project project;
private Day startDay;
public void execute(String[] cmdParts) throws ExInsufficientArguments, ExTeamNotExist, ExProjectNotExist, ExProjectDateStartEarlist, ExProjectAlready, ExProjectNotAvailable, ExInvaildDate{
if(cmdParts.length != 4)
throw new ExInsufficientArguments();
company = Company.getInstance();
startDay = new Day(cmdParts[3]);
Day.compareProjectStartDate(SystemDate.getInstance(), startDay);
project = company.takeProject(cmdParts[1], cmdParts[2], startDay);
pushUndo(this);
System.out.println("Done.");
}
public void undo(){
team = project.getTeam();
project.setTeam(null);
project.setStartDay(null);
}
public void redo(){
project.setTeam(team);
project.setStartDay(startDay);
}
}