Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* Copyright (C) 2006 Robin Bygrave
*
* This file is part of Ebean.
*
* Ebean is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* Ebean is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Ebean; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
package com.avaje.ebeaninternal.server.deploy;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.InvalidNameException;
import javax.naming.directory.Attributes;
import javax.naming.directory.BasicAttribute;
import javax.naming.directory.BasicAttributes;
import javax.naming.ldap.LdapName;
import javax.persistence.PersistenceException;
import com.avaje.ebean.InvalidValue;
import com.avaje.ebean.Query;
import com.avaje.ebean.SqlUpdate;
import com.avaje.ebean.Transaction;
import com.avaje.ebean.Query.UseIndex;
import com.avaje.ebean.bean.BeanCollection;
import com.avaje.ebean.bean.EntityBean;
import com.avaje.ebean.bean.EntityBeanIntercept;
import com.avaje.ebean.cache.ServerCache;
import com.avaje.ebean.cache.ServerCacheManager;
import com.avaje.ebean.config.EncryptKey;
import com.avaje.ebean.config.dbplatform.IdGenerator;
import com.avaje.ebean.config.dbplatform.IdType;
import com.avaje.ebean.config.lucene.IndexDefn;
import com.avaje.ebean.event.BeanFinder;
import com.avaje.ebean.event.BeanPersistController;
import com.avaje.ebean.event.BeanPersistListener;
import com.avaje.ebean.event.BeanQueryAdapter;
import com.avaje.ebean.text.TextException;
import com.avaje.ebean.text.json.JsonWriteBeanVisitor;
import com.avaje.ebean.validation.factory.Validator;
import com.avaje.ebeaninternal.api.SpiEbeanServer;
import com.avaje.ebeaninternal.api.SpiQuery;
import com.avaje.ebeaninternal.api.SpiUpdatePlan;
import com.avaje.ebeaninternal.api.TransactionEvent;
import com.avaje.ebeaninternal.api.TransactionEventTable.TableIUD;
import com.avaje.ebeaninternal.server.core.ConcurrencyMode;
import com.avaje.ebeaninternal.server.core.DefaultSqlUpdate;
import com.avaje.ebeaninternal.server.core.InternString;
import com.avaje.ebeaninternal.server.core.ReferenceOptions;
import com.avaje.ebeaninternal.server.deploy.id.IdBinder;
import com.avaje.ebeaninternal.server.deploy.meta.DeployBeanDescriptor;
import com.avaje.ebeaninternal.server.deploy.meta.DeployBeanPropertyLists;
import com.avaje.ebeaninternal.server.el.ElComparator;
import com.avaje.ebeaninternal.server.el.ElComparatorCompound;
import com.avaje.ebeaninternal.server.el.ElComparatorProperty;
import com.avaje.ebeaninternal.server.el.ElPropertyChainBuilder;
import com.avaje.ebeaninternal.server.el.ElPropertyDeploy;
import com.avaje.ebeaninternal.server.el.ElPropertyValue;
import com.avaje.ebeaninternal.server.ldap.LdapPersistenceException;
import com.avaje.ebeaninternal.server.lucene.LIndex;
import com.avaje.ebeaninternal.server.persist.DmlUtil;
import com.avaje.ebeaninternal.server.query.CQueryPlan;
import com.avaje.ebeaninternal.server.query.SplitName;
import com.avaje.ebeaninternal.server.querydefn.OrmQueryDetail;
import com.avaje.ebeaninternal.server.reflect.BeanReflect;
import com.avaje.ebeaninternal.server.text.json.ReadJsonContext;
import com.avaje.ebeaninternal.server.text.json.WriteJsonContext;
import com.avaje.ebeaninternal.server.text.json.ReadJsonContext.ReadBeanState;
import com.avaje.ebeaninternal.server.text.json.WriteJsonContext.WriteBeanState;
import com.avaje.ebeaninternal.server.transaction.IndexInvalidate;
import com.avaje.ebeaninternal.server.type.DataBind;
import com.avaje.ebeaninternal.server.type.TypeManager;
import com.avaje.ebeaninternal.util.SortByClause;
import com.avaje.ebeaninternal.util.SortByClauseParser;
import com.avaje.ebeaninternal.util.SortByClause.Property;
/**
* Describes Beans including their deployment information.
*/
public class BeanDescriptor {
private static final Logger logger = Logger.getLogger(BeanDescriptor.class.getName());
private final ConcurrentHashMap updatePlanCache = new ConcurrentHashMap();
private final ConcurrentHashMap queryPlanCache = new ConcurrentHashMap();
private final ConcurrentHashMap elGetCache = new ConcurrentHashMap();
private final ConcurrentHashMap> comparatorCache = new ConcurrentHashMap>();
private final ConcurrentHashMap fkeyMap = new ConcurrentHashMap();
public enum EntityType {
ORM,
EMBEDDED,
SQL,
META,
LDAP,
XMLELEMENT
}
/**
* The EbeanServer name. Same as the plugin name.
*/
private final String serverName;
/**
* Set to true if this is a LDAP domain object.
*/
private final EntityType entityType;
/**
* Type of Identity generation strategy used.
*/
private final IdType idType;
private final IdGenerator idGenerator;
/**
* The database sequence name (optional).
*/
private final String sequenceName;
private final String ldapBaseDn;
private final String[] ldapObjectclasses;
/**
* SQL used to return last inserted id. Used for Identity columns where
* getGeneratedKeys is not supported.
*/
private final String selectLastInsertedId;
private final boolean autoFetchTunable;
private final String lazyFetchIncludes;
/**
* The concurrency mode for beans of this type.
*/
private final ConcurrencyMode concurrencyMode;
/**
* The tables this bean is dependent on.
*/
private final String[] dependantTables;
private final CompoundUniqueContraint[] compoundUniqueConstraints;
/**
* Extra deployment attributes.
*/
private final Map extraAttrMap;
/**
* The base database table.
*/
private final String baseTable;
/**
* Used to provide mechanism to new EntityBean instances. Generated code
* faster than reflection at this stage.
*/
private final BeanReflect beanReflect;
/**
* Map of BeanProperty Linked so as to preserve order.
*/
private final LinkedHashMap propMap;
private final LinkedHashMap propMapByDbColumn;
/**
* The type of bean this describes.
*/
private final Class beanType;
/**
* This is not sent to a remote client.
*/
private final BeanDescriptorMap owner;
/**
* The EntityBean type used to create new EntityBeans.
*/
private final Class> factoryType;
/**
* Intercept pre post on insert,update,delete and postLoad(). Server side
* only.
*/
private volatile BeanPersistController persistController;
/**
* Listens for post commit insert update and delete events.
*/
private volatile BeanPersistListener persistListener;
private volatile BeanQueryAdapter queryAdapter;
/**
* If set overrides the find implementation. Server side only.
*/
private final BeanFinder beanFinder;
private final IndexDefn> luceneIndexDefn;
/**
* The table joins for this bean.
*/
private final TableJoin[] derivedTableJoins;
/**
* Inheritance information. Server side only.
*/
private final InheritInfo inheritInfo;
/**
* Derived list of properties that make up the unique id.
*/
private final BeanProperty[] propertiesId;
/**
* Derived list of properties that are used for version concurrency
* checking.
*/
private final BeanProperty[] propertiesVersion;
/**
* Properties local to this type (not from a super type).
*/
private final BeanProperty[] propertiesLocal;
private final BeanPropertyAssocOne> unidirectional;
/**
* A hashcode of all the many property names. This is used to efficiently
* create sets of loaded property names (for partial objects).
*/
private final int namesOfManyPropsHash;
/**
* The set of names of the many properties.
*/
private final Set namesOfManyProps;
/**
* list of properties that are Lists/Sets/Maps (Derived).
*/
private final BeanPropertyAssocMany>[] propertiesMany;
private final BeanPropertyAssocMany>[] propertiesManySave;
private final BeanPropertyAssocMany>[] propertiesManyDelete;
private final BeanPropertyAssocMany>[] propertiesManyToMany;
/**
* list of properties that are associated beans and not embedded (Derived).
*/
private final BeanPropertyAssocOne>[] propertiesOne;
private final BeanPropertyAssocOne>[] propertiesOneImported;
private final BeanPropertyAssocOne>[] propertiesOneImportedSave;
private final BeanPropertyAssocOne>[] propertiesOneImportedDelete;
private final BeanPropertyAssocOne>[] propertiesOneExported;
private final BeanPropertyAssocOne>[] propertiesOneExportedSave;
private final BeanPropertyAssocOne>[] propertiesOneExportedDelete;
/**
* list of properties that are embedded beans.
*/
private final BeanPropertyAssocOne>[] propertiesEmbedded;
/**
* List of the scalar properties excluding id and secondary table
* properties.
*/
private final BeanProperty[] propertiesBaseScalar;
private final BeanPropertyCompound[] propertiesBaseCompound;
private final BeanProperty[] propertiesTransient;
/**
* All non transient properties excluding the id properties.
*/
final BeanProperty[] propertiesNonTransient;
/**
* Set to true if the bean has version properties or an embedded bean has
* version properties.
*/
private final BeanProperty propertyFirstVersion;
/**
* Set when the Id property is a single non-embedded property. Can make life
* simpler for this case.
*/
private final BeanProperty propertySingleId;
/**
* The bean class name or the table name for MapBeans.
*/
private final String fullName;
private final Map namedQueries;
private final Map namedUpdates;
/**
* Has local validation rules.
*/
private final boolean hasLocalValidation;
/**
* Has local or recursive validation rules.
*/
private final boolean hasCascadeValidation;
/**
* Properties with local validation rules.
*/
private final BeanProperty[] propertiesValidationLocal;
/**
* Properties with local or cascade validation rules.
*/
private final BeanProperty[] propertiesValidationCascade;
private final Validator[] beanValidators;
/**
* Flag used to determine if saves can be skipped.
*/
private boolean saveRecurseSkippable;
/**
* Flag used to determine if deletes can be skipped.
*/
private boolean deleteRecurseSkippable;
/**
* Make the TypeManager available for helping SqlSelect.
*/
private final TypeManager typeManager;
private final IdBinder idBinder;
private String idBinderInLHSSql;
private String idBinderIdSql;
private String deleteByIdSql;
private String deleteByIdInSql;
private final String name;
private final String baseTableAlias;
/**
* If true then only changed properties get updated.
*/
private final boolean updateChangesOnly;
private final ServerCacheManager cacheManager;
private final ReferenceOptions referenceOptions;
private final String defaultSelectClause;
private final Set defaultSelectClauseSet;
private final String[] defaultSelectDbArray;
private final String descriptorId;
private final UseIndex useIndex;
private SpiEbeanServer ebeanServer;
private ServerCache beanCache;
private ServerCache queryCache;
private LIndex luceneIndex;
private Set luceneIndexInvalidations;
/**
* Construct the BeanDescriptor.
*/
public BeanDescriptor(BeanDescriptorMap owner, TypeManager typeManager, DeployBeanDescriptor deploy, String descriptorId) {
this.owner = owner;
this.cacheManager = owner.getCacheManager();
this.serverName = owner.getServerName();
this.luceneIndexDefn = deploy.getIndexDefn();
this.entityType = deploy.getEntityType();
this.name = InternString.intern(deploy.getName());
this.baseTableAlias = "t0";
this.fullName = InternString.intern(deploy.getFullName());
this.descriptorId = descriptorId;
this.useIndex = deploy.getUseIndex();
this.typeManager = typeManager;
this.beanType = deploy.getBeanType();
this.factoryType = deploy.getFactoryType();
this.namedQueries = deploy.getNamedQueries();
this.namedUpdates = deploy.getNamedUpdates();
this.inheritInfo = deploy.getInheritInfo();
this.beanFinder = deploy.getBeanFinder();
this.persistController = deploy.getPersistController();
this.persistListener = deploy.getPersistListener();
this.queryAdapter = deploy.getQueryAdapter();
this.referenceOptions = deploy.getReferenceOptions();
this.defaultSelectClause = deploy.getDefaultSelectClause();
this.defaultSelectClauseSet = deploy.parseDefaultSelectClause(defaultSelectClause);
this.defaultSelectDbArray = deploy.getDefaultSelectDbArray(defaultSelectClauseSet);
this.idType = deploy.getIdType();
this.idGenerator = deploy.getIdGenerator();
this.ldapBaseDn = deploy.getLdapBaseDn();
this.ldapObjectclasses = deploy.getLdapObjectclasses();
this.sequenceName = deploy.getSequenceName();
this.selectLastInsertedId = deploy.getSelectLastInsertedId();
this.lazyFetchIncludes = InternString.intern(deploy.getLazyFetchIncludes());
this.concurrencyMode = deploy.getConcurrencyMode();
this.updateChangesOnly = deploy.isUpdateChangesOnly();
this.dependantTables = deploy.getDependantTables();
this.compoundUniqueConstraints = deploy.getCompoundUniqueConstraints();
this.extraAttrMap = deploy.getExtraAttributeMap();
this.baseTable = InternString.intern(deploy.getBaseTable());
this.beanReflect = deploy.getBeanReflect();
this.autoFetchTunable = EntityType.ORM.equals(entityType) && (beanFinder == null);
// helper object used to derive lists of properties
DeployBeanPropertyLists listHelper = new DeployBeanPropertyLists(owner, this, deploy);
this.propMap = listHelper.getPropertyMap();
this.propMapByDbColumn = getReverseMap(propMap);
this.propertiesTransient = listHelper.getTransients();
this.propertiesNonTransient = listHelper.getNonTransients();
this.propertiesBaseScalar = listHelper.getBaseScalar();
this.propertiesBaseCompound = listHelper.getBaseCompound();
this.propertiesId = listHelper.getId();
this.propertiesVersion = listHelper.getVersion();
this.propertiesEmbedded = listHelper.getEmbedded();
this.propertiesLocal = listHelper.getLocal();
this.unidirectional = listHelper.getUnidirectional();
this.propertiesOne = listHelper.getOnes();
this.propertiesOneExported = listHelper.getOneExported();
this.propertiesOneExportedSave = listHelper.getOneExportedSave();
this.propertiesOneExportedDelete = listHelper.getOneExportedDelete();
this.propertiesOneImported = listHelper.getOneImported();
this.propertiesOneImportedSave = listHelper.getOneImportedSave();
this.propertiesOneImportedDelete = listHelper.getOneImportedDelete();
this.propertiesMany = listHelper.getMany();
this.propertiesManySave = listHelper.getManySave();
this.propertiesManyDelete = listHelper.getManyDelete();
this.propertiesManyToMany = listHelper.getManyToMany();
this.namesOfManyProps = deriveManyPropNames();
this.namesOfManyPropsHash = namesOfManyProps.hashCode();
this.derivedTableJoins = listHelper.getTableJoin();
this.propertyFirstVersion = listHelper.getFirstVersion();
if (propertiesId.length == 1) {
this.propertySingleId = propertiesId[0];
} else {
this.propertySingleId = null;
}
// Check if there are no cascade save associated beans ( subject to change in initialiseOther()).
// Note that if we are in an inheritance hierarchy then we also need to check every
// BeanDescriptors in the InheritInfo as well. We do that later in initialiseOther().
saveRecurseSkippable = (0 == (propertiesOneExportedSave.length + propertiesOneImportedSave.length + propertiesManySave.length));
// Check if there are no cascade delete associated beans (also subject to change in initialiseOther()).
deleteRecurseSkippable = (0 == (propertiesOneExportedDelete.length + propertiesOneImportedDelete.length + propertiesManyDelete.length));
this.propertiesValidationLocal = listHelper.getPropertiesWithValidators(false);
this.propertiesValidationCascade = listHelper.getPropertiesWithValidators(true);
this.beanValidators = listHelper.getBeanValidators();
this.hasLocalValidation = (propertiesValidationLocal.length > 0 || beanValidators.length > 0);
this.hasCascadeValidation = (propertiesValidationCascade.length > 0 || beanValidators.length > 0);
// object used to handle Id values
this.idBinder = owner.createIdBinder(propertiesId);
}
private LinkedHashMap getReverseMap(LinkedHashMap propMap) {
LinkedHashMap revMap = new LinkedHashMap(propMap.size()*2);
for (BeanProperty prop : propMap.values()) {
if (prop.getDbColumn() != null){
revMap.put(prop.getDbColumn(), prop);
}
}
return revMap;
}
/**
* Set the server. Primarily so that the Many's can lazy load.
*/
public void setEbeanServer(SpiEbeanServer ebeanServer) {
this.ebeanServer = ebeanServer;
for (int i = 0; i < propertiesMany.length; i++) {
// used for creating lazy loading lists etc
propertiesMany[i].setLoader(ebeanServer);
}
}
/**
* Create a copy of this bean.
*
* Originally for the purposes of returning a copy (rather than a shared
* instance) from the cache - where the app may want to change the data.
*
*/
@SuppressWarnings("unchecked")
public T createCopy(Object source, CopyContext ctx, int maxDepth) {
Object destBean = createBean(ctx.isVanillaMode());
for (int j = 0; j < propertiesId.length; j++) {
propertiesId[j].copyProperty(source, destBean, ctx, maxDepth);
}
Object destId = getId(destBean);
Object existing = ctx.putIfAbsent(destId, destBean);
if (existing != null) {
return (T)existing;
}
for (int i = 0; i < propertiesNonTransient.length; i++) {
propertiesNonTransient[i].copyProperty(source, destBean, ctx, maxDepth);
}
if (destBean instanceof EntityBean){
EntityBeanIntercept copyEbi = ((EntityBean)destBean)._ebean_getIntercept();
if (source instanceof EntityBean){
EntityBeanIntercept origEbi = ((EntityBean)source)._ebean_getIntercept();
origEbi.copyStateTo(copyEbi);
}
copyEbi.setBeanLoader(0, ebeanServer);
copyEbi.setPersistenceContext(ctx.getPersistenceContext());
if (ctx.isSharing()){
copyEbi.setSharedInstance();
}
}
return (T)destBean;
}
public T createCopyForUpdate(Object orig, boolean vanilla) {
return createCopy(orig, new CopyContext(false, false), 3);
}
public T createCopyForSharing(Object orig) {
return createCopy(orig, new CopyContext(false, true), 3);
}
/**
* Determine the concurrency mode based on the existence
* of a non-null version property value.
*/
public ConcurrencyMode determineConcurrencyMode(Object bean) {
if (propertyFirstVersion == null){
return ConcurrencyMode.NONE;
}
Object v = propertyFirstVersion.getValue(bean);
return (v == null)? ConcurrencyMode.NONE : ConcurrencyMode.VERSION;
}
/**
* Return the Set of embedded beans that have changed.
*/
public Set getDirtyEmbeddedProperties(Object bean) {
HashSet dirtyProperties = null;
for (int i = 0; i < propertiesEmbedded.length; i++) {
Object embValue = propertiesEmbedded[i].getValue(bean);
if (embValue instanceof EntityBean){
if (((EntityBean)embValue)._ebean_getIntercept().isDirty()) {
// this embedded is dirty so should be included in an update
if (dirtyProperties == null){
dirtyProperties = new HashSet();
}
dirtyProperties.add(propertiesEmbedded[i].getName());
}
} else {
// must assume it is dirty
if (dirtyProperties == null){
dirtyProperties = new HashSet();
}
dirtyProperties.add(propertiesEmbedded[i].getName());
}
}
return dirtyProperties;
}
/**
* Determine the non-null properties of the bean.
*/
public Set determineLoadedProperties(Object bean) {
HashSet nonNullProps = new HashSet();
for (int j = 0; j < propertiesId.length; j++) {
if (propertiesId[j].getValue(bean) != null){
nonNullProps.add(propertiesId[j].getName());
}
}
for (int i = 0; i < propertiesNonTransient.length; i++) {
if (propertiesNonTransient[i].getValue(bean) != null){
nonNullProps.add(propertiesNonTransient[i].getName());
}
}
return nonNullProps;
}
/**
* Return the EbeanServer instance that owns this BeanDescriptor.
*/
public SpiEbeanServer getEbeanServer() {
return ebeanServer;
}
/**
* Return the type of this domain object.
*/
public EntityType getEntityType() {
return entityType;
}
/**
* Return the Lucene Index Definition.
*/
public IndexDefn> getLuceneIndexDefn() {
return luceneIndexDefn;
}
/**
* Return the default strategy for using a lucene index (if an index is
* defined on this bean type).
*/
public UseIndex getUseIndex() {
return useIndex;
}
/**
* Return the Lucene Index for this bean type (can be null).
*/
public LIndex getLuceneIndex() {
return luceneIndex;
}
/**
* Sets the Lucene Index once it has been created.
*/
public void setLuceneIndex(LIndex luceneIndex) {
this.luceneIndex = luceneIndex;
}
public void addIndexInvalidate(IndexInvalidate e){
if (luceneIndexInvalidations == null){
luceneIndexInvalidations = new HashSet();
}
luceneIndexInvalidations.add(e);
}
public boolean isNotifyLucene(TransactionEvent txnEvent){
if (luceneIndexInvalidations != null){
for (IndexInvalidate invalidate : luceneIndexInvalidations) {
txnEvent.addIndexInvalidate(invalidate);
}
}
return luceneIndex != null;
}
/**
* Initialise the Id properties first.
*
* These properties need to be initialised prior to the association
* properties as they are used to get the imported and exported properties.
*
*/
public void initialiseId() {
if (logger.isLoggable(Level.FINER)) {
logger.finer("BeanDescriptor initialise " + fullName);
}
if (inheritInfo != null) {
inheritInfo.setDescriptor(this);
}
if (isEmbedded()) {
// initialise all the properties
Iterator it = propertiesAll();
while (it.hasNext()) {
BeanProperty prop = it.next();
prop.initialise();
}
} else {
// initialise just the Id properties
BeanProperty[] idProps = propertiesId();
for (int i = 0; i < idProps.length; i++) {
idProps[i].initialise();
}
}
}
/**
* Initialise the exported and imported parts for associated properties.
*/
public void initialiseOther() {
if (!isEmbedded()) {
// initialise all the non-id properties
Iterator it = propertiesAll();
while (it.hasNext()) {
BeanProperty prop = it.next();
if (!prop.isId()) {
prop.initialise();
}
}
}
if (unidirectional != null) {
unidirectional.initialise();
}
idBinder.initialise();
idBinderInLHSSql = idBinder.getBindIdInSql(baseTableAlias);
idBinderIdSql = idBinder.getBindIdSql(baseTableAlias);
String idBinderInLHSSqlNoAlias = idBinder.getBindIdInSql(null);
String idEqualsSql = idBinder.getBindIdSql(null);
deleteByIdSql = "delete from " + baseTable + " where " + idEqualsSql;
deleteByIdInSql = "delete from " + baseTable + " where " + idBinderInLHSSqlNoAlias+" ";
if (!isEmbedded()) {
// parse every named update up front into sql dml
for (DeployNamedUpdate namedUpdate : namedUpdates.values()) {
DeployUpdateParser parser = new DeployUpdateParser(this);
namedUpdate.initialise(parser);
}
}
}
public void initInheritInfo(){
if (inheritInfo != null){
// need to check every BeanDescriptor in the inheritance hierarchy
if (saveRecurseSkippable){
saveRecurseSkippable = inheritInfo.isSaveRecurseSkippable();
}
if (deleteRecurseSkippable){
deleteRecurseSkippable = inheritInfo.isDeleteRecurseSkippable();
}
}
}
/**
* Initialise the cache once the server has started.
*/
public void cacheInitialise() {
if (referenceOptions != null && referenceOptions.isUseCache()) {
beanCache = cacheManager.getBeanCache(beanType);
}
}
protected boolean hasInheritance() {
return inheritInfo != null;
}
protected boolean isDynamicSubclass() {
return !beanType.equals(factoryType);
}
/**
* Set the LDAP objectClasses to the attributes.
*/
public void setLdapObjectClasses(Attributes attributes) {
if (ldapObjectclasses != null){
BasicAttribute ocAttrs = new BasicAttribute("objectclass");
for (int i = 0; i < ldapObjectclasses.length; i++) {
ocAttrs.add(ldapObjectclasses[i]);
}
attributes.put(ocAttrs);
}
}
/**
* Creates Attributes with the objectclass.
*/
public Attributes createAttributes() {
Attributes attrs = new BasicAttributes(true);
setLdapObjectClasses(attrs);
return attrs;
}
public String getLdapBaseDn() {
return ldapBaseDn;
}
public LdapName createLdapNameById(Object id) throws InvalidNameException {
LdapName baseDn = new LdapName(ldapBaseDn);
idBinder.createLdapNameById(baseDn, id);
return baseDn;
}
public LdapName createLdapName(Object bean) {
try {
LdapName name = new LdapName(ldapBaseDn);
if (bean != null){
idBinder.createLdapNameByBean(name, bean);
}
return name;
} catch (InvalidNameException e) {
throw new LdapPersistenceException(e);
}
}
public SqlUpdate deleteById(Object id, List