001/* 002 * Copyright 2014-2019 Ping Identity Corporation 003 * All Rights Reserved. 004 */ 005/* 006 * Copyright (C) 2015-2019 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 com.unboundid.asn1.ASN1Element; 026import com.unboundid.asn1.ASN1OctetString; 027import com.unboundid.ldap.sdk.LDAPException; 028import com.unboundid.ldap.sdk.ResultCode; 029import com.unboundid.util.Debug; 030import com.unboundid.util.NotMutable; 031import com.unboundid.util.StaticUtils; 032import com.unboundid.util.ThreadSafety; 033import com.unboundid.util.ThreadSafetyLevel; 034import com.unboundid.util.Validator; 035 036import static com.unboundid.ldap.sdk.unboundidds.extensions.ExtOpMessages.*; 037 038 039 040/** 041 * This class provides an implementation of a get changelog batch change 042 * selection criteria value that indicates that the server should only return 043 * changes that are associated with a specified notification destination, as 044 * specified by the entryUUID for the notification destination to target. 045 * <BR> 046 * <BLOCKQUOTE> 047 * <B>NOTE:</B> This class, and other classes within the 048 * {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only 049 * supported for use against Ping Identity, UnboundID, and 050 * Nokia/Alcatel-Lucent 8661 server products. These classes provide support 051 * for proprietary functionality or for external specifications that are not 052 * considered stable or mature enough to be guaranteed to work in an 053 * interoperable way with other types of LDAP servers. 054 * </BLOCKQUOTE> 055 */ 056@NotMutable() 057@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 058public final class NotificationDestinationChangeSelectionCriteria 059 extends ChangelogBatchChangeSelectionCriteria 060{ 061 /** 062 * The inner BER type that should be used for encoded elements that represent 063 * a notification destination get changelog batch selection criteria value. 064 */ 065 static final byte TYPE_SELECTION_CRITERIA_NOTIFICATION_DESTINATION = 066 (byte) 0x84; 067 068 069 070 // The entryUUID for the for the notification destination to target. 071 private final String destinationEntryUUID; 072 073 074 075 /** 076 * Creates a new notification destination change selection criteria value with 077 * the specified destination entryUUID. 078 * 079 * @param destinationEntryUUID The entryUUID for the notification 080 * destination to target. It must not be 081 * {@code null}. 082 */ 083 public NotificationDestinationChangeSelectionCriteria( 084 final String destinationEntryUUID) 085 { 086 Validator.ensureNotNull(destinationEntryUUID); 087 088 this.destinationEntryUUID = destinationEntryUUID; 089 } 090 091 092 093 /** 094 * Decodes the provided ASN.1 element, which is the inner element of a 095 * changelog batch change selection criteria element, as an all attributes 096 * change selection criteria value. 097 * 098 * @param innerElement The inner element of a changelog batch change 099 * selection criteria element to be decoded. 100 * 101 * @return The decoded all attributes change selection criteria value. 102 * 103 * @throws LDAPException If a problem is encountered while trying to decode 104 * the provided element as the inner element of an all 105 * attributes change selection criteria value. 106 */ 107 static NotificationDestinationChangeSelectionCriteria decodeInnerElement( 108 final ASN1Element innerElement) 109 throws LDAPException 110 { 111 try 112 { 113 return new NotificationDestinationChangeSelectionCriteria( 114 ASN1OctetString.decodeAsOctetString(innerElement).stringValue()); 115 } 116 catch (final Exception e) 117 { 118 Debug.debugException(e); 119 throw new LDAPException(ResultCode.DECODING_ERROR, 120 ERR_NOT_DEST_CHANGE_SELECTION_CRITERIA_DECODE_ERROR.get( 121 StaticUtils.getExceptionMessage(e)), 122 e); 123 } 124 } 125 126 127 128 /** 129 * Retrieves the entryUUID for the target notification destination. 130 * 131 * @return The entryUUID for the target notification destination. 132 */ 133 public String getDestinationEntryUUID() 134 { 135 return destinationEntryUUID; 136 } 137 138 139 140 /** 141 * {@inheritDoc} 142 */ 143 @Override() 144 public ASN1Element encodeInnerElement() 145 { 146 return new ASN1OctetString(TYPE_SELECTION_CRITERIA_NOTIFICATION_DESTINATION, 147 destinationEntryUUID); 148 } 149 150 151 152 /** 153 * {@inheritDoc} 154 */ 155 @Override() 156 public void toString(final StringBuilder buffer) 157 { 158 buffer.append("NotificationDestinationChangeSelectionCriteria(" + 159 "destinationEntryUUID='"); 160 buffer.append(destinationEntryUUID); 161 buffer.append("')"); 162 } 163}