001/* 002 * Copyright 2014-2020 Ping Identity Corporation 003 * All Rights Reserved. 004 */ 005/* 006 * Copyright 2014-2020 Ping Identity Corporation 007 * 008 * Licensed under the Apache License, Version 2.0 (the "License"); 009 * you may not use this file except in compliance with the License. 010 * You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, software 015 * distributed under the License is distributed on an "AS IS" BASIS, 016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 017 * See the License for the specific language governing permissions and 018 * limitations under the License. 019 */ 020/* 021 * Copyright (C) 2015-2020 Ping Identity Corporation 022 * 023 * This program is free software; you can redistribute it and/or modify 024 * it under the terms of the GNU General Public License (GPLv2 only) 025 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only) 026 * as published by the Free Software Foundation. 027 * 028 * This program is distributed in the hope that it will be useful, 029 * but WITHOUT ANY WARRANTY; without even the implied warranty of 030 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 031 * GNU General Public License for more details. 032 * 033 * You should have received a copy of the GNU General Public License 034 * along with this program; if not, see <http://www.gnu.org/licenses>. 035 */ 036package com.unboundid.ldap.sdk.unboundidds.extensions; 037 038 039 040import java.io.Serializable; 041import java.util.ArrayList; 042import java.util.Collection; 043import java.util.Collections; 044import java.util.List; 045 046import com.unboundid.asn1.ASN1OctetString; 047import com.unboundid.util.NotMutable; 048import com.unboundid.util.ThreadSafety; 049import com.unboundid.util.ThreadSafetyLevel; 050import com.unboundid.util.Validator; 051 052 053 054/** 055 * This class represents a data structure with information about a notification 056 * subscription defined in a Ping Identity, UnboundID, or Nokia/Alcatel-Lucent 057 * 8661 server instance. 058 * <BR> 059 * <BLOCKQUOTE> 060 * <B>NOTE:</B> This class, and other classes within the 061 * {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only 062 * supported for use against Ping Identity, UnboundID, and 063 * Nokia/Alcatel-Lucent 8661 server products. These classes provide support 064 * for proprietary functionality or for external specifications that are not 065 * considered stable or mature enough to be guaranteed to work in an 066 * interoperable way with other types of LDAP servers. 067 * </BLOCKQUOTE> 068 */ 069@NotMutable() 070@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 071public final class NotificationSubscriptionDetails 072 implements Serializable 073{ 074 /** 075 * The serial version UID for this serializable class. 076 */ 077 private static final long serialVersionUID = 7883889980556267057L; 078 079 080 081 // The encoded details for this notification subscription. 082 private final List<ASN1OctetString> details; 083 084 // The unique ID for this notification subscription. 085 private final String id; 086 087 088 089 /** 090 * Creates a new notification subscription details object with the provided 091 * information. 092 * 093 * @param id The unique ID for this notification subscription. It 094 * must not be {@code null}. 095 * @param details The encoded details for this notification subscription. 096 * It must not be {@code null} or empty. 097 */ 098 public NotificationSubscriptionDetails(final String id, 099 final Collection<ASN1OctetString> details) 100 { 101 Validator.ensureNotNull(id); 102 Validator.ensureNotNull(details); 103 Validator.ensureFalse(details.isEmpty()); 104 105 this.id = id; 106 this.details = 107 Collections.unmodifiableList(new ArrayList<>(details)); 108 } 109 110 111 112 /** 113 * Retrieves the unique ID for this subscription details object. 114 * 115 * @return The unique ID for this subscription details object. 116 */ 117 public String getID() 118 { 119 return id; 120 } 121 122 123 124 /** 125 * Retrieves the encoded details for this subscription details object. 126 * 127 * @return The encoded details for this subscription details object. 128 */ 129 public List<ASN1OctetString> getDetails() 130 { 131 return details; 132 } 133 134 135 136 /** 137 * Retrieves a string representation of this notification subscription details 138 * object. 139 * 140 * @return A string representation of this notification subscription details 141 * object. 142 */ 143 @Override() 144 public String toString() 145 { 146 final StringBuilder buffer = new StringBuilder(); 147 toString(buffer); 148 return buffer.toString(); 149 } 150 151 152 153 /** 154 * Appends a string representation of this notification subscription details 155 * object to the provided buffer. 156 * 157 * @param buffer The buffer to which the information should be appended. 158 */ 159 public void toString(final StringBuilder buffer) 160 { 161 buffer.append("NotificationSubscription(id='"); 162 buffer.append(id); 163 buffer.append("')"); 164 } 165}