[jboss-cvs] jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/ui ...
Christian Bauer
christian at hibernate.org
Tue Jun 12 08:30:05 EDT 2007
User: cbauer
Date: 07/06/12 08:30:05
Modified: examples/wiki/src/main/org/jboss/seam/wiki/core/ui
Converters.java
Log:
Completed first iteration of search engine
Revision Changes Path
1.6 +25 -1 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/Converters.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Converters.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/Converters.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- Converters.java 22 Mar 2007 12:16:07 -0000 1.5
+++ Converters.java 12 Jun 2007 12:30:05 -0000 1.6
@@ -6,6 +6,8 @@
import org.jboss.seam.wiki.core.model.Role;
import org.jboss.seam.wiki.core.model.Node;
import org.jboss.seam.wiki.core.model.Directory;
+import org.jboss.seam.wiki.core.search.metamodel.SearchableEntity;
+import org.jboss.seam.wiki.core.search.metamodel.SearchRegistry;
import org.jboss.seam.wiki.util.WikiUtil;
import org.jboss.seam.Component;
import org.jboss.seam.ScopeType;
@@ -24,6 +26,28 @@
public class Converters {
+ @Name("searchableEntityConverter")
+ @org.jboss.seam.annotations.jsf.Converter(forClass = SearchableEntity.class)
+ public static class SearchableEntityConverter implements Converter, Serializable {
+
+ @Transactional
+ public Object getAsObject(FacesContext arg0,
+ UIComponent arg1,
+ String arg2) throws ConverterException {
+ if (arg2 == null) return null;
+ SearchRegistry searchRegistry = (SearchRegistry)Component.getInstance("searchRegistry");
+ return searchRegistry.getSearchableEntitiesByName().get(arg2);
+ }
+
+ public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) throws ConverterException {
+ if (arg2 instanceof SearchableEntity) {
+ return ((SearchableEntity)arg2).getClazz().getName();
+ } else {
+ return null;
+ }
+ }
+ }
+
@Name("accessLevelConverter")
@org.jboss.seam.annotations.jsf.Converter(forClass = Role.AccessLevel.class)
public static class AccessLevelConverter implements Converter, Serializable {
More information about the jboss-cvs-commits
mailing list