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 b48c82c4
authored
Mar 01, 2014
by
Tuukka Kivilahti
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of codecrew.fi:codecrew/moya
2 parents
5788d745
d51cb4ad
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
585 additions
and
11 deletions
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/EventMapBean.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/ProductBean.java
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/EventMapBeanLocal.java
code/MoyaWeb/src/fi/codecrew/moya/rest/AccountEventRestView.java
code/MoyaWeb/src/fi/codecrew/moya/rest/MapAdminView.java
code/MoyaWeb/src/fi/codecrew/moya/rest/MapRestView.java
code/MoyaWeb/src/fi/codecrew/moya/rest/PrinterRestView.java
code/MoyaWeb/src/fi/codecrew/moya/rest/ReaderRestView.java
code/MoyaWeb/src/fi/codecrew/moya/rest/UserRestView.java
code/MoyaWeb/src/fi/codecrew/moya/rest/pojo/MapPojo.java
code/MoyaWeb/src/fi/codecrew/moya/rest/pojo/MapRoot.java
code/MoyaWeb/src/fi/codecrew/moya/rest/pojo/PlaceInputPojo.java
code/MoyaWeb/src/fi/codecrew/moya/rest/pojo/PlaceOutPojo.java
code/MoyaWeb/src/fi/codecrew/moya/rest/pojo/PlaceRoot.java
code/MoyaWeb/src/fi/codecrew/moya/rest/pojo/SimpleEventuserRoot.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/EventMapBean.java
View file @
b48c82c
...
@@ -3,18 +3,19 @@ package fi.codecrew.moya.beans;
...
@@ -3,18 +3,19 @@ package fi.codecrew.moya.beans;
import
javax.annotation.security.DeclareRoles
;
import
javax.annotation.security.DeclareRoles
;
import
javax.annotation.security.RolesAllowed
;
import
javax.annotation.security.RolesAllowed
;
import
javax.ejb.EJB
;
import
javax.ejb.EJB
;
import
javax.ejb.EJBAccessException
;
import
javax.ejb.Stateless
;
import
javax.ejb.Stateless
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
fi.codecrew.moya.enums.apps.MapPermission
;
import
fi.codecrew.moya.facade.EventFacade
;
import
fi.codecrew.moya.facade.EventFacade
;
import
fi.codecrew.moya.facade.EventMapFacade
;
import
fi.codecrew.moya.facade.EventMapFacade
;
import
fi.codecrew.moya.beans.EventBeanLocal
;
import
fi.codecrew.moya.facade.PlaceFacade
;
import
fi.codecrew.moya.beans.EventMapBeanLocal
;
import
fi.codecrew.moya.enums.apps.MapPermission
;
import
fi.codecrew.moya.model.EventMap
;
import
fi.codecrew.moya.model.EventMap
;
import
fi.codecrew.moya.model.LanEvent
;
import
fi.codecrew.moya.model.LanEvent
;
import
fi.codecrew.moya.model.Place
;
/**
/**
* Session Bean implementation class EventMapBean
* Session Bean implementation class EventMapBean
...
@@ -31,6 +32,9 @@ public class EventMapBean implements EventMapBeanLocal {
...
@@ -31,6 +32,9 @@ public class EventMapBean implements EventMapBeanLocal {
@EJB
@EJB
private
EventFacade
eventfacade
;
private
EventFacade
eventfacade
;
@EJB
private
PlaceFacade
placefacade
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
EventMapBean
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
EventMapBean
.
class
);
@Override
@Override
...
@@ -78,4 +82,31 @@ public class EventMapBean implements EventMapBeanLocal {
...
@@ -78,4 +82,31 @@ public class EventMapBean implements EventMapBeanLocal {
return
leMap
;
return
leMap
;
}
}
@Override
@RolesAllowed
(
MapPermission
.
S_MANAGE_MAPS
)
public
void
deletePlace
(
Place
place
)
{
place
=
placefacade
.
reload
(
place
);
LanEvent
currentEvent
=
eventbean
.
getCurrentEvent
();
if
(!
currentEvent
.
equals
(
place
.
getMap
().
getEvent
()))
{
throw
new
EJBAccessException
(
"Deleting placce for wrong event!"
);
}
}
@Override
@RolesAllowed
(
MapPermission
.
S_MANAGE_MAPS
)
public
Place
findPlace
(
Integer
id
)
{
Place
place
=
placefacade
.
find
(
id
);
LanEvent
currentEvent
=
eventbean
.
getCurrentEvent
();
if
(!
currentEvent
.
equals
(
place
.
getMap
().
getEvent
()))
{
throw
new
EJBAccessException
(
"Fetcing place for wrong event!"
);
}
return
place
;
}
@Override
@RolesAllowed
(
MapPermission
.
S_MANAGE_MAPS
)
public
Place
updatePlace
(
Place
place
)
{
return
placefacade
.
merge
(
place
);
}
}
}
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/ProductBean.java
View file @
b48c82c
...
@@ -91,7 +91,7 @@ public class ProductBean implements ProductBeanLocal {
...
@@ -91,7 +91,7 @@ public class ProductBean implements ProductBeanLocal {
private
EventBeanLocal
eventbean
;
private
EventBeanLocal
eventbean
;
@EJB
@EJB
private
BillLineFacade
billLineFacade
;
private
BillLineFacade
billLineFacade
;
@EJB
@EJB
private
ProductPBean
productPBean
;
private
ProductPBean
productPBean
;
...
@@ -100,7 +100,7 @@ public class ProductBean implements ProductBeanLocal {
...
@@ -100,7 +100,7 @@ public class ProductBean implements ProductBeanLocal {
@EJB
@EJB
private
PlaceBean
placebean
;
private
PlaceBean
placebean
;
@EJB
@EJB
private
DiscountBean
discountBean
;
private
DiscountBean
discountBean
;
...
@@ -174,7 +174,6 @@ public class ProductBean implements ProductBeanLocal {
...
@@ -174,7 +174,6 @@ public class ProductBean implements ProductBeanLocal {
ret
.
put
(
prod
.
getId
(),
lim
);
ret
.
put
(
prod
.
getId
(),
lim
);
// logger.info("Added product limit {} to {}", lim, prod);
// logger.info("Added product limit {} to {}", lim, prod);
}
}
System
.
out
.
println
(
ret
);
return
ret
;
return
ret
;
}
}
...
...
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/EventMapBeanLocal.java
View file @
b48c82c
...
@@ -3,6 +3,7 @@ package fi.codecrew.moya.beans;
...
@@ -3,6 +3,7 @@ package fi.codecrew.moya.beans;
import
javax.ejb.Local
;
import
javax.ejb.Local
;
import
fi.codecrew.moya.model.EventMap
;
import
fi.codecrew.moya.model.EventMap
;
import
fi.codecrew.moya.model.Place
;
@Local
@Local
public
interface
EventMapBeanLocal
{
public
interface
EventMapBeanLocal
{
...
@@ -17,4 +18,10 @@ public interface EventMapBeanLocal {
...
@@ -17,4 +18,10 @@ public interface EventMapBeanLocal {
EventMap
clearPlaces
(
EventMap
map
);
EventMap
clearPlaces
(
EventMap
map
);
void
deletePlace
(
Place
place
);
Place
findPlace
(
Integer
id
);
Place
updatePlace
(
Place
place
);
}
}
code/MoyaWeb/src/fi/codecrew/moya/rest/AccountEventRestView.java
View file @
b48c82c
...
@@ -36,7 +36,7 @@ public class AccountEventRestView {
...
@@ -36,7 +36,7 @@ public class AccountEventRestView {
private
ProductBeanLocal
productBean
;
private
ProductBeanLocal
productBean
;
@GET
@GET
@Produces
({
MediaType
.
APPLICATION_JSON
})
@Produces
({
MediaType
.
APPLICATION_JSON
+
"; charset=UTF-8"
})
@Path
(
"/boughtTimecount/{productId}"
)
@Path
(
"/boughtTimecount/{productId}"
)
public
ArrayList
<
HcSeriesRoot
>
boughtTimecount
(
@PathParam
(
"productId"
)
Integer
productId
)
{
public
ArrayList
<
HcSeriesRoot
>
boughtTimecount
(
@PathParam
(
"productId"
)
Integer
productId
)
{
...
...
code/MoyaWeb/src/fi/codecrew/moya/rest/MapAdminView.java
0 → 100644
View file @
b48c82c
package
fi
.
codecrew
.
moya
.
rest
;
import
java.io.ByteArrayInputStream
;
import
javax.ejb.EJB
;
import
javax.enterprise.context.RequestScoped
;
import
javax.ws.rs.Consumes
;
import
javax.ws.rs.DELETE
;
import
javax.ws.rs.GET
;
import
javax.ws.rs.POST
;
import
javax.ws.rs.PUT
;
import
javax.ws.rs.Path
;
import
javax.ws.rs.PathParam
;
import
javax.ws.rs.Produces
;
import
javax.ws.rs.core.MediaType
;
import
javax.ws.rs.core.Response
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
fi.codecrew.moya.beans.EventBeanLocal
;
import
fi.codecrew.moya.beans.EventMapBeanLocal
;
import
fi.codecrew.moya.beans.PlaceGroupBeanLocal
;
import
fi.codecrew.moya.beans.PlaceMapBeanLocal
;
import
fi.codecrew.moya.beans.ProductBeanLocal
;
import
fi.codecrew.moya.model.EventMap
;
import
fi.codecrew.moya.model.Place
;
import
fi.codecrew.moya.model.Product
;
import
fi.codecrew.moya.rest.pojo.MapRoot
;
import
fi.codecrew.moya.rest.pojo.PlaceInputPojo
;
import
fi.codecrew.moya.rest.pojo.PlaceOutPojo
;
import
fi.codecrew.moya.rest.pojo.PlaceRoot
;
@RequestScoped
@Path
(
"/placeadmin"
)
@Consumes
({
MediaType
.
APPLICATION_JSON
,
MediaType
.
APPLICATION_XML
})
@Produces
({
MediaType
.
APPLICATION_JSON
})
public
class
MapAdminView
{
@EJB
private
EventMapBeanLocal
eventmapbean
;
@EJB
private
PlaceMapBeanLocal
placemapbean
;
@EJB
private
PlaceGroupBeanLocal
pgbean
;
@EJB
private
EventBeanLocal
eventbean
;
@EJB
private
ProductBeanLocal
productbean
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
MapAdminView
.
class
);
@GET
@Path
(
"/background/{mapId}"
)
public
Response
getMapBg
(
@PathParam
(
"mapId"
)
Integer
mapid
)
{
EventMap
map
=
placemapbean
.
findMap
(
mapid
);
ByteArrayInputStream
istream
=
new
ByteArrayInputStream
(
map
.
getMapData
());
return
Response
.
ok
().
entity
(
istream
).
type
(
"image/jpeg"
).
build
();
}
@GET
@Path
(
"/maps"
)
public
MapRoot
getAllMaps
()
{
MapRoot
ret
=
MapRoot
.
parseMaps
(
eventbean
.
getCurrentEvent
().
getEventMaps
());
logger
.
info
(
"getallmaps called! {}"
,
ret
);
return
ret
;
}
@GET
@Path
(
"/places/{mapId}"
)
public
PlaceRoot
getPlaces
(
@PathParam
(
"mapId"
)
Integer
mapid
)
{
EventMap
map
=
placemapbean
.
findMap
(
mapid
);
PlaceRoot
ret
=
new
PlaceRoot
(
map
);
logger
.
info
(
"returning map {} entity {}"
,
mapid
,
ret
);
return
ret
;
}
@DELETE
@Path
(
"/place/{id}"
)
public
Response
deletePlace
(
@PathParam
(
"id"
)
Integer
id
)
{
Place
place
=
eventmapbean
.
findPlace
(
id
);
eventmapbean
.
deletePlace
(
place
);
return
Response
.
ok
().
build
();
}
@POST
@Path
(
"/place/"
)
public
Response
createPlace
(
PlaceInputPojo
create
)
{
EventMap
map
=
eventmapbean
.
find
(
create
.
getMapId
());
if
(
map
==
null
)
{
return
Response
.
serverError
().
entity
(
"Error with mapId"
).
build
();
}
Place
place
=
new
Place
();
place
.
setMap
(
map
);
setPlaceValues
(
place
,
create
);
if
(
create
.
getProductId
()
!=
null
&&
(
place
.
getProduct
()
==
null
||
!
place
.
getProduct
().
getId
().
equals
(
create
.
getProductId
())))
return
Response
.
serverError
().
entity
(
"Product id unknown!"
).
build
();
return
Response
.
ok
().
entity
(
new
PlaceOutPojo
(
place
)).
build
();
}
@PUT
@Path
(
"/place/{id}"
)
public
Response
updatePlace
(
@PathParam
(
"id"
)
Integer
id
,
PlaceInputPojo
update
)
{
if
(
update
==
null
||
id
==
null
)
{
return
Response
.
serverError
().
entity
(
"'id' field is required!"
).
build
();
}
Place
place
=
eventmapbean
.
findPlace
(
id
);
if
(
place
==
null
)
{
return
Response
.
serverError
().
entity
(
"place not found with id: "
+
id
).
build
();
}
setPlaceValues
(
place
,
update
);
if
(
update
.
getProductId
()
!=
null
&&
(
place
.
getProduct
()
==
null
||
!
place
.
getProduct
().
getId
().
equals
(
update
.
getProductId
())))
return
Response
.
serverError
().
entity
(
"Product id unknown!"
).
build
();
place
=
eventmapbean
.
updatePlace
(
place
);
return
Response
.
ok
(
new
PlaceOutPojo
(
place
)).
build
();
}
private
void
setPlaceValues
(
Place
place
,
PlaceInputPojo
update
)
{
if
(
update
.
getName
()
!=
null
)
place
.
setName
(
update
.
getName
());
if
(
update
.
getMapX
()
!=
null
)
place
.
setMapX
(
update
.
getMapX
());
if
(
update
.
getMapY
()
!=
null
)
place
.
setMapY
(
update
.
getMapY
());
if
(
update
.
getWidth
()
!=
null
)
place
.
setWidth
(
update
.
getWidth
());
if
(
update
.
getHeight
()
!=
null
)
place
.
setHeight
(
update
.
getHeight
());
if
(
update
.
getBuyable
()
!=
null
)
place
.
setBuyable
(
update
.
getBuyable
());
if
(
update
.
getDisabled
()
!=
null
)
place
.
setDisabled
(
update
.
getDisabled
());
if
(
update
.
getProductId
()
!=
null
)
{
Product
product
=
productbean
.
findById
(
update
.
getProductId
());
if
(
product
!=
null
)
{
place
.
setProduct
(
product
);
}
}
}
}
code/MoyaWeb/src/fi/codecrew/moya/rest/MapRestView.java
View file @
b48c82c
...
@@ -22,7 +22,7 @@ import fi.codecrew.moya.model.PlaceGroup;
...
@@ -22,7 +22,7 @@ import fi.codecrew.moya.model.PlaceGroup;
@RequestScoped
@RequestScoped
@Path
(
"/map"
)
@Path
(
"/map"
)
@Consumes
({
MediaType
.
APPLICATION_JSON
,
MediaType
.
APPLICATION_XML
})
@Consumes
({
MediaType
.
APPLICATION_JSON
,
MediaType
.
APPLICATION_XML
})
@Produces
({
MediaType
.
APPLICATION_JSON
})
@Produces
({
MediaType
.
APPLICATION_JSON
+
"; charset=UTF-8"
})
public
class
MapRestView
{
public
class
MapRestView
{
@EJB
@EJB
...
@@ -32,7 +32,6 @@ public class MapRestView {
...
@@ -32,7 +32,6 @@ public class MapRestView {
@GET
@GET
@Path
(
"/dateJson"
)
@Path
(
"/dateJson"
)
@Produces
(
"text/javascript"
)
public
String
getAllCards
()
{
public
String
getAllCards
()
{
EventMap
map
=
placemapbean
.
getActiveMap
();
EventMap
map
=
placemapbean
.
getActiveMap
();
...
...
code/MoyaWeb/src/fi/codecrew/moya/rest/PrinterRestView.java
View file @
b48c82c
...
@@ -26,7 +26,7 @@ import fi.codecrew.moya.rest.pojo.PrintedCardRestPojo;
...
@@ -26,7 +26,7 @@ import fi.codecrew.moya.rest.pojo.PrintedCardRestPojo;
@RequestScoped
@RequestScoped
@Path
(
"/card"
)
@Path
(
"/card"
)
@Consumes
({
MediaType
.
APPLICATION_JSON
,
MediaType
.
APPLICATION_XML
})
@Consumes
({
MediaType
.
APPLICATION_JSON
,
MediaType
.
APPLICATION_XML
})
@Produces
({
MediaType
.
APPLICATION_JSON
})
@Produces
({
MediaType
.
APPLICATION_JSON
+
"; charset=UTF-8"
})
public
class
PrinterRestView
{
public
class
PrinterRestView
{
@EJB
@EJB
...
...
code/MoyaWeb/src/fi/codecrew/moya/rest/ReaderRestView.java
View file @
b48c82c
...
@@ -26,7 +26,7 @@ import fi.codecrew.moya.rest.pojo.UserPermissionRestPojo;
...
@@ -26,7 +26,7 @@ import fi.codecrew.moya.rest.pojo.UserPermissionRestPojo;
@RequestScoped
@RequestScoped
@Path
(
"/reader"
)
@Path
(
"/reader"
)
@Consumes
({
MediaType
.
APPLICATION_JSON
,
MediaType
.
APPLICATION_XML
})
@Consumes
({
MediaType
.
APPLICATION_JSON
,
MediaType
.
APPLICATION_XML
})
@Produces
({
MediaType
.
APPLICATION_JSON
})
@Produces
({
MediaType
.
APPLICATION_JSON
+
"; charset=UTF-8"
})
public
class
ReaderRestView
{
public
class
ReaderRestView
{
@EJB
@EJB
...
@@ -55,6 +55,7 @@ public class ReaderRestView {
...
@@ -55,6 +55,7 @@ public class ReaderRestView {
//
//
// }
// }
// TBD: WTF! - Tarttis varmaan käydä ajatuksella läpi.. - Tuomari 2014-02-28
@GET
@GET
@Path
(
"/EventRole/{reader}/{tagId}/{roleid}"
)
@Path
(
"/EventRole/{reader}/{tagId}/{roleid}"
)
public
Response
eventRole
(
@PathParam
(
"reader"
)
String
reader
,
@PathParam
(
"tagId"
)
String
tag
,
@PathParam
(
"roleid"
)
Integer
roleId
)
{
public
Response
eventRole
(
@PathParam
(
"reader"
)
String
reader
,
@PathParam
(
"tagId"
)
String
tag
,
@PathParam
(
"roleid"
)
Integer
roleId
)
{
...
...
code/MoyaWeb/src/fi/codecrew/moya/rest/UserRestView.java
0 → 100644
View file @
b48c82c
package
fi
.
codecrew
.
moya
.
rest
;
import
javax.ejb.EJB
;
import
javax.enterprise.context.RequestScoped
;
import
javax.ws.rs.Consumes
;
import
javax.ws.rs.GET
;
import
javax.ws.rs.Path
;
import
javax.ws.rs.Produces
;
import
javax.ws.rs.core.MediaType
;
import
fi.codecrew.moya.beans.UserBeanLocal
;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.rest.pojo.SimpleEventuserRoot
;
import
fi.codecrew.moya.util.UserSearchQuery
;
import
fi.codecrew.moya.utilities.SearchResult
;
@RequestScoped
@Path
(
"/user"
)
@Consumes
({
MediaType
.
APPLICATION_JSON
,
MediaType
.
APPLICATION_XML
})
@Produces
({
MediaType
.
APPLICATION_JSON
+
"; charset=UTF-8"
})
public
class
UserRestView
{
@EJB
private
UserBeanLocal
userbean
;
@GET
@Path
(
"/eventusers"
)
public
SimpleEventuserRoot
getEventUsers
()
{
UserSearchQuery
q
=
new
UserSearchQuery
();
q
.
setPagesize
(
0
);
SearchResult
<
EventUser
>
users
=
userbean
.
getThisEventsUsers
(
q
);
return
SimpleEventuserRoot
.
parse
(
users
.
getResults
());
}
}
code/MoyaWeb/src/fi/codecrew/moya/rest/pojo/MapPojo.java
0 → 100644
View file @
b48c82c
package
fi
.
codecrew
.
moya
.
rest
.
pojo
;
code/MoyaWeb/src/fi/codecrew/moya/rest/pojo/MapRoot.java
0 → 100644
View file @
b48c82c
package
fi
.
codecrew
.
moya
.
rest
.
pojo
;
import
java.util.ArrayList
;
import
java.util.List
;
import
javax.xml.bind.annotation.XmlElement
;
import
javax.xml.bind.annotation.XmlRootElement
;
import
fi.codecrew.moya.model.EventMap
;
@XmlRootElement
public
class
MapRoot
{
private
List
<
MapPojo
>
maps
;
public
MapRoot
()
{
}
public
MapRoot
(
List
<
MapPojo
>
ret
)
{
this
.
setMaps
(
ret
);
}
public
List
<
MapPojo
>
getMaps
()
{
return
maps
;
}
public
void
setMaps
(
List
<
MapPojo
>
maps
)
{
this
.
maps
=
maps
;
}
public
static
class
MapPojo
{
private
EventMap
map
;
public
MapPojo
()
{
super
();
}
public
MapPojo
(
EventMap
m
)
{
this
();
this
.
map
=
m
;
}
@XmlElement
(
name
=
"name"
)
public
String
getName
()
{
return
map
.
getName
();
}
@XmlElement
(
name
=
"id"
)
public
Integer
getId
()
{
return
map
.
getId
();
}
}
public
static
MapRoot
parseMaps
(
List
<
EventMap
>
eventMaps
)
{
List
<
MapPojo
>
ret
=
new
ArrayList
<>();
for
(
EventMap
m
:
eventMaps
)
{
ret
.
add
(
new
MapPojo
(
m
));
}
return
new
MapRoot
(
ret
);
}
}
code/MoyaWeb/src/fi/codecrew/moya/rest/pojo/PlaceInputPojo.java
0 → 100644
View file @
b48c82c
package
fi
.
codecrew
.
moya
.
rest
.
pojo
;
public
class
PlaceInputPojo
{
private
String
name
;
private
Integer
mapX
;
private
Integer
mapY
;
private
Integer
width
;
private
Integer
height
;
private
Boolean
buyable
;
private
Boolean
disabled
;
private
Integer
productId
;
private
Integer
mapId
;
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
Integer
getMapX
()
{
return
mapX
;
}
public
void
setMapX
(
Integer
mapX
)
{
this
.
mapX
=
mapX
;
}
public
Integer
getMapY
()
{
return
mapY
;
}
public
void
setMapY
(
Integer
mapY
)
{
this
.
mapY
=
mapY
;
}
public
Integer
getWidth
()
{
return
width
;
}
public
void
setWidth
(
Integer
width
)
{
this
.
width
=
width
;
}
public
Integer
getHeight
()
{
return
height
;
}
public
void
setHeight
(
Integer
height
)
{
this
.
height
=
height
;
}
public
Boolean
getBuyable
()
{
return
buyable
;
}
public
void
setBuyable
(
Boolean
buyable
)
{
this
.
buyable
=
buyable
;
}
public
Boolean
getDisabled
()
{
return
disabled
;
}
public
void
setDisabled
(
Boolean
disabled
)
{
this
.
disabled
=
disabled
;
}
public
Integer
getProductId
()
{
return
productId
;
}
public
void
setProductId
(
Integer
productId
)
{
this
.
productId
=
productId
;
}
public
Integer
getMapId
()
{
return
mapId
;
}
public
void
setMapId
(
Integer
mapId
)
{
this
.
mapId
=
mapId
;
}
}
code/MoyaWeb/src/fi/codecrew/moya/rest/pojo/PlaceOutPojo.java
0 → 100644
View file @
b48c82c
package
fi
.
codecrew
.
moya
.
rest
.
pojo
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.List
;
import
javax.xml.bind.annotation.XmlElement
;
import
fi.codecrew.moya.model.Place
;
public
class
PlaceOutPojo
{
private
Place
place
;
public
PlaceOutPojo
()
{
}
public
PlaceOutPojo
(
Place
p
)
{
this
.
place
=
p
;
}
public
static
List
<
PlaceOutPojo
>
parse
(
List
<
Place
>
places
)
{
List
<
PlaceOutPojo
>
ret
=
new
ArrayList
<>();
for
(
Place
p
:
places
)
{
ret
.
add
(
new
PlaceOutPojo
(
p
));
}
return
ret
;
}
@XmlElement
public
Integer
getProductId
()
{
Integer
ret
=
null
;
if
(
place
.
getProduct
()
!=
null
)
ret
=
place
.
getProduct
().
getId
();
return
ret
;
}
@XmlElement
public
Integer
getId
()
{
return
place
.
getId
();
}
@XmlElement
public
String
getDescription
()
{
return
place
.
getDescription
();
}
@XmlElement
public
String
getName
()
{
return
place
.
getName
();
}
@XmlElement
public
Integer
getMapX
()
{
return
place
.
getMapX
();
}
@XmlElement
public
Integer
getMapY
()
{
return
place
.
getMapY
();
}
@XmlElement
public
String
getDetails
()
{
return
place
.
getDetails
();
}
@XmlElement
public
String
getCode
()
{
return
place
.
getCode
();
}
@XmlElement
public
Integer
getHeight
()
{
return
place
.
getHeight
();
}
@XmlElement
public
Integer
getWidth
()
{
return
place
.
getWidth
();
}
@XmlElement
public
boolean
isTaken
()
{
return
place
.
isTaken
();
}
@XmlElement
public
boolean
isBuyable
()
{
return
place
.
isBuyable
();
}
@XmlElement
public
Calendar
getReleaseTime
()
{
return
place
.
getReleaseTime
();
}
@XmlElement
public
boolean
isDisabled
()
{
return
place
.
isDisabled
();
}
@XmlElement
public
Integer
getReserverId
()
{
Integer
ret
=
null
;
if
(
place
.
getPlaceReserver
()
!=
null
&&
place
.
getPlaceReserver
().
getPlaceGroup
()
!=
null
&&
place
.
getPlaceReserver
().
getPlaceGroup
().
getCreator
()
!=
null
)
ret
=
place
.
getPlaceReserver
().
getPlaceGroup
().
getCreator
().
getId
();
return
ret
;
}
@XmlElement
public
Integer
getEventuserId
()
{
Integer
ret
=
null
;
if
(
place
.
getPlaceReserver
()
!=
null
&&
place
.
getPlaceReserver
().
getUser
()
!=
null
)
ret
=
place
.
getPlaceReserver
().
getUser
().
getId
();
return
ret
;
}
}
code/MoyaWeb/src/fi/codecrew/moya/rest/pojo/PlaceRoot.java
0 → 100644
View file @
b48c82c
package
fi
.
codecrew
.
moya
.
rest
.
pojo
;
import
java.util.List
;
import
javax.xml.bind.annotation.XmlRootElement
;
import
fi.codecrew.moya.model.EventMap
;
import
fi.codecrew.moya.rest.pojo.MapRoot.MapPojo
;
@XmlRootElement
public
class
PlaceRoot
{
public
PlaceRoot
()
{
}
public
PlaceRoot
(
EventMap
map2
)
{
this
.
map
=
new
MapPojo
(
map2
);
setPlaces
(
PlaceOutPojo
.
parse
(
map2
.
getPlaces
()));
}
private
MapPojo
map
;
private
List
<
PlaceOutPojo
>
places
;
public
MapPojo
getMap
()
{
return
map
;
}
public
void
setMap
(
MapPojo
map
)
{
this
.
map
=
map
;
}
public
List
<
PlaceOutPojo
>
getPlaces
()
{
return
places
;
}
public
void
setPlaces
(
List
<
PlaceOutPojo
>
places
)
{
this
.
places
=
places
;
}
}
code/MoyaWeb/src/fi/codecrew/moya/rest/pojo/SimpleEventuserRoot.java
0 → 100644
View file @
b48c82c
package
fi
.
codecrew
.
moya
.
rest
.
pojo
;
import
java.util.ArrayList
;
import
java.util.List
;
import
javax.xml.bind.annotation.XmlRootElement
;
import
fi.codecrew.moya.model.EventUser
;
@XmlRootElement
()
public
class
SimpleEventuserRoot
{
private
List
<
EventUserRestPojo
>
eventusers
;
public
SimpleEventuserRoot
()
{
}
public
SimpleEventuserRoot
(
ArrayList
<
EventUserRestPojo
>
list
)
{
this
.
eventusers
=
list
;
}
public
List
<
EventUserRestPojo
>
getEventusers
()
{
return
eventusers
;
}
public
void
setEventusers
(
List
<
EventUserRestPojo
>
eventusers
)
{
this
.
eventusers
=
eventusers
;
}
public
static
SimpleEventuserRoot
parse
(
List
<
EventUser
>
users
)
{
ArrayList
<
EventUserRestPojo
>
list
=
new
ArrayList
<>();
for
(
EventUser
u
:
users
)
{
list
.
add
(
new
EventUserRestPojo
(
u
));
}
return
new
SimpleEventuserRoot
(
list
);
}
}
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