You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@metamodel.apache.org by Kasper Sørensen <i....@gmail.com> on 2014/11/07 21:47:21 UTC

Review Request 27742: METAMODEL-92: Added support for resolving nested values in document-based datacontext implementations

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/27742/
-----------------------------------------------------------

Review request for MetaModel.


Bugs: METAMODEL-92
    https://issues.apache.org/jira/browse/METAMODEL-92


Repository: metamodel


Description
-------

This patch makes it possible to specify column names with "paths" in document-based data stores such as JSON files, MongoDB and CouchDB. The path format is similar to that of EL/JavaScript syntax. It supports traversing maps and lists/arrays. Here's an example of a few expressions:

 * address.city
 * addresses[0].city
 * person.addresses[1].country.code

And so on...

I added the path based resolving method ("find(...)") to CollectionUtils - seemed like the most appropriate place, and it makes it broadly reusable since it is in the core module.


Diffs
-----

  core/src/main/java/org/apache/metamodel/schema/builder/ColumnNameAsKeysRowConverter.java f50db02 
  core/src/main/java/org/apache/metamodel/util/CollectionUtils.java 2809b4a 
  core/src/test/java/org/apache/metamodel/util/CollectionUtilsTest.java 240e0ca 
  couchdb/src/main/java/org/apache/metamodel/couchdb/CouchDbDataSet.java fac3906 
  couchdb/src/main/java/org/apache/metamodel/couchdb/CouchDbDatabaseDocumentSource.java d1f113d 
  couchdb/src/main/java/org/apache/metamodel/couchdb/CouchDbDocumentConverter.java db1ccca 
  couchdb/src/main/java/org/apache/metamodel/couchdb/CouchDbUtils.java 9f5fb7d 
  couchdb/src/test/java/org/apache/metamodel/couchdb/CouchDbDataContextTest.java 96e1149 
  json/src/test/java/org/apache/metamodel/json/JsonDataContextTest.java 0324d7c 
  json/src/test/resources/nested_fields.json PRE-CREATION 
  mongodb/src/main/java/org/apache/metamodel/mongodb/MongoDBUtils.java 78d51b2 
  mongodb/src/test/java/org/apache/metamodel/mongodb/MongoDbDataContextTest.java a55633b 

Diff: https://reviews.apache.org/r/27742/diff/


Testing
-------

Added unittests of path traversal (CollectionUtilsTest).
Added unittests for application to JSON files (JsonDataContextTest)
Added integration tests for MongoDB and CouchDB application (MongoDbDataContextTest and CouchDbDataContextTest)


Thanks,

Kasper Sørensen