1 /** 2 * $RCSfile$ 3 * $Revision$ 4 * $Date$ 5 * 6 * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 package org.jivesoftware.smack; 19 20 import org.jivesoftware.smack.packet.PrivacyItem; 21 22 import java.util.List; 23 24 /** 25 * A privacy list represents a list of contacts that is a read only class used to represent a set of allowed or blocked communications. 26 * Basically it can:<ul> 27 * 28 * <li>Handle many {@link org.jivesoftware.smack.packet.PrivacyItem}.</li> 29 * <li>Answer if it is the default list.</li> 30 * <li>Answer if it is the active list.</li> 31 * </ul> 32 * 33 * {@link PrivacyItem Privacy Items} can handle different kind of blocking communications based on JID, group, 34 * subscription type or globally. 35 * 36 * @author Francisco Vives 37 */ 38 public class PrivacyList { 39 40 /** Holds if it is an active list or not **/ 41 private boolean isActiveList; 42 /** Holds if it is an default list or not **/ 43 private boolean isDefaultList; 44 /** Holds the list name used to print **/ 45 private String listName; 46 /** Holds the list of {@see PrivacyItem} **/ 47 private List<PrivacyItem> items; 48 49 protected PrivacyList(boolean isActiveList, boolean isDefaultList, 50 String listName, List<PrivacyItem> privacyItems) { 51 super(); 52 this.isActiveList = isActiveList; 53 this.isDefaultList = isDefaultList; 54 this.listName = listName; 55 this.items = privacyItems; 56 } 57 58 public boolean isActiveList() { 59 return isActiveList; 60 } 61 62 public boolean isDefaultList() { 63 return isDefaultList; 64 } 65 66 public List<PrivacyItem> getItems() { 67 return items; 68 } 69 70 public String toString() { 71 return listName; 72 } 73 74 } 75