Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Mathieu GICQUEL
GTD Server
Commits
6a67202a
Commit
6a67202a
authored
Mar 31, 2021
by
Mathieu Gicquel
Browse files
Implements methods archive putInTrash restore - Fix
#22
parent
4a7d04de
Changes
1
Hide whitespace changes
Inline
Side-by-side
gtd-server-core/src/main/java/fr/alma/gtd/server/core/AbstractTask.java
View file @
6a67202a
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment