Commit 6a67202a authored by Mathieu Gicquel's avatar Mathieu Gicquel
Browse files

Implements methods archive putInTrash restore - Fix #22

parent 4a7d04de
......@@ -167,18 +167,29 @@ public abstract class AbstractTask extends AbstractServerObject implements ITask
}
@Override
public final void archive() {
//TODO
public final void archive() throws IllegalStateException {
if(this.isTrash) throw new IllegalStateException("cannot archive an trashed task");
if(this.isArchived) throw new IllegalStateException("cannot archive an archived task");
this.setArchived(true);
}
@Override
public final void putInTrash() {
//TODO
public final void putInTrash() throws IllegalStateException {
if(this.getProjectContainer()==null) throw new IllegalStateException("cannot trash a not project related task");
if(this.isTrash()) throw new IllegalStateException("cannot trash a trashed task");
this.setTrash(true);
this.getProjectContainer().deleteTask(this);
}
@Override
public final void restore() {
//TODO
public final void restore() throws IllegalStateException {
if(this.getProjectContainer()==null) throw new IllegalStateException("cannot restore a not project related task");
if(!this.isTrash()) throw new IllegalStateException("cannot restore a not trashed task");
this.setTrash(false);
this.getProjectContainer().addTask(this);
}
@Override
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment