branch chorem-ng updated (f7df510 -> 0189b95)
This is an automated email from the git hooks/post-receive script. New change to branch chorem-ng in repository chorem. See http://git.chorem.org/chorem.git from f7df510 Refs #1211 : Improve home page with billing new 0189b95 add path in mapping to filter by a field and to keep deeper on a object collection fields The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 0189b9515a1ccefe4b51878b048e492d3ab8431b Author: Yannick Martel <yannick.martel@gmail.com> Date: Fri Jun 5 17:30:52 2015 +0200 add path in mapping to filter by a field and to keep deeper on a object collection fields Summary of changes: .../webmotion/actions/WikittyRestAction.java | 31 ++++++++++++++++++++++ chorem-webmotion/src/main/resources/mapping | 10 ++++--- 2 files changed, 37 insertions(+), 4 deletions(-) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch chorem-ng in repository chorem. See http://git.chorem.org/chorem.git commit 0189b9515a1ccefe4b51878b048e492d3ab8431b Author: Yannick Martel <yannick.martel@gmail.com> Date: Fri Jun 5 17:30:52 2015 +0200 add path in mapping to filter by a field and to keep deeper on a object collection fields --- .../webmotion/actions/WikittyRestAction.java | 31 ++++++++++++++++++++++ chorem-webmotion/src/main/resources/mapping | 10 ++++--- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/WikittyRestAction.java b/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/WikittyRestAction.java index 4b20351..26de160 100644 --- a/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/WikittyRestAction.java +++ b/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/WikittyRestAction.java @@ -23,6 +23,7 @@ package org.chorem.webmotion.actions; import java.util.ArrayList; +import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -40,6 +41,7 @@ import org.nuiton.wikitty.entities.FieldType; import org.nuiton.wikitty.entities.Wikitty; import org.nuiton.wikitty.entities.WikittyExtension; import org.nuiton.wikitty.entities.WikittyImpl; +import org.nuiton.wikitty.entities.WikittyTypes; import org.nuiton.wikitty.query.WikittyQuery; import org.nuiton.wikitty.query.WikittyQueryMaker; import org.nuiton.wikitty.query.WikittyQueryParser; @@ -80,6 +82,35 @@ public class WikittyRestAction extends WebMotionController { return result; } + public List<Wikitty> getWikittyExtensionFields(ChoremClient client, String extension, String id, String extensionField) { + Wikitty wikitty = client.restore(id); + + FieldType fieldType = wikitty.getFieldType(extension, extensionField); + + if (fieldType.isCollection() && fieldType.getType() == WikittyTypes.WIKITTY) { + List<String> fieldIds = wikitty.getFieldAsList(extension, extensionField, String.class); + List<Wikitty> wikittyList = client.restore(fieldIds); + return wikittyList; + } + + throw new UnsupportedOperationException("Cannot load something else than complex attributes, simple data should be already load."); + } + + public List<Wikitty> getWikittiesFilteredByField(ChoremClient client, String extension, String field, String value) { + + WikittyQuery query = new WikittyQueryMaker().where() + .and() + .exteq(extension) + .eq(extension + "." + field, value) + .getQuery(); + + WikittyQueryResult<Wikitty> queryResult = client.findAllByQuery(Wikitty.class, query); + List<Wikitty> result = queryResult.getAll(); + + return result; + + } + public Render getWikittiesFromQuery(ChoremClient client, String query) { WikittyQuery q = WikittyQueryParser.parse(query); WikittyQueryResult<Wikitty> qResult = client.findAllByQuery(Wikitty.class, q); diff --git a/chorem-webmotion/src/main/resources/mapping b/chorem-webmotion/src/main/resources/mapping index f632178..e93e1d3 100644 --- a/chorem-webmotion/src/main/resources/mapping +++ b/chorem-webmotion/src/main/resources/mapping @@ -10,13 +10,15 @@ default.render=org.chorem.webmotion.render.JsonRender [actions] +GET /services/v1/{extension}?field={field}&value={value} action:WikittyRestAction.getWikittiesFilteredByField GET /services/v1/{extension} action:WikittyRestAction.getWikitties GET /services/v1/{extension}/{id} action:WikittyRestAction.getWikitty +GET /services/v1/{extension}/{id}/{extensionField} action:WikittyRestAction.getWikittyExtensionFields -#* /logout action:Ge#nericAction.logout -#* /wikitty/{extension}/search action:Ge#nericAction.search -#* /wikitty/{extension}/search action:Ge#nericAction.search -#* /wikitty/{extension}/view/{id} action:Ge#nericAction.view +#* /logout action:GenericAction.logout +#* /wikitty/{extension}/search action:GenericAction.search +#* /wikitty/{extension}/search action:GenericAction.search +#* /wikitty/{extension}/view/{id} action:GenericAction.view #* /wikitty/{extension}/edit/{id} action:GenericAction.edit #* /wikitty/{extension}/editMulti/{ids} action:GenericAction.editMulti #* /wikitty/{extension}/delete/{id} action:GenericAction.delete -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm