[kune-commits] r1095 - in trunk/src:
main/java/org/ourproject/kune/platf/client/actions
main/java/org/ourproject/kune/platf/client/dto
main/java/org/ourproject/kune/platf/client/ui/rte/insertimg
main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia
main/java/org/ourproject/kune/platf/server/content
main/java/org/ourproject/kune/platf/server/domain
main/java/org/ourproject/kune/platf/server/manager/impl
main/java/org/ourproject/kune/platf/server/rest
main/java/org/ourproject/kune/workspace/client
main/java/org/ourproject/kune/workspace/client/search
test/java/org/ourproject/kune/platf/server/manager
vjrj
vjrj at ourproject.org
Sun Apr 19 20:47:39 CEST 2009
Author: vjrj
Date: 2009-04-19 20:47:36 +0200 (Sun, 19 Apr 2009)
New Revision: 1095
Modified:
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionRegistry.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/LinkDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/SearchResultDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogPanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/InsertMediaDialogPanel.java
trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManager.java
trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/domain/Container.java
trunk/src/main/java/org/ourproject/kune/platf/server/domain/Content.java
trunk/src/main/java/org/ourproject/kune/platf/server/domain/Rate.java
trunk/src/main/java/org/ourproject/kune/platf/server/domain/Tag.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/DefaultManager.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/I18nTranslationManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SearchResult.java
trunk/src/main/java/org/ourproject/kune/platf/server/rest/ContentJSONService.java
trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java
trunk/src/main/java/org/ourproject/kune/workspace/client/search/AbstractLiveSearcherField.java
trunk/src/test/java/org/ourproject/kune/platf/server/manager/ContentManagerTest.java
Log:
Incomplete - task Hibernate search improving
Complete - task Root folder actions not added
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionRegistry.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionRegistry.java 2009-04-18 16:33:27 UTC (rev 1094)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionRegistry.java 2009-04-19 18:47:36 UTC (rev 1095)
@@ -38,7 +38,7 @@
addAction(action, GENERIC);
}
- public void addAction(final ActionDescriptor<T> action, String... typeIds) {
+ public void addAction(final ActionDescriptor<T> action, final String... typeIds) {
assert (action != null);
for (final String typeId : typeIds) {
String text = action.getText();
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/LinkDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/LinkDTO.java 2009-04-18 16:33:27 UTC (rev 1094)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/LinkDTO.java 2009-04-19 18:47:36 UTC (rev 1095)
@@ -90,4 +90,8 @@
this.tags = tags;
}
+ @Override
+ public String toString() {
+ return "LinkDTO[(" + getLink() + "): " + getShortName() + "]";
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/SearchResultDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/SearchResultDTO.java 2009-04-18 16:33:27 UTC (rev 1094)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/SearchResultDTO.java 2009-04-19 18:47:36 UTC (rev 1095)
@@ -23,13 +23,13 @@
public class SearchResultDTO<T> {
List<T> list;
- Long size;
+ int size;
public SearchResultDTO() {
- this(null, null);
+ this(0, null);
}
- public SearchResultDTO(final Long size, final List<T> list) {
+ public SearchResultDTO(final int size, final List<T> list) {
this.list = list;
this.size = size;
}
@@ -38,16 +38,21 @@
return list;
}
+ public int getSize() {
+ return size;
+ }
+
public void setList(final List<T> list) {
this.list = list;
}
- public Long getSize() {
- return size;
+ public void setSize(final int size) {
+ this.size = size;
}
- public void setSize(final Long size) {
- this.size = size;
+ @Override
+ public String toString() {
+ return "SearchResultDTO[(" + size + "): " + list + "]";
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogPanel.java 2009-04-18 16:33:27 UTC (rev 1094)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogPanel.java 2009-04-19 18:47:36 UTC (rev 1095)
@@ -15,9 +15,9 @@
private static final String INSERT_IMG_DIALOG_ERROR_ID = "k-iip-err";
private final InsertImageGroup insertImageGroup;
- public InsertImageDialogPanel(final InsertImageDialogPresenter presenter, I18nTranslationService i18n,
- Images images, final InsertImageGroup insertImageGroup) {
- super(INSERT_IMG_DIALOG, i18n.t("Insert Image"), 380, HEIGHT + 100, 380, HEIGHT + 100, true, images,
+ public InsertImageDialogPanel(final InsertImageDialogPresenter presenter, final I18nTranslationService i18n,
+ final Images images, final InsertImageGroup insertImageGroup) {
+ super(INSERT_IMG_DIALOG, i18n.t("Insert Image"), 390, HEIGHT + 100, 390, HEIGHT + 100, true, images,
INSERT_IMG_DIALOG_ERROR_ID);
super.setIconCls("k-picture-icon");
this.insertImageGroup = insertImageGroup;
@@ -31,7 +31,7 @@
Button insert = new Button(i18n.t("Insert"));
insert.addListener(new ButtonListenerAdapter() {
@Override
- public void onClick(Button button, EventObject e) {
+ public void onClick(final Button button, final EventObject e) {
presenter.onInsert();
}
});
@@ -39,7 +39,7 @@
Button cancel = new Button(i18n.t("Cancel"));
cancel.addListener(new ButtonListenerAdapter() {
@Override
- public void onClick(Button button, EventObject e) {
+ public void onClick(final Button button, final EventObject e) {
presenter.onCancel();
}
});
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/InsertMediaDialogPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/InsertMediaDialogPanel.java 2009-04-18 16:33:27 UTC (rev 1094)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/InsertMediaDialogPanel.java 2009-04-19 18:47:36 UTC (rev 1095)
@@ -18,7 +18,7 @@
public InsertMediaDialogPanel(final InsertMediaDialogPresenter presenter, final I18nTranslationService i18n,
final Images images, final InsertMediaGroup insertMediaGroup) {
- super(INSERT_MEDIA_DIALOG, i18n.t("Insert Media (audio/video)"), 380, HEIGHT + 100, 380, HEIGHT + 100, true,
+ super(INSERT_MEDIA_DIALOG, i18n.t("Insert Media (audio/video)"), 390, HEIGHT + 100, 390, HEIGHT + 100, true,
images, INSERT_MEDIA_DIALOG_ERROR_ID);
super.setIconCls("k-film-icon");
this.insertMediaGroup = insertMediaGroup;
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManager.java 2009-04-18 16:33:27 UTC (rev 1094)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManager.java 2009-04-19 18:47:36 UTC (rev 1095)
@@ -40,10 +40,6 @@
"language.code", "language.englishName", "language.nativeName", "lastRevision.body", "lastRevision.title",
"mimeType.mimetype" };
- String[] DEF_GLOBAL_SEARCH_FIELDS_WITH_2MIME = new String[] { "authors.name", "authors.shortName",
- "container.name", "language.code", "language.englishName", "language.nativeName", "lastRevision.body",
- "lastRevision.title", "mimeType.mimetype", "mimeType.mimetype" };
-
String[] DEF_GROUP_SEARCH_FIELDS = new String[] { "container.owner.shortName", "authors.name", "authors.shortName",
"container.name", "language.code", "language.englishName", "language.nativeName", "lastRevision.body",
"lastRevision.title" };
@@ -78,9 +74,6 @@
SearchResult<Content> searchMime(String search, Integer firstResult, Integer maxResults, String mimetype);
- SearchResult<Content> searchMime(String search, Integer firstResult, Integer maxResults, String mimetype,
- String mimetype2);
-
I18nLanguage setLanguage(User user, Long contentId, String languageCode) throws DefaultException;
void setPublishedOn(User user, Long contentId, Date publishedOn) throws DefaultException;
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManagerDefault.java 2009-04-18 16:33:27 UTC (rev 1094)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManagerDefault.java 2009-04-19 18:47:36 UTC (rev 1095)
@@ -188,12 +188,6 @@
firstResult, maxResults);
}
- public SearchResult<Content> searchMime(final String search, final Integer firstResult, final Integer maxResults,
- final String mimetype, final String mimetype2) {
- return search(getSearchQueries(search, mimetype, mimetype2), DEF_GLOBAL_SEARCH_FIELDS_WITH_2MIME,
- getConditions2Mimes(), firstResult, maxResults);
- }
-
public I18nLanguage setLanguage(final User user, final Long contentId, final String languageCode)
throws DefaultException {
final Content content = finder.getContent(contentId);
@@ -233,27 +227,11 @@
tagManager.setTags(user, content, tags);
}
- private Occur[] createConditions(final String[] fields) {
- Occur[] conditions = new Occur[fields.length];
- for (int i = 0; i < conditions.length; i++) {
- conditions[i] = Occur.SHOULD;
- }
- return conditions;
- }
-
private MultiFieldQueryParser createParser() {
final MultiFieldQueryParser parser = new MultiFieldQueryParser(DEF_GLOBAL_SEARCH_FIELDS, new StandardAnalyzer());
return parser;
}
- private String[] createSearchQuery(final String search, final String[] fields) {
- String[] query = new String[fields.length];
- for (int i = 0; i < query.length; i++) {
- query[i] = search;
- }
- return query;
- }
-
private String findInexistentTitle(final Container container, final String title) {
String initialTitle = new String(title);
while (findIfExistsTitle(container, initialTitle)) {
@@ -264,32 +242,22 @@
private Occur[] getConditions() {
String[] fields = ContentManager.DEF_GLOBAL_SEARCH_FIELDS_WITH_MIME;
- Occur[] conditions = createConditions(fields);
+ Occur[] conditions = new Occur[fields.length];
+ for (int i = 0; i < conditions.length; i++) {
+ conditions[i] = Occur.SHOULD;
+ }
conditions[conditions.length - 1] = Occur.MUST;
return conditions;
}
- private Occur[] getConditions2Mimes() {
- String[] fields = ContentManager.DEF_GLOBAL_SEARCH_FIELDS_WITH_2MIME;
- Occur[] conditions = createConditions(fields);
- conditions[conditions.length - 2] = Occur.SHOULD;
- conditions[conditions.length - 1] = Occur.SHOULD;
- return conditions;
- }
-
private String[] getSearchQueries(final String search, final String mimetype) {
String[] fields = ContentManager.DEF_GLOBAL_SEARCH_FIELDS_WITH_MIME;
- String[] query = createSearchQuery(search, fields);
+ String[] query = new String[fields.length];
+ for (int i = 0; i < query.length; i++) {
+ query[i] = search;
+ }
query[query.length - 1] = mimetype;
return query;
}
- private String[] getSearchQueries(final String search, final String mimetype, final String mimetype2) {
- String[] fields = ContentManager.DEF_GLOBAL_SEARCH_FIELDS_WITH_2MIME;
- String[] query = createSearchQuery(search, fields);
- query[query.length - 2] = mimetype;
- query[query.length - 1] = mimetype2;
- return query;
- }
-
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/Container.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/Container.java 2009-04-18 16:33:27 UTC (rev 1094)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/Container.java 2009-04-19 18:47:36 UTC (rev 1095)
@@ -135,7 +135,7 @@
}
@Finder(query = "SELECT COUNT(*) FROM Container c WHERE c.parent = :container AND c.name LIKE :title")
- public Long findIfExistsTitle(@Named("container") Container container, @Named("title") String title) {
+ public Long findIfExistsTitle(@Named("container") final Container container, @Named("title") final String title) {
return null;
}
@@ -233,7 +233,7 @@
this.absolutePath = absolutePath;
}
- public void setAccessLists(AccessLists accessLists) {
+ public void setAccessLists(final AccessLists accessLists) {
this.accessLists = accessLists;
}
@@ -253,11 +253,11 @@
this.contents = contents;
}
- public void setCreatedOn(Long createdOn) {
+ public void setCreatedOn(final Long createdOn) {
this.createdOn = createdOn;
}
- public void setDeletedOn(Date deletedOn) {
+ public void setDeletedOn(final Date deletedOn) {
this.deletedOn = deletedOn;
}
@@ -288,4 +288,9 @@
public void setTypeId(final String typeId) {
this.typeId = typeId;
}
+
+ @Override
+ public String toString() {
+ return "Container[(" + getStateTokenEncoded() + "): " + getName() + "]";
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/Content.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/Content.java 2009-04-18 16:33:27 UTC (rev 1094)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/Content.java 2009-04-19 18:47:36 UTC (rev 1095)
@@ -328,4 +328,9 @@
this.version = version;
}
+ @Override
+ public String toString() {
+ return "Content[(" + getStateTokenEncoded() + "): " + getTitle() + "]";
+ }
+
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/Rate.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/Rate.java 2009-04-18 16:33:27 UTC (rev 1094)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/Rate.java 2009-04-19 18:47:36 UTC (rev 1095)
@@ -113,4 +113,8 @@
this.value = value;
}
+ @Override
+ public String toString() {
+ return "Rate[" + getRater() + " to " + content.getStateTokenEncoded() + "rated: " + getValue() + "]";
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/Tag.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/Tag.java 2009-04-18 16:33:27 UTC (rev 1094)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/Tag.java 2009-04-19 18:47:36 UTC (rev 1095)
@@ -86,4 +86,9 @@
this.name = name;
}
+ @Override
+ public String toString() {
+ return "Tag[" + getName() + "]";
+ }
+
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/DefaultManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/DefaultManager.java 2009-04-18 16:33:27 UTC (rev 1094)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/DefaultManager.java 2009-04-19 18:47:36 UTC (rev 1095)
@@ -91,7 +91,7 @@
emQuery.setFirstResult(firstResult);
emQuery.setMaxResults(maxResults);
}
- return new SearchResult<T>(new Long(emQuery.getResultSize()), emQuery.getResultList());
+ return new SearchResult<T>(emQuery.getResultSize(), emQuery.getResultList());
}
public SearchResult<T> search(final String query, final String[] fields, final BooleanClause.Occur[] flags,
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java 2009-04-18 16:33:27 UTC (rev 1094)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java 2009-04-19 18:47:36 UTC (rev 1095)
@@ -72,7 +72,7 @@
public GroupManagerDefault(final Provider<EntityManager> provider, final Group finder, final User userFinder,
final KuneProperties kuneProperties, final DatabaseProperties properties,
final ServerToolRegistry registry, final LicenseManager licenseManager, final License licenseFinder,
- ServerToolRegistry serverToolRegistry) {
+ final ServerToolRegistry serverToolRegistry) {
super(provider, Group.class);
this.finder = finder;
this.userFinder = userFinder;
@@ -84,7 +84,7 @@
this.serverToolRegistry = serverToolRegistry;
}
- public void changeDefLicense(User user, Group group, String licName) {
+ public void changeDefLicense(final User user, final Group group, final String licName) {
final License license = licenseFinder.findByShortName(licName);
if (license == null) {
throw new RuntimeException("Unknown license");
@@ -126,7 +126,7 @@
return createUserGroup(user, true);
}
- public Group createUserGroup(User user, boolean wantPersonalHomepage) throws GroupNameInUseException,
+ public Group createUserGroup(final User user, final boolean wantPersonalHomepage) throws GroupNameInUseException,
EmailAddressInUseException {
final String defaultSiteWorkspaceTheme = kuneProperties.get(KuneProperties.WS_THEMES_DEF);
final License licenseDef = licenseManager.getDefLicense();
@@ -167,7 +167,7 @@
return finder.findCollabInGroups(groupId);
}
- public List<String> findEnabledTools(Long id) {
+ public List<String> findEnabledTools(final Long id) {
return finder.findEnabledTools(id);
}
@@ -209,7 +209,8 @@
}
}
- public void setToolEnabled(User userLogged, String groupShortName, String tool, boolean enabled) {
+ public void setToolEnabled(final User userLogged, final String groupShortName, final String tool,
+ final boolean enabled) {
final Group group = findByShortName(groupShortName);
ToolConfiguration toolConfiguration = group.getToolConfiguration(tool);
if (toolConfiguration == null) {
@@ -218,7 +219,7 @@
toolConfiguration.setEnabled(enabled);
}
- private void initGroup(final User user, final Group group, Collection<String> toolsToEnable)
+ private void initGroup(final User user, final Group group, final Collection<String> toolsToEnable)
throws GroupNameInUseException {
try {
persist(group);
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/I18nTranslationManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/I18nTranslationManagerDefault.java 2009-04-18 16:33:27 UTC (rev 1094)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/I18nTranslationManagerDefault.java 2009-04-19 18:47:36 UTC (rev 1095)
@@ -20,7 +20,6 @@
package org.ourproject.kune.platf.server.manager.impl;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
@@ -72,7 +71,7 @@
final I18nLanguage language = languageManager.findByCode(languageCode);
final List<I18nTranslation> list = finder.getTranslatedLexicon(language, firstResult, maxResults);
final Long count = finder.getTranslatedLexiconCount(language);
- return new SearchResult<I18nTranslation>(count, list);
+ return new SearchResult<I18nTranslation>(count.intValue(), list);
}
public String getTranslation(final String language, final String text) {
@@ -117,7 +116,7 @@
final I18nLanguage language = initUnstranlated(languageCode);
final Long count = finder.getUnstranslatedLexiconCount(language);
final List<I18nTranslation> list = finder.getUnstranslatedLexicon(language, firstResult, maxResults);
- return new SearchResult<I18nTranslation>(count, list);
+ return new SearchResult<I18nTranslation>(count.intValue(), list);
}
public String setTranslation(final String id, final String translation) throws DefaultException {
@@ -150,8 +149,7 @@
if (!language.equals(I18nTranslation.DEFAULT_LANG)) {
map = (HashMap<String, String>) getLexicon(I18nTranslation.DEFAULT_LANG).clone();
}
- for (final Iterator<I18nTranslation> iterator = set.iterator(); iterator.hasNext();) {
- final I18nTranslation trans = iterator.next();
+ for (I18nTranslation trans : set) {
map.put(trans.getTrKey(), trans.getText());
}
langCache.put(language, map);
@@ -166,8 +164,7 @@
} else {
language = languageManager.findByCode(languageCode);
final List<I18nTranslation> list = finder.getNonExistentFromDefault(defLanguage, language);
- for (final Iterator<I18nTranslation> iterator = list.iterator(); iterator.hasNext();) {
- final I18nTranslation defTrans = iterator.next();
+ for (I18nTranslation defTrans : list) {
final I18nTranslation newTrans = defTrans.cloneForNewLanguage();
newTrans.setLanguage(language);
persist(newTrans);
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SearchResult.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SearchResult.java 2009-04-18 16:33:27 UTC (rev 1094)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SearchResult.java 2009-04-19 18:47:36 UTC (rev 1095)
@@ -23,13 +23,13 @@
public class SearchResult<T> {
List<T> list;
- Long size;
+ int size;
public SearchResult() {
- this(null, null);
+ this(0, null);
}
- public SearchResult(final Long count, final List<T> list) {
+ public SearchResult(final int count, final List<T> list) {
this.list = list;
this.size = count;
}
@@ -38,16 +38,25 @@
return list;
}
+ /**
+ * Gets the size of total results (may differ from list size).
+ *
+ * @return the size
+ */
+ public int getSize() {
+ return size;
+ }
+
public void setList(final List<T> list) {
this.list = list;
}
- public Long getSize() {
- return size;
+ public void setSize(final int size) {
+ this.size = size;
}
- public void setSize(final Long size) {
- this.size = size;
+ @Override
+ public String toString() {
+ return "SearchResult[(" + getSize() + "): " + list + "]";
}
-
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/rest/ContentJSONService.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/rest/ContentJSONService.java 2009-04-18 16:33:27 UTC (rev 1094)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/rest/ContentJSONService.java 2009-04-19 18:47:36 UTC (rev 1095)
@@ -54,9 +54,11 @@
public SearchResultDTO<LinkDTO> search(final String search, final Integer firstResult, final Integer maxResults) {
SearchResult<Content> results = contentManager.search(search, firstResult, maxResults);
SearchResult<Container> resultsContainer = containerManager.search(search, firstResult, maxResults);
- results.setSize(results.getSize() + resultsContainer.getSize());
- results.getList().addAll(results.getList());
- return map(results);
+ SearchResultDTO<LinkDTO> resultMapped = map(results);
+ SearchResultDTO<LinkDTO> containersMapped = map(resultsContainer);
+ resultMapped.getList().addAll(containersMapped.getList());
+ resultMapped.setSize(resultMapped.getSize() + containersMapped.getSize());
+ return resultMapped;
}
@REST(params = { SearcherContants.QUERY_PARAM, SearcherContants.START_PARAM, SearcherContants.LIMIT_PARAM,
@@ -71,11 +73,13 @@
SearcherContants.MIMETYPE_PARAM, SearcherContants.MIMETYPE2_PARAM })
public SearchResultDTO<LinkDTO> search(final String search, final Integer firstResult, final Integer maxResults,
final String mimetype, final String mimetype2) {
- SearchResult<Content> results = contentManager.searchMime(search, firstResult, maxResults, mimetype, mimetype2);
- return map(results);
+ SearchResult<Content> results1st = contentManager.searchMime(search, firstResult, maxResults, mimetype);
+ SearchResult<Content> results2nd = contentManager.searchMime(search, firstResult, maxResults, mimetype2);
+ results1st.getList().addAll(results2nd.getList());
+ return map(results1st);
}
- private SearchResultDTO<LinkDTO> map(final SearchResult<Content> results) {
+ private SearchResultDTO<LinkDTO> map(final SearchResult<?> results) {
return mapper.mapSearchResult(results, LinkDTO.class);
}
}
\ No newline at end of file
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java 2009-04-18 16:33:27 UTC (rev 1094)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java 2009-04-19 18:47:36 UTC (rev 1095)
@@ -338,7 +338,7 @@
final String textDescription, final String parentMenuTitle, final String parentMenuSubtitle,
final String defaultName, final Position position, final String... registerInTypes) {
final ActionToolbarMenuAndItemDescriptor<StateToken> addFolder;
- addFolder = new ActionToolbarMenuAndItemDescriptor<StateToken>(AccessRolDTO.Editor, CONTENT_TOPBAR,
+ addFolder = new ActionToolbarMenuAndItemDescriptor<StateToken>(AccessRolDTO.Editor, CONTEXT_TOPBAR,
new Listener<StateToken>() {
public void onEvent(final StateToken stateToken) {
NotifyUser.showProgressProcessing();
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/search/AbstractLiveSearcherField.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/search/AbstractLiveSearcherField.java 2009-04-18 16:33:27 UTC (rev 1094)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/search/AbstractLiveSearcherField.java 2009-04-19 18:47:36 UTC (rev 1095)
@@ -41,25 +41,27 @@
store = new Store(dataProxy, reader);
- store.load(new UrlParam[] { new UrlParam("query", "."), new UrlParam("first", 1),
- new UrlParam("max", PAGINATION_SIZE) });
+ store.load(new UrlParam[] { new UrlParam(SearcherContants.QUERY_PARAM, "."),
+ new UrlParam(SearcherContants.START_PARAM, 0),
+ new UrlParam(SearcherContants.LIMIT_PARAM, PAGINATION_SIZE) });
final Template resultTpl = new Template(templateText);
super.setStore(store);
super.setEmptyText(i18n.t("Write here to search"));
super.setDisplayField(LONG_NAME_FIELD);
- super.setTypeAhead(true);
+ super.setTypeAhead(false);
super.setLoadingText(i18n.t("Searching..."));
- super.setWidth(268);
+ super.setWidth(260);
super.setPageSize(PAGINATION_SIZE);
super.setTpl(resultTpl);
super.setMode(ComboBox.REMOTE);
super.setMinChars(2);
+ super.setResizable(true);
super.setSelectOnFocus(false);
super.setHideTrigger(true);
super.setHideLabel(true);
- // setTitle(i18n.t("User or group"));
super.setItemSelector("div.search-item");
+ super.setValidationEvent(false);
super.addListener(new ComboBoxListenerAdapter() {
@Override
Modified: trunk/src/test/java/org/ourproject/kune/platf/server/manager/ContentManagerTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/manager/ContentManagerTest.java 2009-04-18 16:33:27 UTC (rev 1094)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/manager/ContentManagerTest.java 2009-04-19 18:47:36 UTC (rev 1095)
@@ -20,7 +20,7 @@
createContent();
SearchResult<Content> search = contentManager.search(BODY);
contentManager.reIndex();
- assertEquals(new Long(1), search.getSize());
+ assertEquals(1, search.getSize());
}
@Test
@@ -41,7 +41,7 @@
contentManager.reIndex();
SearchResult<Content> search = contentManager.search(new String[] { MIMETYPE },
new String[] { "mimeType.mimetype" }, 0, 10);
- assertEquals(new Long(1), search.getSize());
+ assertEquals(1, search.getSize());
}
@Test
@@ -50,7 +50,7 @@
SearchResult<Content> search = contentManager.search(new String[] { BODY },
new String[] { "lastRevision.body" }, 0, 10);
contentManager.reIndex();
- assertEquals(new Long(1), search.getSize());
+ assertEquals(1, search.getSize());
}
@Test
@@ -58,7 +58,7 @@
createContent();
SearchResult<Content> search = contentManager.search(TITLE);
contentManager.reIndex();
- assertEquals(new Long(1), search.getSize());
+ assertEquals(1, search.getSize());
}
@Test
@@ -66,7 +66,7 @@
createContentWithMimeAndCheck(MIMETYPE + "/png");
contentManager.reIndex();
SearchResult<Content> search = contentManager.searchMime(BODY, 0, 10, MIMETYPE);
- assertEquals(new Long(1), search.getSize());
+ assertEquals(1, search.getSize());
}
/**
More information about the kune-commits
mailing list