001 /*
002 * Copyright 2009-2014 UnboundID Corp.
003 * All Rights Reserved.
004 */
005 /*
006 * Copyright (C) 2009-2014 UnboundID Corp.
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 */
021 package com.unboundid.ldap.sdk.persist;
022
023
024
025 import java.lang.annotation.ElementType;
026 import java.lang.annotation.Documented;
027 import java.lang.annotation.Retention;
028 import java.lang.annotation.RetentionPolicy;
029 import 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})
044 public @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 boolean requestAllAttributes() default false;
056
057
058
059 /**
060 * The DN of the entry below which objects of this type will be created if no
061 * alternate parent DN is specified. A value equal to the empty string
062 * indicates that there should be no default parent.
063 */
064 String defaultParentDN() default "";
065
066
067
068 /**
069 * The name of a method that should be invoked on an object after all other
070 * decode processing has been performed for that object. It may perform any
071 * additional work or validation that is not available as part of the LDAP SDK
072 * persistence framework. If a method name is provided, then that method must
073 * exist in the associated class and it must not take any arguments. It may
074 * throw any kind of exception if the object is not valid.
075 */
076 String postDecodeMethod() default "";
077
078
079
080 /**
081 * The name of a method that should be invoked after an object has been
082 * encoded to an LDAP entry. It may alter the generated entry in any way,
083 * including adding, removing, or replacing attributes, or altering the entry
084 * DN. If a method name is provided, then that method must exist in the
085 * associated class and it must take exactly one argument, with a type of
086 * {@link com.unboundid.ldap.sdk.Entry}. It may throw any kind of exception
087 * if a problem is found with the entry and it should not be used.
088 */
089 String postEncodeMethod() default "";
090
091
092
093 /**
094 * The name of the structural object class for LDAP entries created from the
095 * associated object type. If no value is provided, then it will be assumed
096 * that the object class name is equal to the unqualified name of the Java
097 * class.
098 */
099 String structuralClass() default "";
100
101
102
103 /**
104 * The name(s) of any auxiliary object class(es) for LDAP entries created from
105 * the associated object type.
106 */
107 String[] auxiliaryClass() default {};
108
109
110
111 /**
112 * The name(s) of any superior object class(es) for the structural and/or
113 * auxiliary object classes that should be included in generated entries.
114 */
115 String[] superiorClass() default {};
116 }