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 dd3cb56c
authored
Dec 22, 2012
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Paikan vapautus ei poistanut paikkaan liitettyä käyttäjää.
1 parent
ccab4169
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
16 deletions
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/PlaceBean.java
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/PlaceBeanLocal.java
code/MoyaDatabase/src/fi/codecrew/moya/model/GroupMembership.java
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/map/PlaceView.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/PlaceBean.java
View file @
dd3cb56
...
...
@@ -31,21 +31,14 @@ import javax.ejb.TimerService;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
fi.codecrew.moya.enums.apps.MapPermission
;
import
fi.codecrew.moya.enums.apps.SpecialPermission
;
import
fi.codecrew.moya.exceptions.BortalCatchableException
;
import
fi.codecrew.moya.facade.EventUserFacade
;
import
fi.codecrew.moya.facade.GroupMembershipFacade
;
import
fi.codecrew.moya.facade.PlaceFacade
;
import
fi.codecrew.moya.facade.PlaceGroupFacade
;
import
fi.codecrew.moya.facade.UserFacade
;
import
fi.codecrew.moya.beans.AccountEventBeanLocal
;
import
fi.codecrew.moya.beans.EventBeanLocal
;
import
fi.codecrew.moya.beans.LoggingBeanLocal
;
import
fi.codecrew.moya.beans.PermissionBeanLocal
;
import
fi.codecrew.moya.beans.PlaceBeanLocal
;
import
fi.codecrew.moya.beans.ProductBeanLocal
;
import
fi.codecrew.moya.beans.SecurityLogType
;
import
fi.codecrew.moya.enums.apps.MapPermission
;
import
fi.codecrew.moya.enums.apps.SpecialPermission
;
import
fi.codecrew.moya.exceptions.BortalCatchableException
;
import
fi.codecrew.moya.model.EventMap
;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.model.GroupMembership
;
...
...
@@ -488,12 +481,30 @@ public class PlaceBean implements PlaceBeanLocal {
@Override
@RolesAllowed
(
MapPermission
.
S_BUY_PLACES
)
public
void
unbuyPlace
(
Place
place
)
{
place
=
placeFacade
.
find
(
place
.
getId
()
);
public
Place
unbuyPlace
(
Place
place
)
{
place
=
placeFacade
.
reload
(
place
);
if
(
place
.
getGroup
()
!=
null
)
{
place
.
getGroup
().
getPlaces
().
remove
(
place
);
place
.
setGroup
(
null
);
}
}
if
(
place
.
getPlaceReserver
()
!=
null
)
{
GroupMembership
res
=
place
.
getPlaceReserver
();
if
(
res
.
getPlaceGroup
().
getMembers
()
!=
null
)
{
res
.
getPlaceGroup
().
getMembers
().
remove
(
res
);
}
if
(
res
.
getUser
()
!=
null
&&
res
.
getUser
().
getGroupMemberships
()
!=
null
)
{
res
.
getUser
().
getGroupMemberships
().
remove
(
res
);
}
place
.
setPlaceReserver
(
null
);
gmemfacade
.
remove
(
res
);
}
return
place
;
}
}
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/PlaceBeanLocal.java
View file @
dd3cb56
...
...
@@ -41,7 +41,7 @@ public interface PlaceBeanLocal {
Place
find
(
int
placeId
);
void
unbuyPlace
(
Place
place
);
Place
unbuyPlace
(
Place
place
);
BigDecimal
getTotalReservationPrice
(
EventUser
user
,
Place
newPlace
);
...
...
code/MoyaDatabase/src/fi/codecrew/moya/model/GroupMembership.java
View file @
dd3cb56
...
...
@@ -55,7 +55,7 @@ public class GroupMembership extends GenericEntity {
private
PlaceGroup
placeGroup
;
@OneToOne
(
optional
=
false
)
@JoinColumn
(
name
=
"place_reservation_id"
,
referencedColumnName
=
"id"
,
nullable
=
true
)
@JoinColumn
(
name
=
"place_reservation_id"
,
referencedColumnName
=
"id"
,
nullable
=
true
,
unique
=
true
)
private
Place
placeReservation
;
@JoinColumn
(
name
=
EVENTUSER_ID
,
referencedColumnName
=
EventUser
.
ID_COLUMN
)
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/map/PlaceView.java
View file @
dd3cb56
...
...
@@ -176,7 +176,7 @@ public class PlaceView extends GenericCDIView {
public
String
removePlaceFromGroup
()
{
placebean
.
unbuyPlace
(
place
);
place
=
place
bean
.
unbuyPlace
(
place
);
addFaceMessage
(
"place.unbought"
,
place
.
getName
());
return
null
;
...
...
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