Use this. Prefix in Odm

Issue gh-745
This commit is contained in:
Josh Cummings
2023-05-09 16:37:25 -06:00
parent 2ebf8946e8
commit 01432fbe79
8 changed files with 73 additions and 72 deletions

View File

@@ -52,10 +52,10 @@ public final class OdmManagerImpl implements OdmManager {
public OdmManagerImpl(ConverterManager converterManager, LdapOperations ldapOperations,
Set<Class<?>> managedClasses) {
this.ldapTemplate = (LdapTemplate) ldapOperations;
objectDirectoryMapper = new DefaultObjectDirectoryMapper();
this.objectDirectoryMapper = new DefaultObjectDirectoryMapper();
if (converterManager != null) {
objectDirectoryMapper.setConverterManager(converterManager);
this.objectDirectoryMapper.setConverterManager(converterManager);
}
if (managedClasses != null) {
@@ -64,7 +64,7 @@ public final class OdmManagerImpl implements OdmManager {
}
}
this.ldapTemplate.setObjectDirectoryMapper(objectDirectoryMapper);
this.ldapTemplate.setObjectDirectoryMapper(this.objectDirectoryMapper);
}
public OdmManagerImpl(ConverterManager converterManager, ContextSource contextSource,
@@ -82,7 +82,7 @@ public final class OdmManagerImpl implements OdmManager {
* @param managedClass The class to add to the managed set.
*/
public void addManagedClass(Class<?> managedClass) {
objectDirectoryMapper.manageClass(managedClass);
this.objectDirectoryMapper.manageClass(managedClass);
}
/*
@@ -91,7 +91,7 @@ public final class OdmManagerImpl implements OdmManager {
* @see org.springframework.ldap.odm.core.OdmManager#create(java.lang.Object)
*/
public <T> T read(Class<T> clazz, Name dn) {
return ldapTemplate.findByDn(dn, clazz);
return this.ldapTemplate.findByDn(dn, clazz);
}
/*
@@ -100,7 +100,7 @@ public final class OdmManagerImpl implements OdmManager {
* @see org.springframework.ldap.odm.core.OdmManager#create(java.lang.Object)
*/
public void create(Object entry) {
ldapTemplate.create(entry);
this.ldapTemplate.create(entry);
}
/*
@@ -109,7 +109,7 @@ public final class OdmManagerImpl implements OdmManager {
* @see org.springframework.ldap.odm.core.OdmManager#update(java.lang.Object, boolean)
*/
public void update(Object entry) {
ldapTemplate.update(entry);
this.ldapTemplate.update(entry);
}
/*
@@ -118,7 +118,7 @@ public final class OdmManagerImpl implements OdmManager {
* @see org.springframework.ldap.odm.core.OdmManager#delete(javax.naming.Name)
*/
public void delete(Object entry) {
ldapTemplate.delete(entry);
this.ldapTemplate.delete(entry);
}
/*
@@ -133,16 +133,16 @@ public final class OdmManagerImpl implements OdmManager {
searchFilter = new HardcodedFilter(filter);
}
return ldapTemplate.find(base, searchFilter, scope, managedClass);
return this.ldapTemplate.find(base, searchFilter, scope, managedClass);
}
@Override
public <T> List<T> search(Class<T> clazz, LdapQuery query) {
return ldapTemplate.find(query, clazz);
return this.ldapTemplate.find(query, clazz);
}
public <T> List<T> findAll(Class<T> managedClass, Name base, SearchControls scope) {
return ldapTemplate.findAll(base, scope, managedClass);
return this.ldapTemplate.findAll(base, scope, managedClass);
}
}

View File

@@ -93,17 +93,17 @@ public final class OdmManagerImplFactoryBean implements FactoryBean {
* @see org.springframework.beans.factory.FactoryBean#getObject()
*/
public Object getObject() throws Exception {
if (ldapOperations == null) {
if (this.ldapOperations == null) {
throw new FactoryBeanNotInitializedException("contextSource ldapOperations property has not been set");
}
if (managedClasses == null) {
if (this.managedClasses == null) {
throw new FactoryBeanNotInitializedException("managedClasses property has not been set");
}
if (converterManager == null) {
if (this.converterManager == null) {
throw new FactoryBeanNotInitializedException("converterManager property has not been set");
}
return new OdmManagerImpl(converterManager, ldapOperations, managedClasses);
return new OdmManagerImpl(this.converterManager, this.ldapOperations, this.managedClasses);
}
/*

View File

@@ -53,35 +53,35 @@ public final class AttributeSchema {
}
public boolean getIsArray() {
return isArray;
return this.isArray;
}
public boolean getIsBinary() {
return isBinary;
return this.isBinary;
}
public boolean getIsPrimitive() {
return isPrimitive;
return this.isPrimitive;
}
public String getScalarType() {
return scalarType;
return this.scalarType;
}
public String getName() {
return name;
return this.name;
}
public String getJavaName() {
return StringUtils.replace(name, "-", "");
return StringUtils.replace(this.name, "-", "");
}
public String getSyntax() {
return syntax;
return this.syntax;
}
public boolean getIsMultiValued() {
return isMultiValued;
return this.isMultiValued;
}
/*
@@ -94,20 +94,21 @@ public final class AttributeSchema {
return String.format(
"{ name=%1$s, syntax=%2$s, isMultiValued=%3$s, isPrimitive=%4$s, isBinary=%5$s, isArray=%6$s, scalarType=%7$s }",
name, syntax, isMultiValued, isPrimitive, isBinary, isArray, scalarType);
this.name, this.syntax, this.isMultiValued, this.isPrimitive, this.isBinary, this.isArray,
this.scalarType);
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (isArray ? 1231 : 1237);
result = prime * result + (isBinary ? 1231 : 1237);
result = prime * result + (isMultiValued ? 1231 : 1237);
result = prime * result + (isPrimitive ? 1231 : 1237);
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((scalarType == null) ? 0 : scalarType.hashCode());
result = prime * result + ((syntax == null) ? 0 : syntax.hashCode());
result = prime * result + (this.isArray ? 1231 : 1237);
result = prime * result + (this.isBinary ? 1231 : 1237);
result = prime * result + (this.isMultiValued ? 1231 : 1237);
result = prime * result + (this.isPrimitive ? 1231 : 1237);
result = prime * result + ((this.name == null) ? 0 : this.name.hashCode());
result = prime * result + ((this.scalarType == null) ? 0 : this.scalarType.hashCode());
result = prime * result + ((this.syntax == null) ? 0 : this.syntax.hashCode());
return result;
}
@@ -120,31 +121,31 @@ public final class AttributeSchema {
if (getClass() != obj.getClass())
return false;
AttributeSchema other = (AttributeSchema) obj;
if (isArray != other.isArray)
if (this.isArray != other.isArray)
return false;
if (isBinary != other.isBinary)
if (this.isBinary != other.isBinary)
return false;
if (isMultiValued != other.isMultiValued)
if (this.isMultiValued != other.isMultiValued)
return false;
if (isPrimitive != other.isPrimitive)
if (this.isPrimitive != other.isPrimitive)
return false;
if (name == null) {
if (this.name == null) {
if (other.name != null)
return false;
}
else if (!name.equals(other.name))
else if (!this.name.equals(other.name))
return false;
if (scalarType == null) {
if (this.scalarType == null) {
if (other.scalarType != null)
return false;
}
else if (!scalarType.equals(other.scalarType))
else if (!this.scalarType.equals(other.scalarType))
return false;
if (syntax == null) {
if (this.syntax == null) {
if (other.syntax != null)
return false;
}
else if (!syntax.equals(other.syntax))
else if (!this.syntax.equals(other.syntax))
return false;
return true;
}

View File

@@ -55,15 +55,15 @@ public final class ObjectSchema {
}
public Set<AttributeSchema> getMust() {
return Collections.unmodifiableSet(must);
return Collections.unmodifiableSet(this.must);
}
public Set<AttributeSchema> getMay() {
return Collections.unmodifiableSet(may);
return Collections.unmodifiableSet(this.may);
}
public Set<String> getObjectClass() {
return Collections.unmodifiableSet(objectClass);
return Collections.unmodifiableSet(this.objectClass);
}
/*
@@ -73,16 +73,16 @@ public final class ObjectSchema {
*/
@Override
public String toString() {
return String.format("objectClass=%1$s | must=%2$s | may=%3$s", objectClass, must, may);
return String.format("objectClass=%1$s | must=%2$s | may=%3$s", this.objectClass, this.must, this.may);
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((may == null) ? 0 : may.hashCode());
result = prime * result + ((must == null) ? 0 : must.hashCode());
result = prime * result + ((objectClass == null) ? 0 : objectClass.hashCode());
result = prime * result + ((this.may == null) ? 0 : this.may.hashCode());
result = prime * result + ((this.must == null) ? 0 : this.must.hashCode());
result = prime * result + ((this.objectClass == null) ? 0 : this.objectClass.hashCode());
return result;
}
@@ -95,23 +95,23 @@ public final class ObjectSchema {
if (getClass() != obj.getClass())
return false;
ObjectSchema other = (ObjectSchema) obj;
if (may == null) {
if (this.may == null) {
if (other.may != null)
return false;
}
else if (!may.equals(other.may))
else if (!this.may.equals(other.may))
return false;
if (must == null) {
if (this.must == null) {
if (other.must != null)
return false;
}
else if (!must.equals(other.must))
else if (!this.must.equals(other.must))
return false;
if (objectClass == null) {
if (this.objectClass == null) {
if (other.objectClass != null)
return false;
}
else if (!objectClass.equals(other.objectClass))
else if (!this.objectClass.equals(other.objectClass))
return false;
return true;
}

View File

@@ -46,7 +46,7 @@ import org.springframework.ldap.odm.tools.SyntaxToJavaClass.ClassInfo;
public ObjectSchema getObjectSchema(Set<String> objectClasses) throws NamingException, ClassNotFoundException {
ObjectSchema result = new ObjectSchema();
createObjectClass(objectClasses, schemaContext, result);
createObjectClass(objectClasses, this.schemaContext, result);
return result;
}
@@ -101,10 +101,10 @@ import org.springframework.ldap.odm.tools.SyntaxToJavaClass.ClassInfo;
}
// Is it binary?
boolean isBinary = binarySet.contains(syntax);
boolean isBinary = this.binarySet.contains(syntax);
// Use it to look up the required Java class
ClassInfo classInfo = syntaxToJavaClass.getClassInfo(syntax);
ClassInfo classInfo = this.syntaxToJavaClass.getClassInfo(syntax);
// Now we can set the java class
String javaClassName = null;

View File

@@ -133,16 +133,16 @@ public final class SchemaToJava {
}
public String getShort() {
return shortName;
return this.shortName;
}
public String getLong() {
return longName;
return this.longName;
}
@Override
public String toString() {
return String.format("short=%1$s, long=%2$s", shortName, longName);
return String.format("short=%1$s, long=%2$s", this.shortName, this.longName);
}
}

View File

@@ -80,16 +80,16 @@ public final class SchemaViewer {
}
public String getShort() {
return shortName;
return this.shortName;
}
public String getLong() {
return longName;
return this.longName;
}
@Override
public String toString() {
return String.format("short=%1$s, long=%2$s", shortName, longName);
return String.format("short=%1$s, long=%2$s", this.shortName, this.longName);
}
}
@@ -105,12 +105,12 @@ public final class SchemaViewer {
}
public String getValue() {
return value;
return this.value;
}
@Override
public String toString() {
return String.format("value=%1$s", value);
return String.format("value=%1$s", this.value);
}
}

View File

@@ -39,20 +39,20 @@ import java.util.Map.Entry;
}
public String getClassName() {
return className;
return this.className;
}
public String getPackageName() {
return packageName;
return this.packageName;
}
public String getFullClassName() {
StringBuilder result = new StringBuilder();
if (packageName != null) {
result.append(packageName).append(".").append(className);
if (this.packageName != null) {
result.append(this.packageName).append(".").append(this.className);
}
else {
result.append(className);
result.append(this.className);
}
return result.toString();
}
@@ -74,12 +74,12 @@ import java.util.Map.Entry;
else {
className = fullClassName;
}
mapSyntaxToClassInfo.put(syntaxAndClass.getKey(), new ClassInfo(className, packageName));
this.mapSyntaxToClassInfo.put(syntaxAndClass.getKey(), new ClassInfo(className, packageName));
}
}
public ClassInfo getClassInfo(String syntax) {
return mapSyntaxToClassInfo.get(syntax);
return this.mapSyntaxToClassInfo.get(syntax);
}
}