Last change
on this file since 733 was
733,
checked in by sherbold, 12 years ago
|
- refactored command packages in quest-ui-core
|
-
Property svn:mime-type set to
text/plain
|
File size:
1.1 KB
|
Rev | Line | |
---|
[733] | 1 | package de.ugoe.cs.quest.commands.misc;
|
---|
[189] | 2 |
|
---|
| 3 | import java.security.InvalidParameterException;
|
---|
| 4 | import java.util.List;
|
---|
| 5 |
|
---|
[432] | 6 | import de.ugoe.cs.quest.CommandHelpers;
|
---|
[189] | 7 | import de.ugoe.cs.util.console.Command;
|
---|
[667] | 8 | import de.ugoe.cs.util.console.GlobalDataContainer;
|
---|
[189] | 9 |
|
---|
| 10 | /**
|
---|
| 11 | * <p>
|
---|
[190] | 12 | * Command to delete object from {@link GlobalDataContainer}.
|
---|
[189] | 13 | * </p>
|
---|
| 14 | *
|
---|
| 15 | * @author Steffen Herbold
|
---|
| 16 | * @version 1.0
|
---|
| 17 | */
|
---|
| 18 | public class CMDdeleteObject implements Command {
|
---|
| 19 |
|
---|
[190] | 20 | /*
|
---|
| 21 | * (non-Javadoc)
|
---|
| 22 | *
|
---|
| 23 | * @see de.ugoe.cs.util.console.Command#help()
|
---|
| 24 | */
|
---|
[189] | 25 | @Override
|
---|
[664] | 26 | public String help() {
|
---|
| 27 | return "deleteObject <objectname>";
|
---|
[189] | 28 | }
|
---|
| 29 |
|
---|
[190] | 30 | /*
|
---|
| 31 | * (non-Javadoc)
|
---|
| 32 | *
|
---|
| 33 | * @see de.ugoe.cs.util.console.Command#run(java.util.List)
|
---|
| 34 | */
|
---|
[189] | 35 | @Override
|
---|
| 36 | public void run(List<Object> parameters) {
|
---|
| 37 | String objectName;
|
---|
| 38 | try {
|
---|
| 39 | objectName = (String) parameters.get(0);
|
---|
| 40 | } catch (Exception e) {
|
---|
| 41 | throw new InvalidParameterException();
|
---|
| 42 | }
|
---|
[190] | 43 | boolean deleted = GlobalDataContainer.getInstance().removeData(
|
---|
| 44 | objectName);
|
---|
| 45 | if (!deleted) {
|
---|
[240] | 46 | CommandHelpers.objectNotFoundMessage(objectName);
|
---|
[189] | 47 | }
|
---|
| 48 | }
|
---|
| 49 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.