Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Riina Antikainen
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 963e94b6
authored
Oct 30, 2011
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fiksattu vapaasanahaku käyttäjistä ja pollille menuitemi.
1 parent
9f7f691d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
44 additions
and
23 deletions
code/LanBortalBeans/.classpath
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/UserFacade.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/callbacks/StringSearchPredicateCreator.java
code/LanBortalBeansClient/.classpath
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n_fi.properties
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/menu/MenuView.java
code/LanBortalBeans/.classpath
View file @
963e94b
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpath>
<classpathentry
kind=
"src"
path=
"ejbModule"
/>
<classpathentry
kind=
"src"
path=
"ejbModule"
/>
<classpathentry
kind=
"con"
path=
"org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.
debug.ui.launcher.StandardVMType/JavaSE-
1.6"
>
<classpathentry
kind=
"con"
path=
"org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.
launching.macosx.MacOSXType/JVM
1.6"
>
<attributes>
<attributes>
<attribute
name=
"owner.project.facets"
value=
"java"
/>
<attribute
name=
"owner.project.facets"
value=
"java"
/>
</attributes>
</attributes>
...
...
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/UserFacade.java
View file @
963e94b
...
@@ -43,17 +43,24 @@ public class UserFacade extends GenericFacade<Integer, User> {
...
@@ -43,17 +43,24 @@ public class UserFacade extends GenericFacade<Integer, User> {
// }
// }
// }
// }
private
static
final
List
<
SingularAttribute
<
User
,
String
>>
SEARCHATTRS
;
private
static
List
<
SingularAttribute
<
User
,
String
>>
SEARCHATTRS
;
static
{
ArrayList
<
SingularAttribute
<
User
,
String
>>
buildAttrs
=
new
ArrayList
<
SingularAttribute
<
User
,
String
>>();
private
List
<
SingularAttribute
<
User
,
String
>>
getAttrlist
()
{
if
(
SEARCHATTRS
==
null
)
buildAttrs
.
add
(
User_
.
nick
);
{
buildAttrs
.
add
(
User_
.
login
);
ArrayList
<
SingularAttribute
<
User
,
String
>>
buildAttrs
=
new
ArrayList
<
SingularAttribute
<
User
,
String
>>();
buildAttrs
.
add
(
User_
.
firstnames
);
buildAttrs
.
add
(
User_
.
lastname
);
buildAttrs
.
add
(
User_
.
nick
);
buildAttrs
.
add
(
User_
.
email
);
buildAttrs
.
add
(
User_
.
login
);
buildAttrs
.
add
(
User_
.
phone
);
buildAttrs
.
add
(
User_
.
firstnames
);
SEARCHATTRS
=
Collections
.
unmodifiableList
(
buildAttrs
);
buildAttrs
.
add
(
User_
.
lastname
);
buildAttrs
.
add
(
User_
.
email
);
buildAttrs
.
add
(
User_
.
phone
);
logger
.
warn
(
"Initiating attrlist {}"
,
buildAttrs
);
SEARCHATTRS
=
Collections
.
unmodifiableList
(
buildAttrs
);
}
return
SEARCHATTRS
;
}
}
// final String[] NAMEFIELDS = { "nick", "login", "firstnames", "lastname",
// final String[] NAMEFIELDS = { "nick", "login", "firstnames", "lastname",
...
@@ -122,8 +129,15 @@ public class UserFacade extends GenericFacade<Integer, User> {
...
@@ -122,8 +129,15 @@ public class UserFacade extends GenericFacade<Integer, User> {
orderCall
=
new
OrderCallback
<
User
>(
false
,
sort
);
orderCall
=
new
OrderCallback
<
User
>(
false
,
sort
);
}
}
for
(
SingularAttribute
<
User
,
String
>
attr
:
getAttrlist
())
{
logger
.
info
(
"Looping attrs: {}"
,
attr
);
}
return
super
.
searcher
(
page
,
pagesize
,
return
super
.
searcher
(
page
,
pagesize
,
new
StringSearchPredicateCreator
<
User
>(
search
,
SEARCHATTRS
),
new
StringSearchPredicateCreator
<
User
>(
search
,
getAttrlist
()
),
orderCall
orderCall
);
);
...
...
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/callbacks/StringSearchPredicateCreator.java
View file @
963e94b
...
@@ -35,7 +35,7 @@ public class StringSearchPredicateCreator<T extends ModelInterface<?>> implement
...
@@ -35,7 +35,7 @@ public class StringSearchPredicateCreator<T extends ModelInterface<?>> implement
private
boolean
addSearch
(
String
search
)
{
private
boolean
addSearch
(
String
search
)
{
if
(
search
!=
null
)
{
if
(
search
!=
null
)
{
search
=
search
.
trim
();
search
=
search
.
trim
()
.
toLowerCase
()
;
if
(!
search
.
isEmpty
())
{
if
(!
search
.
isEmpty
())
{
searchstr
=
new
StringBuilder
().
append
(
WILDCARD
).
append
(
search
).
append
(
WILDCARD
).
toString
();
searchstr
=
new
StringBuilder
().
append
(
WILDCARD
).
append
(
search
).
append
(
WILDCARD
).
toString
();
return
true
;
return
true
;
...
@@ -50,13 +50,19 @@ public class StringSearchPredicateCreator<T extends ModelInterface<?>> implement
...
@@ -50,13 +50,19 @@ public class StringSearchPredicateCreator<T extends ModelInterface<?>> implement
if
(
searchstr
==
null
||
attributes
==
null
||
attributes
.
isEmpty
())
{
if
(
searchstr
==
null
||
attributes
==
null
||
attributes
.
isEmpty
())
{
return
;
return
;
}
}
Predicate
[]
preds
=
new
Predicate
[
attributes
.
size
()];
int
i
=
0
;
for
(
SingularAttribute
<
T
,
String
>
attr
:
attributes
)
{
logger
.
info
(
"Equalling {} to {}"
,
attr
.
getName
(),
searchstr
);
preds
[
i
++]
=
cb
.
like
(
root
.
get
(
attr
),
searchstr
);
for
(
String
splitSearch
:
searchstr
.
split
(
" "
))
{
splitSearch
=
new
StringBuilder
().
append
(
WILDCARD
).
append
(
splitSearch
.
trim
()).
append
(
WILDCARD
).
toString
();
Predicate
[]
preds
=
new
Predicate
[
attributes
.
size
()];
int
i
=
0
;
for
(
SingularAttribute
<
T
,
String
>
attr
:
attributes
)
{
logger
.
info
(
"Equalling {} to {}"
,
attr
.
getName
(),
splitSearch
);
preds
[
i
++]
=
cb
.
like
(
cb
.
lower
(
root
.
get
(
attr
)),
splitSearch
);
}
predicates
.
add
(
cb
.
or
(
preds
));
}
}
predicates
.
add
(
cb
.
or
(
preds
));
}
}
}
}
code/LanBortalBeansClient/.classpath
View file @
963e94b
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
<classpathentry
kind=
"src"
path=
"/LanBortalDatabase"
/>
<classpathentry
kind=
"src"
path=
"/LanBortalDatabase"
/>
<classpathentry
kind=
"src"
path=
"/LanBortalUtilities"
/>
<classpathentry
kind=
"src"
path=
"/LanBortalUtilities"
/>
<classpathentry
kind=
"src"
path=
"/LanBortalAuthModuleClient"
/>
<classpathentry
kind=
"src"
path=
"/LanBortalAuthModuleClient"
/>
<classpathentry
kind=
"con"
path=
"org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/J
ava SE 6 (MacOS X Default)
"
>
<classpathentry
kind=
"con"
path=
"org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/J
VM 1.6
"
>
<attributes>
<attributes>
<attribute
name=
"owner.project.facets"
value=
"java"
/>
<attribute
name=
"owner.project.facets"
value=
"java"
/>
</attributes>
</attributes>
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n_fi.properties
View file @
963e94b
...
@@ -235,6 +235,7 @@ sidebar.utils.flushCache=Flush Cache
...
@@ -235,6 +235,7 @@ sidebar.utils.flushCache=Flush Cache
sidebar.utils.testdata
=
Testdata
sidebar.utils.testdata
=
Testdata
topmenu.adminfront
=
Admintavaraa
topmenu.adminfront
=
Admintavaraa
menu.poll.index
=
Kyselyt
menu.index
=
Etusivu
menu.index
=
Etusivu
menu.user.edit
=
Omat tiedot
menu.user.edit
=
Omat tiedot
menu.place.placemap
=
Paikkakartta
menu.place.placemap
=
Paikkakartta
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/menu/MenuView.java
View file @
963e94b
...
@@ -78,7 +78,7 @@ public class MenuView {
...
@@ -78,7 +78,7 @@ public class MenuView {
MenuGroup
shop
=
new
MenuGroup
(
"shop"
);
MenuGroup
shop
=
new
MenuGroup
(
"shop"
);
MenuGroup
poll
=
new
MenuGroup
(
"poll"
);
MenuGroup
poll
=
new
MenuGroup
(
"poll"
);
PAGEGROUPS
=
Collections
.
unmodifiableList
(
Arrays
.
asList
(
frontpage
,
user
,
placemap
,
shop
));
PAGEGROUPS
=
Collections
.
unmodifiableList
(
Arrays
.
asList
(
frontpage
,
user
,
placemap
,
shop
,
poll
));
addPage
(
temppages
,
"/index"
,
frontpage
,
UserPermission
.
ANYUSER
);
addPage
(
temppages
,
"/index"
,
frontpage
,
UserPermission
.
ANYUSER
);
addPage
(
temppages
,
"/user/create"
,
frontpage
,
UserPermission
.
CREATE_NEW
);
addPage
(
temppages
,
"/user/create"
,
frontpage
,
UserPermission
.
CREATE_NEW
);
...
@@ -104,7 +104,7 @@ public class MenuView {
...
@@ -104,7 +104,7 @@ public class MenuView {
addPage
(
temppages
,
"/shop/createBill"
,
shop
,
BillPermission
.
CREATE_BILL
);
addPage
(
temppages
,
"/shop/createBill"
,
shop
,
BillPermission
.
CREATE_BILL
);
addPage
(
temppages
,
"/bill/list"
,
shop
,
BillPermission
.
VIEW_OWN
);
addPage
(
temppages
,
"/bill/list"
,
shop
,
BillPermission
.
VIEW_OWN
);
addPage
(
temppages
,
"/poll/
"
,
shop
,
PollPermission
.
ANSWER
);
addPage
(
temppages
,
"/poll/
index"
,
poll
,
PollPermission
.
ANSWER
);
PAGES
=
Collections
.
unmodifiableMap
(
temppages
);
PAGES
=
Collections
.
unmodifiableMap
(
temppages
);
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment