|Use the ForumsTrashService commands to restore deleted forum content from the trash with immediate effect. You do not need to check the Forums configuration file out or restart the server when using these commands.
Before you begin
To use administrative commands, you must use the wsadmin client. See Starting the wsadmin client
About this task
If you change your mind about deleting content from the Forums application, you can restore forum content from the trash. After a forum or forum topic is deleted, the deleted content can be preserved if it is restored.
To restore forum content that has been deleted, complete the following steps.
Optional: Identify the forums or forum topics that you want to restore from the returned list. Use the following command to filter the forums by name:
- Start the wsadmin client from the following directory of the system on which you installed the Deployment Manager:
is the WebSphere
® Application Server installation directory and dm_profile_root
is the Deployment Manager profile directory, typically dmgr01.
You must start the client from this directory or subsequent commands that you enter do not execute correctly. For more information, see Starting the wsadmin client
- Start the Forums Jython script interpreter using the following command:
If prompted to specify a service to connect to, type 1 to pick the first node in the list. Most commands can run on any node. If the command writes or reads information to or from a file using a local file path, you must pick the node where the file is stored.
- Do one of the following.
ForumsTrashService.filterForumsByName(VectorinputVector, java.lang.String toMatch)
To restore deleted content, use the following commands.
Filters a source vector of forums to return a new vector containing a map pair that matches the specified name filter criteria.
This command take the following parameters:
The source vector that contains the map collection.toMatch
Java regular expression pattern representing match criteria. This pattern is used to search the name of the forums. The pattern must match the full name and is case sensitive. You can use the following keys:
- Period (.) matches any character.
- Plus sign (+) matches one or more instances of the previous character. For example, .+ matches all sequences of one or more characters.
- Asterisk (*) matches zero or more instances of the previous character. For example, * matches all sequences of characters.
- [chars] matches any one character within the square brackets (). For example, [Gg] matches either an upper or lower case G.
- [A-Z] matches a range of characters.
Restores a deleted forum or forums, where you specify the forum or forums that you want to restore using the hashtable
Restores a deleted forum topic or topics, where you specify the topic or topics that you want to restore using the hashtable
To identify the forums that you want to restore from the trash, first generate a variable containing a list of forums, and then filter that list by forum name to narrow down the list of forums that you want to restore as follows:
Parent topic: Managing forum trash
Starting the wsadmin client
Moving forums to the trash
Deleting topics from forums
Filtering lists of forums
- Create a variable that contains a list of forums in the trash. You can get a list of forums in hash table format using one of the fetchForums commands, ForumsTrashService.fetchForumsTrash() or ForumsTrashService.fetchForumsTrashByDate(String modifySince).
april4Trash = ForumsTrashService.fetchForumsTrashByDate("2011.04.11")
- Filter the list of forums returned by the previous command to find the forum or forums that you want to restore.
For example, to find a forum with the name Forum1:
myForums = ForumsTrashService.filterForumsByName(april4Trash,"Forum1")
Alternatively, you can filter the list of forums to find forums that have a name that begins with "Forum" and then store them in the myForums variable:
myForums = ForumsTrashService.filterForumsByName(april4Trash,"Forum.*")
- Restore the forum or forums from the trash by passing the variable containing the subset of forums returned in the previous step to the undeleteForumsTrash command.