Author: ymartel Date: 2012-05-21 18:20:35 +0200 (Mon, 21 May 2012) New Revision: 149 Url: http://chorem.org/repositories/revision/chorem/149 Log: fixes #558 Just list related wikitties on wikitty view Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/view.jsp Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java =================================================================== --- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java 2012-05-15 16:28:13 UTC (rev 148) +++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java 2012-05-21 16:20:35 UTC (rev 149) @@ -135,15 +135,19 @@ List<Map<String, String>> result = new ArrayList<Map<String, String>>(map.size()); for (Map.Entry<String, Wikitty> e : map.entries()) { String extName = e.getKey(); - String id = e.getValue().getId(); - String label = e.getValue().toString(extName); - Map<String, String> item = new LinkedHashMap<String, String>(); - item.put("extension", extName); - item.put("label", label); - item.put("value", label); - item.put("name", label); - item.put("id", id); - result.add(item); + Wikitty value = e.getValue(); + // Avoid potential null value + if (value != null) { + String id = value.getId(); + String label = value.toString(extName); + Map<String, String> item = new LinkedHashMap<String, String>(); + item.put("extension", extName); + item.put("label", label); + item.put("value", label); + item.put("name", label); + item.put("id", id); + result.add(item); + } } return renderJSON(result); } @@ -241,7 +245,7 @@ // ajout de l'ordre de tri de l'extension extQuery.setSortAscending(ext.getSortAscending()); extQuery.setSortDescending(ext.getSortDescending()); - + queries.add(extQuery); } @@ -256,8 +260,6 @@ LinkedHashMultimap<String, Wikitty> map = LinkedHashMultimap.create(); for (WikittyQueryResult<Wikitty> result : results) { String ext = result.getQueryName(); - // This add the extension, even if it has no result - map.put(ext, null); for (Wikitty w : result) { map.put(ext, w); } @@ -374,4 +376,5 @@ } return renderURL("/wikitty/view/"+id); } + } Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/view.jsp =================================================================== --- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/view.jsp 2012-05-15 16:28:13 UTC (rev 148) +++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/view.jsp 2012-05-21 16:20:35 UTC (rev 149) @@ -21,7 +21,7 @@ </c:forEach> <div class="container"> - <jsp:include page="/wikitty/search?extension=${extensions}&query=${wikitty.id} AND id!=${wikitty.id}"/> + <jsp:include page="/wikitty/search?query=${wikitty.id} AND id!=${wikitty.id}"/> <%-- <c:forEach var="ext" items="${extensions}"> <jsp:include page="footer${ext.name}.jsp"/>