Merged HEAD (5.2) to 5.2.N (5.2.1)

126381 jkaabimofrad: Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2)
      120439 jvonka: RA-630: FileFolder API - update antlr grammar in REST fwk for select/where clause
      - to allow colon in property name identifier (json path)
      - also update impl + test


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@126727 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ancuta Morarasu
2016-05-11 10:54:46 +00:00
parent 5fbede5332
commit 45945b92a6
6 changed files with 910 additions and 1136 deletions

View File

@@ -32,7 +32,7 @@ import org.alfresco.rest.framework.resource.parameters.where.InvalidQueryExcepti
} }
@parser::members { @parser::members {
// These methods are here to force the parser to error instead of suppressing problems. // These methods are here to force the parser to error instead of suppressing problems.
// @Override // @Override
// public void reportError(RecognitionException e) { // public void reportError(RecognitionException e) {
@@ -45,15 +45,15 @@ import org.alfresco.rest.framework.resource.parameters.where.InvalidQueryExcepti
{ {
throw new MismatchedTokenException(ttype, input); throw new MismatchedTokenException(ttype, input);
} }
@Override @Override
public Object recoverFromMismatchedSet(IntStream input, RecognitionException e, BitSet follow) throws RecognitionException public Object recoverFromMismatchedSet(IntStream input, RecognitionException e, BitSet follow) throws RecognitionException
{ {
throw e; throw e;
} }
// //
// @Override // @Override
// public String getErrorMessage(RecognitionException e, String[] tokenNames) // public String getErrorMessage(RecognitionException e, String[] tokenNames)
// { // {
// System.out.println("THROW ME...\n" + e); // System.out.println("THROW ME...\n" + e);
// throw new InvalidQueryException(e.getMessage()); // throw new InvalidQueryException(e.getMessage());
@@ -84,10 +84,12 @@ GREATERTHANOREQUALS: WS?'>='WS?;
LEFTPAREN: '('; LEFTPAREN: '(';
RIGHTPAREN: ')'; RIGHTPAREN: ')';
COMMA: ','; COMMA: ',';
COLON: ':';
SINGLEQUOTE: '\''; SINGLEQUOTE: '\'';
PROPERTYVALUE: (SINGLEQUOTE (~SINGLEQUOTE|'\\'SINGLEQUOTE)* SINGLEQUOTE) |IDENTIFIERDIGIT+; PROPERTYVALUE: (SINGLEQUOTE (~SINGLEQUOTE|'\\'SINGLEQUOTE)* SINGLEQUOTE) |IDENTIFIERDIGIT+;
PROPERTYNAME: '/'? IDENTIFIER ('/'IDENTIFIER)*; PROPERTYNAME: '/'? IDENTIFIER ('/'IDENTIFIER)*;
fragment IDENTIFIER : (IDENTIFIERLETTER (IDENTIFIERLETTER | IDENTIFIERDIGIT)*); fragment IDENTIFIERLETTERORDIGIT: (IDENTIFIERLETTER | IDENTIFIERDIGIT);
fragment IDENTIFIER : (IDENTIFIERLETTER (IDENTIFIERLETTERORDIGIT* | (IDENTIFIERLETTERORDIGIT* COLON IDENTIFIERLETTERORDIGIT*)));
WS : ( ' ' | '\t' | '\r' | '\n' )+ { $channel = HIDDEN; }; WS : ( ' ' | '\t' | '\r' | '\n' )+ { $channel = HIDDEN; };
fragment IDENTIFIERLETTER // any Unicode character that is a Java letter (see below) fragment IDENTIFIERLETTER // any Unicode character that is a Java letter (see below)
: '\u0041'..'\u005a' // A-Z : '\u0041'..'\u005a' // A-Z
@@ -139,7 +141,7 @@ propertyvaluepair: value COMMA value -> value+;
propertyvaluelist: value (COMMA value)* -> value+; propertyvaluelist: value (COMMA value)* -> value+;
value: a=PROPERTYVALUE -> ^(PROPERTYVALUE[$a] ) value: a=PROPERTYVALUE -> ^(PROPERTYVALUE[$a] )
| b=PROPERTYNAME -> ^(PROPERTYVALUE[$b] ); //rewrite this a propertyvalue | b=PROPERTYNAME -> ^(PROPERTYVALUE[$b] ); //rewrite this a propertyvalue
selectClause: PROPERTYNAME (COMMA PROPERTYNAME)* -> PROPERTYNAME+; selectClause: PROPERTYNAME (COMMA PROPERTYNAME)* -> PROPERTYNAME+;
// **** // ****
// SOME NOTES // SOME NOTES
// () - Parentheses. Used to group several elements, so they are treated as one single token // () - Parentheses. Used to group several elements, so they are treated as one single token
@@ -149,4 +151,4 @@ selectClause: PROPERTYNAME (COMMA PROPERTYNAME)* -> PROPERTYNAME+;
// . - Any character/token can occur one time // . - Any character/token can occur one time
// ~ - Any character/token following the ~ may not occur at the current place // ~ - Any character/token following the ~ may not occur at the current place
// .. - Between two characters .. spans a range which accepts every character between both boundaries inclusive // .. - Between two characters .. spans a range which accepts every character between both boundaries inclusive
// **** // ****

View File

@@ -1,22 +1,24 @@
AND=4 AND=4
BETWEEN=5 BETWEEN=5
COMMA=6 COLON=6
EQUALS=7 COMMA=7
EXISTS=8 EQUALS=8
GREATERTHAN=9 EXISTS=9
GREATERTHANOREQUALS=10 GREATERTHAN=10
IDENTIFIER=11 GREATERTHANOREQUALS=11
IDENTIFIERDIGIT=12 IDENTIFIER=12
IDENTIFIERLETTER=13 IDENTIFIERDIGIT=13
IN=14 IDENTIFIERLETTER=14
LEFTPAREN=15 IDENTIFIERLETTERORDIGIT=15
LESSTHAN=16 IN=16
LESSTHANOREQUALS=17 LEFTPAREN=17
MATCHES=18 LESSTHAN=18
NEGATION=19 LESSTHANOREQUALS=19
OR=20 MATCHES=20
PROPERTYNAME=21 NEGATION=21
PROPERTYVALUE=22 OR=22
RIGHTPAREN=23 PROPERTYNAME=23
SINGLEQUOTE=24 PROPERTYVALUE=24
WS=25 RIGHTPAREN=25
SINGLEQUOTE=26
WS=27

File diff suppressed because it is too large Load Diff

View File

@@ -1546,8 +1546,6 @@ public class NodesImpl implements Nodes
str = str.substring(PREFIX.length()); str = str.substring(PREFIX.length());
} }
str = str.replaceFirst("_", ":"); // FIXME remove this when we have fixed the framework.
QName name = createQName(str); QName name = createQName(str);
if (!EXCLUDED_PROPS.contains(name)) if (!EXCLUDED_PROPS.contains(name))
{ {

View File

@@ -339,7 +339,7 @@ public class NodeApiTest extends AbstractBaseApiTest
AuthenticationUtil.setFullyAuthenticatedUser(user1); AuthenticationUtil.setFullyAuthenticatedUser(user1);
// request property via select // request property via select
Map<String, String> params = new LinkedHashMap<>(); Map<String, String> params = new LinkedHashMap<>();
params.put("select", "cm_lastThumbnailModification");// TODO replace the underscore with colon when the framework is fixed. params.put("select", "cm:lastThumbnailModification");
params.put("orderBy", "isFolder DESC,modifiedAt DESC"); params.put("orderBy", "isFolder DESC,modifiedAt DESC");
response = getAll(getChildrenUrl(myFilesNodeRef), user1, paging, params, 200); response = getAll(getChildrenUrl(myFilesNodeRef), user1, paging, params, 200);
nodes = jacksonUtil.parseEntries(response.getJsonResponse(), Document.class); nodes = jacksonUtil.parseEntries(response.getJsonResponse(), Document.class);