summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSidharth Singh2013-04-29 03:26:27 (EDT)
committerStephan Born2013-04-29 03:26:27 (EDT)
commitcb3ebf279d000c481cf3cf2295b5712f1d2d8104 (patch)
tree4d2f495b027bdfdb436b46e6f156a4e3be30ac91
parent932cb1796bab0cbe8ade210ce25f1cd32cce73cf (diff)
downloadorg.eclipse.stardust.ui.web-cb3ebf279d000c481cf3cf2295b5712f1d2d8104.zip
org.eclipse.stardust.ui.web-cb3ebf279d000c481cf3cf2295b5712f1d2d8104.tar.gz
org.eclipse.stardust.ui.web-cb3ebf279d000c481cf3cf2295b5712f1d2d8104.tar.bz2
Jira-ID: CRNT-27602
Moved alternateFirstLetter(str) from ParticipantsDataProvider.java to UserUtils.java Used alternateFirstLetter to get alternate text for case-insensitive first letter search on User in UserUtils.java git-svn-id: https://svn.csa.sungard.com/repos/ipp2/product/trunk/stardust/ui.web@64554 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b Signed-off-by: Sidharth Singh <sidharth.singh@sungard.com>
-rw-r--r--views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/user/ParticipantsDataProvider.java23
-rw-r--r--views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/UserUtils.java25
2 files changed, 26 insertions, 22 deletions
diff --git a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/user/ParticipantsDataProvider.java b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/user/ParticipantsDataProvider.java
index 0c8906e..3282653 100644
--- a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/user/ParticipantsDataProvider.java
+++ b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/user/ParticipantsDataProvider.java
@@ -32,6 +32,7 @@ import org.eclipse.stardust.engine.api.runtime.QueryService;
import org.eclipse.stardust.ui.web.common.autocomplete.IAutocompleteDataProvider;
import org.eclipse.stardust.ui.web.viewscommon.common.configuration.UserPreferencesEntries;
import org.eclipse.stardust.ui.web.viewscommon.utils.ServiceFactoryUtils;
+import org.eclipse.stardust.ui.web.viewscommon.utils.UserUtils;
@@ -62,7 +63,7 @@ public class ParticipantsDataProvider implements IAutocompleteDataProvider
if (!StringUtils.isEmpty(searchValue))
{
String name = searchValue.replaceAll("\\*", "%") + "%";
- String nameFirstLetterCaseChanged = alternateFirstLetter(name);
+ String nameFirstLetterCaseChanged = UserUtils.alternateFirstLetter(name);
FilterOrTerm or = userQuery.getFilter().addOrTerm();
or.add(UserQuery.LAST_NAME.like(name));
or.add(UserQuery.LAST_NAME.like(nameFirstLetterCaseChanged));
@@ -172,24 +173,4 @@ public class ParticipantsDataProvider implements IAutocompleteDataProvider
return selectParticipants;
}
-
- /**
- * Changes the case of the initial letter of the given string.
- *
- * @param field
- * @return
- */
- private static String alternateFirstLetter(String field)
- {
- String firstLetter = field.substring(0, 1);
- if (firstLetter.compareTo(field.substring(0, 1).toLowerCase()) == 0)
- {
- firstLetter = firstLetter.toUpperCase();
- }
- else
- {
- firstLetter = firstLetter.toLowerCase();
- }
- return firstLetter + field.substring(1);
- }
}
diff --git a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/UserUtils.java b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/UserUtils.java
index aacf55d..df39c48 100644
--- a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/UserUtils.java
+++ b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/UserUtils.java
@@ -110,11 +110,14 @@ public class UserUtils
userQuery.setPolicy(userPolicy);
userQuery.setPolicy(new SubsetPolicy(maxMatches, false));
-
+ String nameFirstLetterCaseChanged = alternateFirstLetter(searchValue);
FilterOrTerm filter = userQuery.getFilter().addOrTerm();
filter.or(UserQuery.FIRST_NAME.like(searchValue));
+ filter.or(UserQuery.FIRST_NAME.like(nameFirstLetterCaseChanged));
filter.or(UserQuery.LAST_NAME.like(searchValue));
+ filter.or(UserQuery.LAST_NAME.like(nameFirstLetterCaseChanged));
filter.or(UserQuery.ACCOUNT.like(searchValue));
+ filter.or(UserQuery.ACCOUNT.like(nameFirstLetterCaseChanged));
userQuery.where(filter);
userQuery.orderBy(UserQuery.LAST_NAME).and(UserQuery.FIRST_NAME).and(
@@ -563,4 +566,24 @@ public class UserUtils
{
return SessionContext.findSessionContext().getUser().getRealm().getId();
}
+
+ /**
+ * Changes the case of the initial letter of the given string.
+ *
+ * @param field
+ * @return
+ */
+ public static String alternateFirstLetter(String field)
+ {
+ String firstLetter = field.substring(0, 1);
+ if (firstLetter.compareTo(field.substring(0, 1).toLowerCase()) == 0)
+ {
+ firstLetter = firstLetter.toUpperCase();
+ }
+ else
+ {
+ firstLetter = firstLetter.toLowerCase();
+ }
+ return firstLetter + field.substring(1);
+ }
}