• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License");
3  * you may not use this file except in compliance with the License.
4  * You may obtain a copy of the License at
5  *
6  *     http://www.apache.org/licenses/LICENSE-2.0
7  *
8  * Unless required by applicable law or agreed to in writing, software
9  * distributed under the License is distributed on an "AS IS" BASIS,
10  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11  * See the License for the specific language governing permissions and
12  * limitations under the License.
13  */
14 package org.jivesoftware.smackx.pubsub;
15 
16 import org.jivesoftware.smack.packet.PacketExtension;
17 import org.jivesoftware.smackx.pubsub.packet.PubSubNamespace;
18 
19 /**
20  * Represents and item that has been deleted from a node.
21  *
22  * @author Robin Collier
23  */
24 public class RetractItem implements PacketExtension
25 {
26 	private String id;
27 
28 	/**
29 	 * Construct a <tt>RetractItem</tt> with the specified id.
30 	 *
31 	 * @param itemId The id if the item deleted
32 	 */
RetractItem(String itemId)33 	public RetractItem(String itemId)
34 	{
35 		if (itemId == null)
36 			throw new IllegalArgumentException("itemId must not be 'null'");
37 		id = itemId;
38 	}
39 
getId()40 	public String getId()
41 	{
42 		return id;
43 	}
44 
getElementName()45 	public String getElementName()
46 	{
47 		return "retract";
48 	}
49 
getNamespace()50 	public String getNamespace()
51 	{
52 		return PubSubNamespace.EVENT.getXmlns();
53 	}
54 
toXML()55 	public String toXML()
56 	{
57 		return "<retract id='" + id + "'/>";
58 	}
59 }
60