[kune-commits] r1857 - in trunk: script src/main/java/cc/kune/core/client/sitebar/search src/main/java/cc/kune/core/server/rest src/main/java/cc/kune/core/shared/dto src/main/resources
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Thu Apr 19 06:37:12 CEST 2012
Author: vjrj_
Date: 2012-04-19 06:37:12 +0200 (Thu, 19 Apr 2012)
New Revision: 1857
Added:
trunk/src/main/java/cc/kune/core/shared/dto/GroupResultDTO.java
Modified:
trunk/script/kune client -no-server.launch
trunk/src/main/java/cc/kune/core/client/sitebar/search/MultivalueSuggestBox.java
trunk/src/main/java/cc/kune/core/server/rest/GroupJSONService.java
trunk/src/main/java/cc/kune/core/server/rest/UserJSONService.java
trunk/src/main/resources/dozerBeanMapping.xml
Log:
CLOSED - # 189: Search Bar: distinguish groups from people
http://kune.ourproject.org/issues/ticket/189
Modified: trunk/script/kune client -no-server.launch
===================================================================
--- trunk/script/kune client -no-server.launch 2012-04-19 02:16:59 UTC (rev 1856)
+++ trunk/script/kune client -no-server.launch 2012-04-19 04:37:12 UTC (rev 1857)
@@ -22,5 +22,5 @@
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.DevMode"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-war /home/vjrj/proyectos/dev/kune/trunk/target/kune-0.2.0-SNAPSHOT -startupUrl /?locale=en&log_level=INFO -noserver -remoteUI "${gwt_remote_ui_server_port}:${unique_id}" -logLevel INFO -codeServerPort 9997 cc.kune.KuneDev"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="kune"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx512m"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xss512m -Xmx1024m -XX:MaxPermSize=1024m"/>
</launchConfiguration>
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/search/MultivalueSuggestBox.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/search/MultivalueSuggestBox.java 2012-04-19 02:16:59 UTC (rev 1856)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/search/MultivalueSuggestBox.java 2012-04-19 04:37:12 UTC (rev 1857)
@@ -43,8 +43,10 @@
import cc.kune.common.client.log.Log;
import cc.kune.common.client.notify.NotifyUser;
+import cc.kune.core.client.i18n.I18n;
import cc.kune.core.client.i18n.I18nUITranslationService;
import cc.kune.core.shared.SearcherConstants;
+import cc.kune.core.shared.dto.GroupType;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.dom.client.KeyUpHandler;
@@ -883,7 +885,12 @@
final String longName = jsonOpt.get(OptionResultSet.DISPLAY_NAME).isString().stringValue();
final String shortName = jsonOpt.get(OptionResultSet.VALUE).isString().stringValue();
- option.setName(!longName.equals(shortName) ? longName + " (" + shortName + ")" : shortName);
+ final JSONValue groupTypeJsonValue = jsonOpt.get("groupType");
+ final String prefix = groupTypeJsonValue.isString() == null ? ""
+ : GroupType.PERSONAL.name().equals(groupTypeJsonValue.isString().stringValue()) ? I18n.t("User: ")
+ : I18n.t("Group: ");
+ option.setName(prefix
+ + (!longName.equals(shortName) ? longName + " (" + shortName + ")" : shortName));
option.setValue(jsonOpt.get(OptionResultSet.VALUE).isString().stringValue());
options.addOption(option);
}
Modified: trunk/src/main/java/cc/kune/core/server/rest/GroupJSONService.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rest/GroupJSONService.java 2012-04-19 02:16:59 UTC (rev 1856)
+++ trunk/src/main/java/cc/kune/core/server/rest/GroupJSONService.java 2012-04-19 04:37:12 UTC (rev 1857)
@@ -19,37 +19,38 @@
*/
package cc.kune.core.server.rest;
-
import cc.kune.core.server.manager.GroupManager;
import cc.kune.core.server.manager.SearchResult;
import cc.kune.core.server.mapper.Mapper;
import cc.kune.core.server.rack.filters.rest.REST;
import cc.kune.core.shared.SearcherConstants;
-import cc.kune.core.shared.dto.LinkDTO;
+import cc.kune.core.shared.dto.GroupResultDTO;
import cc.kune.core.shared.dto.SearchResultDTO;
import cc.kune.domain.Group;
import com.google.inject.Inject;
public class GroupJSONService {
- private final GroupManager manager;
- private final Mapper mapper;
+ private final GroupManager manager;
+ private final Mapper mapper;
- @Inject
- public GroupJSONService(final GroupManager manager, final Mapper mapper) {
- this.manager = manager;
- this.mapper = mapper;
- }
+ @Inject
+ public GroupJSONService(final GroupManager manager, final Mapper mapper) {
+ this.manager = manager;
+ this.mapper = mapper;
+ }
- @REST(params = { SearcherConstants.QUERY_PARAM })
- public SearchResultDTO<LinkDTO> search(final String search) {
- return search(search, null, null);
- }
+ @REST(params = { SearcherConstants.QUERY_PARAM })
+ public SearchResultDTO<GroupResultDTO> search(final String search) {
+ return search(search, null, null);
+ }
- @REST(params = { SearcherConstants.QUERY_PARAM, SearcherConstants.START_PARAM, SearcherConstants.LIMIT_PARAM })
- public SearchResultDTO<LinkDTO> search(final String search, final Integer firstResult, final Integer maxResults) {
- SearchResult<Group> results = manager.search(search, firstResult, maxResults);
- return mapper.mapSearchResult(results, LinkDTO.class);
- }
+ @REST(params = { SearcherConstants.QUERY_PARAM, SearcherConstants.START_PARAM,
+ SearcherConstants.LIMIT_PARAM })
+ public SearchResultDTO<GroupResultDTO> search(final String search, final Integer firstResult,
+ final Integer maxResults) {
+ final SearchResult<Group> results = manager.search(search, firstResult, maxResults);
+ return mapper.mapSearchResult(results, GroupResultDTO.class);
+ }
}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/core/server/rest/UserJSONService.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rest/UserJSONService.java 2012-04-19 02:16:59 UTC (rev 1856)
+++ trunk/src/main/java/cc/kune/core/server/rest/UserJSONService.java 2012-04-19 04:37:12 UTC (rev 1857)
@@ -19,37 +19,38 @@
*/
package cc.kune.core.server.rest;
-
import cc.kune.core.server.manager.SearchResult;
import cc.kune.core.server.manager.UserManager;
import cc.kune.core.server.mapper.Mapper;
import cc.kune.core.server.rack.filters.rest.REST;
import cc.kune.core.shared.SearcherConstants;
-import cc.kune.core.shared.dto.LinkDTO;
+import cc.kune.core.shared.dto.GroupResultDTO;
import cc.kune.core.shared.dto.SearchResultDTO;
import cc.kune.domain.User;
import com.google.inject.Inject;
public class UserJSONService {
- private final UserManager manager;
- private final Mapper mapper;
+ private final UserManager manager;
+ private final Mapper mapper;
- @Inject
- public UserJSONService(final UserManager manager, final Mapper mapper) {
- this.manager = manager;
- this.mapper = mapper;
- }
+ @Inject
+ public UserJSONService(final UserManager manager, final Mapper mapper) {
+ this.manager = manager;
+ this.mapper = mapper;
+ }
- @REST(params = { SearcherConstants.QUERY_PARAM })
- public SearchResultDTO<LinkDTO> search(final String search) {
- return search(search, null, null);
- }
+ @REST(params = { SearcherConstants.QUERY_PARAM })
+ public SearchResultDTO<GroupResultDTO> search(final String search) {
+ return search(search, null, null);
+ }
- @REST(params = { SearcherConstants.QUERY_PARAM, SearcherConstants.START_PARAM, SearcherConstants.LIMIT_PARAM })
- public SearchResultDTO<LinkDTO> search(final String search, final Integer firstResult, final Integer maxResults) {
- SearchResult<User> results = manager.search(search, firstResult, maxResults);
- return mapper.mapSearchResult(results, LinkDTO.class);
- }
+ @REST(params = { SearcherConstants.QUERY_PARAM, SearcherConstants.START_PARAM,
+ SearcherConstants.LIMIT_PARAM })
+ public SearchResultDTO<GroupResultDTO> search(final String search, final Integer firstResult,
+ final Integer maxResults) {
+ final SearchResult<User> results = manager.search(search, firstResult, maxResults);
+ return mapper.mapSearchResult(results, GroupResultDTO.class);
+ }
}
\ No newline at end of file
Added: trunk/src/main/java/cc/kune/core/shared/dto/GroupResultDTO.java
===================================================================
--- trunk/src/main/java/cc/kune/core/shared/dto/GroupResultDTO.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/shared/dto/GroupResultDTO.java 2012-04-19 04:37:12 UTC (rev 1857)
@@ -0,0 +1,87 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.core.shared.dto;
+
+import com.google.gwt.user.client.rpc.IsSerializable;
+
+public class GroupResultDTO implements IsSerializable {
+ private GroupType groupType;
+ private String iconUrl;
+ private String link;
+ private String longName;
+ private String shortName;
+
+ public GroupResultDTO() {
+ this(null, null, null, null);
+ }
+
+ public GroupResultDTO(final String shortName, final String longName, final String iconUrl,
+ final String link) {
+ this.shortName = shortName;
+ this.longName = longName;
+ this.iconUrl = iconUrl;
+ this.link = link;
+ }
+
+ public GroupType getGroupType() {
+ return groupType;
+ }
+
+ public String getIconUrl() {
+ return iconUrl;
+ }
+
+ public String getLink() {
+ return link;
+ }
+
+ public String getLongName() {
+ return longName;
+ }
+
+ public String getShortName() {
+ return shortName;
+ }
+
+ public void setGroupType(final GroupType groupType) {
+ this.groupType = groupType;
+ }
+
+ public void setIconUrl(final String iconUrl) {
+ this.iconUrl = iconUrl;
+ }
+
+ public void setLink(final String link) {
+ this.link = link;
+ }
+
+ public void setLongName(final String longName) {
+ this.longName = longName;
+ }
+
+ public void setShortName(final String shortName) {
+ this.shortName = shortName;
+ }
+
+ @Override
+ public String toString() {
+ return "GroupResultDTO[" + getLink() + ": " + getLongName() + "]";
+ }
+}
Modified: trunk/src/main/resources/dozerBeanMapping.xml
===================================================================
--- trunk/src/main/resources/dozerBeanMapping.xml 2012-04-19 02:16:59 UTC (rev 1856)
+++ trunk/src/main/resources/dozerBeanMapping.xml 2012-04-19 04:37:12 UTC (rev 1857)
@@ -231,6 +231,14 @@
<b>name</b>
</field>
</mapping>
+ <mapping>
+ <class-a>cc.kune.core.shared.dto.GroupResultDTO</class-a>
+ <class-b>cc.kune.domain.User</class-b>
+ <field>
+ <a>longName</a>
+ <b>name</b>
+ </field>
+ </mapping>
<mapping>
<class-a> cc.kune.core.shared.dto.AccessRolDTO </class-a>
<class-b> cc.kune.core.shared.domain.AccessRol </class-b>
More information about the kune-commits
mailing list