Author: amarkhel
Date: 2009-04-29 11:54:50 -0400 (Wed, 29 Apr 2009)
New Revision: 13918
Modified:
trunk/examples/photoalbum/source/ejb/src/main/java/org/richfaces/photoalbum/service/Constants.java
trunk/examples/photoalbum/source/ejb/src/main/java/org/richfaces/photoalbum/service/SearchAction.java
Log:
Fix Rf-6928
Modified:
trunk/examples/photoalbum/source/ejb/src/main/java/org/richfaces/photoalbum/service/Constants.java
===================================================================
---
trunk/examples/photoalbum/source/ejb/src/main/java/org/richfaces/photoalbum/service/Constants.java 2009-04-29
15:34:35 UTC (rev 13917)
+++
trunk/examples/photoalbum/source/ejb/src/main/java/org/richfaces/photoalbum/service/Constants.java 2009-04-29
15:54:50 UTC (rev 13918)
@@ -150,15 +150,15 @@
public static final String TAG_BY_NAME_QUERY = "tag-byName";
public static final String SEARCH_QUERY_SHARED_ADDON = " and sh.shared=true";
public static final String SEARCH_QUERY_MY_ADDON = " and
sh.owner.login=:login";
- public static final String SEARCH_SHELVES_QUERY = "from Shelf sh where
lower(sh.name) like :name or lower(sh.description) like :name ";
+ public static final String SEARCH_SHELVES_QUERY = "from Shelf sh where
(lower(sh.name) like :name or lower(sh.description) like :name) ";
public static final String SEARCH_METATAG_QUERY = "from MetaTag t where
lower(t.tag) like :name";
- public static final String SEARCH_USERS_QUERY = "select u from User u where
lower(u.login) like :name or lower(u.firstName) like :name or lower(u.secondName) like
:name";
- public static final String SEARCH_IMAGE_SHARED_ADDON = " and
i.album.shelf.shared=:shared";
+ public static final String SEARCH_USERS_QUERY = "select u from User u where
(lower(u.login) like :name or lower(u.firstName) like :name or lower(u.secondName) like
:name) ";
+ public static final String SEARCH_IMAGE_SHARED_ADDON = " and
i.album.shelf.shared=true";
public static final String SEARCH_IMAGE_MY_ADDON = " and
i.album.owner.login=:login";
- public static final String SEARCH_IMAGE_QUERY = "from Image i where lower(i.name)
like :name or lower(i.description) like :name or lower(i.cameraModel) like :name";
+ public static final String SEARCH_IMAGE_QUERY = "from Image i where (lower(i.name)
like :name or lower(i.description) like :name or lower(i.cameraModel) like :name) ";
public static final String SHARED_PARAMETER = "shared";
public static final String NAME_PARAMETER = "name";
- public static final String SEARCH_ALBUM_SHARED_ADDON = " and
a.shelf.shared=:shared";
+ public static final String SEARCH_ALBUM_SHARED_ADDON = " and
a.shelf.shared=true";
public static final String SEARCH_ALBUM_MY_ADDON = " and
a.owner.login=:login";
public static final String SEARCH_ALBUM_QUERY = "from Album a where lower(a.name)
like :name or lower(a.description) like :name";
public static final String USER_SHELVES_QUERY = "user-shelves";
Modified:
trunk/examples/photoalbum/source/ejb/src/main/java/org/richfaces/photoalbum/service/SearchAction.java
===================================================================
---
trunk/examples/photoalbum/source/ejb/src/main/java/org/richfaces/photoalbum/service/SearchAction.java 2009-04-29
15:34:35 UTC (rev 13917)
+++
trunk/examples/photoalbum/source/ejb/src/main/java/org/richfaces/photoalbum/service/SearchAction.java 2009-04-29
15:54:50 UTC (rev 13918)
@@ -76,9 +76,6 @@
//Set search string
query.setParameter(Constants.NAME_PARAMETER, Constants.PERCENT +
searchQuery.toLowerCase() + Constants.PERCENT);
//If we search only in shared albums
- if(searchInShared){
- query.setParameter(Constants.SHARED_PARAMETER, searchInShared);
- }
//If we search in user's albums
if (searchInMyAlbums) {
query.setParameter(Constants.LOGIN_PARAMETER, user.getLogin());
@@ -110,10 +107,6 @@
//Set search string
query.setParameter(Constants.NAME_PARAMETER, Constants.PERCENT +
searchQuery.toLowerCase() + Constants.PERCENT);
//If we search only in shared images
- if(searchInShared){
- query.setParameter(Constants.SHARED_PARAMETER, searchInShared);
- }
- //If we search only in shared images
if (searchInMyAlbums) {
query.setParameter(Constants.LOGIN_PARAMETER, user.getLogin());
}
Show replies by date