Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Linnea Samila
/
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 52698f10
authored
May 17, 2014
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Associate user to only one place automatically.
Closes: #67
1 parent
89f18fc0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/PlaceBean.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/PlaceBean.java
View file @
52698f1
...
@@ -315,6 +315,10 @@ public class PlaceBean implements PlaceBeanLocal {
...
@@ -315,6 +315,10 @@ public class PlaceBean implements PlaceBeanLocal {
logger
.
info
(
"Associating buyer {} to place {}"
,
user
,
gm
);
logger
.
info
(
"Associating buyer {} to place {}"
,
user
,
gm
);
associatedToPlace
=
true
;
associatedToPlace
=
true
;
gm
.
setUser
(
user
);
gm
.
setUser
(
user
);
if
(
user
.
getGroupMemberships
()
==
null
)
{
user
.
setGroupMemberships
(
new
ArrayList
<
GroupMembership
>());
}
user
.
getGroupMemberships
().
add
(
gm
);
}
}
}
}
...
@@ -346,7 +350,9 @@ public class PlaceBean implements PlaceBeanLocal {
...
@@ -346,7 +350,9 @@ public class PlaceBean implements PlaceBeanLocal {
freePlace
=
new
Place
();
freePlace
=
new
Place
();
freePlace
.
setProduct
(
prod
);
freePlace
.
setProduct
(
prod
);
freePlace
.
setProvidesRole
(
prod
.
getProvides
());
freePlace
.
setProvidesRole
(
prod
.
getProvides
());
freePlace
.
setName
(
"-"
);
placeFacade
.
create
(
freePlace
);
placeFacade
.
create
(
freePlace
);
}
else
if
(
prod
.
getPlaces
()
!=
null
)
{
}
else
if
(
prod
.
getPlaces
()
!=
null
)
{
for
(
Place
p
:
prod
.
getPlaces
())
{
for
(
Place
p
:
prod
.
getPlaces
())
{
if
(!
p
.
isTaken
())
{
if
(!
p
.
isTaken
())
{
...
@@ -359,11 +365,16 @@ public class PlaceBean implements PlaceBeanLocal {
...
@@ -359,11 +365,16 @@ public class PlaceBean implements PlaceBeanLocal {
throw
new
EJBException
(
"Could find a place to be reserved...."
);
throw
new
EJBException
(
"Could find a place to be reserved...."
);
}
}
GroupMembership
gm
=
buy
(
freePlace
,
pg
);
GroupMembership
gm
=
buy
(
freePlace
,
pg
);
if
(!
associatedToPlace
)
if
(!
associatedToPlace
)
{
{
logger
.
info
(
"Associating buyer {} to place {}"
,
user
,
gm
);
logger
.
info
(
"Associating buyer {} to place {}"
,
user
,
gm
);
associatedToPlace
=
true
;
associatedToPlace
=
true
;
gm
.
setUser
(
user
);
gm
.
setUser
(
user
);
if
(
user
.
getGroupMemberships
()
==
null
)
{
user
.
setGroupMemberships
(
new
ArrayList
<
GroupMembership
>());
}
user
.
getGroupMemberships
().
add
(
gm
);
}
}
}
}
...
...
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