Fixed a bug where complex query method parameters that aren't managed by repositories were causing the parameter processing to short-circuit to a 404 error. Replaced that method call with a different one that simple returns a boolean if a type is managed by a repository so the if/else chain can continue on to the ConversionService.
This commit is contained in:
@@ -71,6 +71,36 @@ public abstract class RepositoryExporterSupport<S extends RepositoryExporterSupp
|
||||
return (S)this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does a Repository exist for this name?
|
||||
*
|
||||
* @param name
|
||||
*
|
||||
* @return true
|
||||
*/
|
||||
public boolean hasRepositoryMetadataFor(String name) {
|
||||
try {
|
||||
return (null != repositoryMetadataFor(name));
|
||||
} catch(RepositoryNotFoundException ignored) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Is there a Repository responsible for this domain type?
|
||||
*
|
||||
* @param domainType
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean hasRepositoryMetadataFor(Class<?> domainType) {
|
||||
try {
|
||||
return (null != repositoryMetadataFor(domainType));
|
||||
} catch(RepositoryNotFoundException ignored) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find {@link RepositoryMetadata} for the {@link org.springframework.data.repository.Repository} exported under this
|
||||
* name.
|
||||
|
||||
@@ -537,11 +537,11 @@ public class RepositoryRestController
|
||||
continue;
|
||||
}
|
||||
|
||||
RepositoryMetadata paramRepoMeta;
|
||||
if(String.class.isAssignableFrom(paramTypes[i])) {
|
||||
// Param type is a String
|
||||
paramVals[i] = queryVal;
|
||||
} else if(null != (paramRepoMeta = repositoryMetadataFor(paramTypes[i]))) {
|
||||
} else if(hasRepositoryMetadataFor(paramTypes[i])) {
|
||||
RepositoryMetadata paramRepoMeta = repositoryMetadataFor(paramTypes[i]);
|
||||
// Complex parameter is a managed type
|
||||
Serializable id = stringToSerializable(queryVal,
|
||||
(Class<Serializable>)paramRepoMeta.entityMetadata()
|
||||
|
||||
Reference in New Issue
Block a user