Browse Source

DATACMNS-448 - Added infrastructure for 'deleteBy' queries.

Add keywords 'delete' and 'remove' to PartTree indicating presence of delete intend.

Original pull request: #72.
pull/75/merge
Oliver Gierke 12 years ago
parent
commit
4f25a8da24
  1. 8
      src/main/java/org/springframework/data/repository/query/parser/PartTree.java

8
src/main/java/org/springframework/data/repository/query/parser/PartTree.java

@ -39,11 +39,6 @@ import org.springframework.util.StringUtils; @@ -39,11 +39,6 @@ import org.springframework.util.StringUtils;
*/
public class PartTree implements Iterable<OrPart> {
private static final String DELETE_PATTERN = "delete|remove";
private static final Pattern PREFIX_TEMPLATE = Pattern.compile("^(find|read|get|count|query|" + DELETE_PATTERN
+ ")(\\p{Lu}.*?)??By");
/*
* We look for a pattern of: keyword followed by
*
@ -55,6 +50,9 @@ public class PartTree implements Iterable<OrPart> { @@ -55,6 +50,9 @@ public class PartTree implements Iterable<OrPart> {
* @see http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#ubc
*/
private static final String KEYWORD_TEMPLATE = "(%s)(?=(\\p{Lu}|\\P{InBASIC_LATIN}))";
private static final String DELETE_PATTERN = "delete|remove";
private static final Pattern PREFIX_TEMPLATE = Pattern.compile("^(find|read|get|count|query|" + DELETE_PATTERN
+ ")(\\p{Lu}.*?)??By");
/**
* The subject, for example "findDistinctUserByNameOrderByAge" would have the subject "DistinctUser".

Loading…
Cancel
Save