001/** 002 * 003 * Copyright the original author or authors 004 * 005 * Licensed under the Apache License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.jivesoftware.smackx.pubsub; 018 019import java.util.Collections; 020import java.util.List; 021 022/** 023 * Represents an event in which items have been deleted from the node. 024 * 025 * @author Robin Collier 026 */ 027public class ItemDeleteEvent extends SubscriptionEvent 028{ 029 private List<String> itemIds = Collections.emptyList(); 030 031 /** 032 * Constructs an <tt>ItemDeleteEvent</tt> that indicates the the supplied 033 * items (by id) have been deleted, and that the event matches the listed 034 * subscriptions. The subscriptions would have been created by calling 035 * {@link LeafNode#subscribe(String)}. 036 * 037 * @param nodeId The id of the node the event came from 038 * @param deletedItemIds The item ids of the items that were deleted. 039 * @param subscriptionIds The subscriptions that match the event. 040 */ 041 public ItemDeleteEvent(String nodeId, List<String> deletedItemIds, List<String> subscriptionIds) 042 { 043 super(nodeId, subscriptionIds); 044 045 if (deletedItemIds == null) 046 throw new IllegalArgumentException("deletedItemIds cannot be null"); 047 itemIds = deletedItemIds; 048 } 049 050 /** 051 * Get the item id's of the items that have been deleted. 052 * 053 * @return List of item id's 054 */ 055 public List<String> getItemIds() 056 { 057 return Collections.unmodifiableList(itemIds); 058 } 059 060 @Override 061 public String toString() 062 { 063 return getClass().getName() + " [subscriptions: " + getSubscriptions() + "], [Deleted Items: " + itemIds + ']'; 064 } 065}