Add explicit transactional semantics to the deleteEntity method because of problems with Neo4J support.

This commit is contained in:
Jon Brisbin
2013-03-13 11:14:48 -05:00
committed by Jon Brisbin
parent 8d89cc2ffe
commit 94328592f4
5 changed files with 47 additions and 55 deletions

View File

@@ -1,37 +0,0 @@
package org.springframework.data.rest.repository;
import org.springframework.data.domain.Pageable;
import org.springframework.hateoas.Link;
import org.springframework.hateoas.Resources;
/**
* @author Jon Brisbin
*/
public class PageableResources<T> extends Resources<T> {
private Pageable page;
protected PageableResources() {
super();
}
public PageableResources(Iterable<T> content, Pageable page, Link... links) {
super(content, links);
this.page = page;
}
public PageableResources(Iterable<T> content, Pageable page, Iterable<Link> links) {
super(content, links);
this.page = page;
}
public Pageable getPage() {
return page;
}
public PageableResources<T> setPage(Pageable page) {
this.page = page;
return this;
}
}

View File

@@ -1,5 +1,6 @@
package org.springframework.data.rest.repository.invoke;
import static org.springframework.data.rest.repository.support.ResourceMappingUtils.getResourceMapping;
import static org.springframework.util.ReflectionUtils.*;
import java.io.Serializable;
@@ -13,6 +14,8 @@ import org.springframework.data.domain.Sort;
import org.springframework.data.mapping.PersistentEntity;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.core.RepositoryInformation;
import org.springframework.data.rest.config.RepositoryRestConfiguration;
import org.springframework.data.rest.config.ResourceMapping;
/**
* @author Jon Brisbin
@@ -38,14 +41,14 @@ public class RepositoryMethodInvoker implements PagingAndSortingRepository<Objec
@SuppressWarnings({"unchecked"})
public RepositoryMethodInvoker(Object repository,
RepositoryInformation repoInfo,
final PersistentEntity persistentEntity) {
RepositoryRestConfiguration config) {
this.repository = repository;
Class<?> repoType = repoInfo.getRepositoryInterface();
doWithMethods(repoType, new MethodCallback() {
@Override public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
String name = method.getName();
int cardinality = method.getParameterTypes().length;
int cardinality = method.getParameterTypes().length;
Class<?> paramType = (cardinality == 1 ? method.getParameterTypes()[0] : null);
boolean someMethod = (null != paramType && Iterable.class.isAssignableFrom(paramType));
boolean byIdMethod = (null != paramType && paramType == Serializable.class);

View File

@@ -49,6 +49,7 @@ public class PersistentEntityToJsonSchemaConverter
return (Class.class.isAssignableFrom(sourceType.getType()) && JsonSchema.class.isAssignableFrom(targetType.getType()));
}
@Override public Set<ConvertiblePair> getConvertibleTypes() {
return convertiblePairs;
}