001/* 002 * Copyright 2014-2024 Ping Identity Corporation 003 * All Rights Reserved. 004 */ 005/* 006 * Copyright 2014-2024 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) 2014-2024 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.NotNull; 049import com.unboundid.util.ThreadSafety; 050import com.unboundid.util.ThreadSafetyLevel; 051import com.unboundid.util.Validator; 052 053 054 055/** 056 * This class represents a data structure with information about a notification 057 * subscription defined in a Ping Identity, UnboundID, or Nokia/Alcatel-Lucent 058 * 8661 server instance. 059 * <BR> 060 * <BLOCKQUOTE> 061 * <B>NOTE:</B> This class, and other classes within the 062 * {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only 063 * supported for use against Ping Identity, UnboundID, and 064 * Nokia/Alcatel-Lucent 8661 server products. These classes provide support 065 * for proprietary functionality or for external specifications that are not 066 * considered stable or mature enough to be guaranteed to work in an 067 * interoperable way with other types of LDAP servers. 068 * </BLOCKQUOTE> 069 */ 070@NotMutable() 071@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 072public final class NotificationSubscriptionDetails 073 implements Serializable 074{ 075 /** 076 * The serial version UID for this serializable class. 077 */ 078 private static final long serialVersionUID = 7883889980556267057L; 079 080 081 082 // The encoded details for this notification subscription. 083 @NotNull private final List<ASN1OctetString> details; 084 085 // The unique ID for this notification subscription. 086 @NotNull private final String id; 087 088 089 090 /** 091 * Creates a new notification subscription details object with the provided 092 * information. 093 * 094 * @param id The unique ID for this notification subscription. It 095 * must not be {@code null}. 096 * @param details The encoded details for this notification subscription. 097 * It must not be {@code null} or empty. 098 */ 099 public NotificationSubscriptionDetails(@NotNull final String id, 100 @NotNull final Collection<ASN1OctetString> details) 101 { 102 Validator.ensureNotNull(id); 103 Validator.ensureNotNull(details); 104 Validator.ensureFalse(details.isEmpty()); 105 106 this.id = id; 107 this.details = 108 Collections.unmodifiableList(new ArrayList<>(details)); 109 } 110 111 112 113 /** 114 * Retrieves the unique ID for this subscription details object. 115 * 116 * @return The unique ID for this subscription details object. 117 */ 118 @NotNull() 119 public String getID() 120 { 121 return id; 122 } 123 124 125 126 /** 127 * Retrieves the encoded details for this subscription details object. 128 * 129 * @return The encoded details for this subscription details object. 130 */ 131 @NotNull() 132 public List<ASN1OctetString> getDetails() 133 { 134 return details; 135 } 136 137 138 139 /** 140 * Retrieves a string representation of this notification subscription details 141 * object. 142 * 143 * @return A string representation of this notification subscription details 144 * object. 145 */ 146 @Override() 147 @NotNull() 148 public String toString() 149 { 150 final StringBuilder buffer = new StringBuilder(); 151 toString(buffer); 152 return buffer.toString(); 153 } 154 155 156 157 /** 158 * Appends a string representation of this notification subscription details 159 * object to the provided buffer. 160 * 161 * @param buffer The buffer to which the information should be appended. 162 */ 163 public void toString(@NotNull final StringBuilder buffer) 164 { 165 buffer.append("NotificationSubscription(id='"); 166 buffer.append(id); 167 buffer.append("')"); 168 } 169}