mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Remove LDAP feature support
This commit is contained in:
@@ -1,15 +1,6 @@
|
||||
package com.avaje.ebeaninternal.server.deploy;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import javax.naming.NamingEnumeration;
|
||||
import javax.naming.NamingException;
|
||||
import javax.naming.directory.Attribute;
|
||||
import javax.naming.directory.BasicAttribute;
|
||||
|
||||
import com.avaje.ebean.bean.BeanCollectionAdd;
|
||||
import com.avaje.ebeaninternal.server.deploy.meta.DeployBeanPropertySimpleCollection;
|
||||
import com.avaje.ebeaninternal.server.ldap.LdapPersistenceException;
|
||||
import com.avaje.ebeaninternal.server.type.ScalarType;
|
||||
|
||||
public class BeanPropertySimpleCollection<T> extends BeanPropertyAssocMany<T> {
|
||||
@@ -25,56 +16,4 @@ public class BeanPropertySimpleCollection<T> extends BeanPropertyAssocMany<T> {
|
||||
super.initialise();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Attribute createAttribute(Object bean) {
|
||||
Object v = getValue(bean);
|
||||
if (v == null){
|
||||
return null;
|
||||
}
|
||||
if (ldapAttributeAdapter != null){
|
||||
return ldapAttributeAdapter.createAttribute(v);
|
||||
}
|
||||
|
||||
BasicAttribute attrs = new BasicAttribute(getDbColumn());
|
||||
|
||||
Iterator<?> it = help.getIterator(v);
|
||||
if (it != null){
|
||||
while (it.hasNext()) {
|
||||
Object beanValue = it.next();
|
||||
Object attrValue = collectionScalarType.toJdbcType(beanValue);
|
||||
attrs.add(attrValue);
|
||||
}
|
||||
}
|
||||
return attrs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttributeValue(Object bean, Attribute attr) {
|
||||
try {
|
||||
if (attr != null){
|
||||
Object beanValue;
|
||||
if (ldapAttributeAdapter != null){
|
||||
beanValue = ldapAttributeAdapter.readAttribute(attr);
|
||||
|
||||
} else {
|
||||
boolean vanilla = true;
|
||||
beanValue = help.createEmpty(vanilla);
|
||||
BeanCollectionAdd collAdd = help.getBeanCollectionAdd(beanValue, mapKey);
|
||||
|
||||
NamingEnumeration<?> en = attr.getAll();
|
||||
while (en.hasMoreElements()) {
|
||||
Object attrValue = (Object) en.nextElement();
|
||||
Object collValue = collectionScalarType.toBeanType(attrValue);
|
||||
collAdd.addBean(collValue);
|
||||
}
|
||||
}
|
||||
|
||||
setValue(bean, beanValue);
|
||||
}
|
||||
} catch (NamingException e) {
|
||||
throw new LdapPersistenceException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user