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