001/* 002 * Copyright 2009-2018 Ping Identity Corporation 003 * All Rights Reserved. 004 */ 005/* 006 * Copyright (C) 2009-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.persist; 022 023 024 025import java.lang.annotation.ElementType; 026import java.lang.annotation.Documented; 027import java.lang.annotation.Retention; 028import java.lang.annotation.RetentionPolicy; 029import java.lang.annotation.Target; 030 031 032 033/** 034 * This annotation type may be used to mark classes for objects that may be 035 * persisted in an LDAP directory server. It may only be used to mark classes, 036 * and should not be used for interfaces or annotation types. Classes with this 037 * annotation type must provide a default zero-argument constructor. Fields in 038 * the associated class which are to be persisted should be marked with the 039 * {@link LDAPField} annotation type. 040 */ 041@Documented() 042@Retention(RetentionPolicy.RUNTIME) 043@Target(value={ElementType.TYPE}) 044public @interface LDAPObject 045{ 046 /** 047 * Indicates whether to request all attributes when performing searches to 048 * retrieve objects of this type. If this is {@code true}, then the search 049 * request will attempt to retrieve all user and operational attributes. If 050 * this is {@code false}, then the search request will attempt to retrieve 051 * only those attributes which are referenced by an {@link LDAPField} or 052 * {@link LDAPSetter} annotation. Note that if this is given a value of 053 * {@code true}, then lazy loading will be disabled. 054 * 055 * @return {@code true} if all attributes should be requested, or 056 * {@code false} if only referenced attributes should be requested. 057 */ 058 boolean requestAllAttributes() default false; 059 060 061 062 /** 063 * The DN of the entry below which objects of this type will be created if no 064 * alternate parent DN is specified. A value equal to the empty string 065 * indicates that there should be no default parent DN. 066 * <BR><BR> 067 * If a class marked with the {@code LDAPObject} annotation type does not 068 * specify a default parent DN but is a direct subclass of another class 069 * marked with {@code LDAPObject}, then the subclass will inherit the default 070 * parent DN from the superclass. 071 * 072 * @return The DN of the entry below which objects of this type will be 073 * created if no alternate parent DN is specified, or the empty 074 * string if there should be no default parent DN. 075 */ 076 String defaultParentDN() default ""; 077 078 079 080 /** 081 * The name of a method that should be invoked on an object after all other 082 * decode processing has been performed for that object. It may perform any 083 * additional work or validation that is not available as part of the LDAP SDK 084 * persistence framework. If a method name is provided, then that method must 085 * exist in the associated class and it must not take any arguments. It may 086 * throw any kind of exception if the object is not valid. 087 * 088 * @return The name of a method that should be invoked on an object after all 089 * other decode processing has been performed for that object, or an 090 * empty string if no post-decode method has been defined. 091 */ 092 String postDecodeMethod() default ""; 093 094 095 096 /** 097 * The name of a method that should be invoked after an object has been 098 * encoded to an LDAP entry. It may alter the generated entry in any way, 099 * including adding, removing, or replacing attributes, or altering the entry 100 * DN. If a method name is provided, then that method must exist in the 101 * associated class and it must take exactly one argument, with a type of 102 * {@link com.unboundid.ldap.sdk.Entry}. It may throw any kind of exception 103 * if a problem is found with the entry and it should not be used. 104 * 105 * @return The name of a method that should be invoked after an object has 106 * been encoded to an LDAP entry, or an empty string if no 107 * post-encode method has been defined. 108 */ 109 String postEncodeMethod() default ""; 110 111 112 113 /** 114 * The name of the structural object class for LDAP entries created from the 115 * associated object type. If no value is provided, then it will be assumed 116 * that the object class name is equal to the unqualified name of the Java 117 * class. 118 * 119 * @return The name of the structural object class for LDAP entries created 120 * from the associated object type, or an empty string if the object 121 * class name will be assumed to be equal to the unqualified name of 122 * the Java class. 123 */ 124 String structuralClass() default ""; 125 126 127 128 /** 129 * The name) of any auxiliary object classes for LDAP entries created from the 130 * associated object type. 131 * 132 * @return The names of any auxiliary object classes for LDAP entries created 133 * from the associated object type, or an empty array if entries 134 * should not include any auxiliary object classes. 135 */ 136 String[] auxiliaryClass() default {}; 137 138 139 140 /** 141 * The names of any superior object classes for the structural and auxiliary 142 * object classes that should be included in generated entries. 143 * 144 * @return The names of any superior object classes for the structural and 145 * auxiliary object classes that should be included in generated 146 * entries, or an empty array if no superior classes should be 147 * included. 148 */ 149 String[] superiorClass() default {}; 150}