Author: andrei_exadel
Date: 2009-03-23 09:58:01 -0400 (Mon, 23 Mar 2009)
New Revision: 13101
Modified:
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ISearchAction.java
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/SearchAction.java
Log:
RF-6578
Modified:
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ISearchAction.java
===================================================================
---
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ISearchAction.java 2009-03-23
13:57:53 UTC (rev 13100)
+++
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ISearchAction.java 2009-03-23
13:58:01 UTC (rev 13101)
@@ -3,6 +3,7 @@
import java.util.List;
import org.richfaces.realworld.domain.Image;
+import org.richfaces.realworld.domain.Shelf;
public interface ISearchAction {
public List<Image> searchByImage(String query, boolean searchInMyAlbums, boolean
searchInShared);
@@ -13,4 +14,6 @@
public List<Image> searchByUsers(String query, boolean searchInMyAlbums, boolean
searchInShared);
+ public List<Shelf> searchByShelfs(String query,boolean searchInMyAlbums, boolean
searchInShared);
+
}
Modified:
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/SearchAction.java
===================================================================
---
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/SearchAction.java 2009-03-23
13:57:53 UTC (rev 13100)
+++
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/SearchAction.java 2009-03-23
13:58:01 UTC (rev 13101)
@@ -11,6 +11,7 @@
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
import org.richfaces.realworld.domain.Image;
+import org.richfaces.realworld.domain.Shelf;
import org.richfaces.realworld.domain.User;
@Name("searchAction")
@@ -84,4 +85,16 @@
return query.getResultList();
}
+ public List<Shelf> searchByShelfs(String searchQuery, boolean searchInMyAlbums,
+ boolean searchInShared) {
+ StringBuilder b = new StringBuilder("from Shelf sh where lower(sh.name) like :name
or lower(sh.description) like :name ");
+ if (searchInShared) {
+ b.append(" and sh.shared=true");
+ }
+ Query query = em.createQuery(b.toString());
+
+ query.setParameter("name", "%" + searchQuery.toLowerCase() +
"%");
+ return query.getResultList();
+ }
+
}
Show replies by date