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 d45b2ca7
authored
Jan 11, 2015
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add place info to place in user reservation
1 parent
3e8ab32c
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
16 deletions
code/moya-restpojo/pom.xml
code/moya-restpojo/src/main/java/fi/codecrew/moya/rest/pojo/userinfo/v1/UserReservationPlacePojo.java
code/moya-web/src/main/java/fi/codecrew/moya/rest/PojoUtils.java
code/moya-web/src/main/java/fi/codecrew/moya/rest/UserRestView.java
code/moya-restpojo/pom.xml
View file @
d45b2ca
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
moya-restpojo
</artifactId>
<artifactId>
moya-restpojo
</artifactId>
<groupId>
fi.codecrew.moya
</groupId>
<groupId>
fi.codecrew.moya
</groupId>
<version>
1.0.
4
</version>
<version>
1.0.
5
</version>
<build>
<build>
<plugins>
<plugins>
<plugin>
<plugin>
...
...
code/moya-restpojo/src/main/java/fi/codecrew/moya/rest/pojo/userinfo/v1/UserReservationPlacePojo.java
View file @
d45b2ca
...
@@ -4,12 +4,16 @@ import javax.xml.bind.annotation.XmlElement;
...
@@ -4,12 +4,16 @@ import javax.xml.bind.annotation.XmlElement;
public
class
UserReservationPlacePojo
{
public
class
UserReservationPlacePojo
{
@XmlElement
@XmlElement
(
name
=
"placeid"
)
private
Integer
placeid
;
private
Integer
placeid
;
@XmlElement
@XmlElement
(
name
=
"placename"
)
private
String
placename
;
private
String
placename
;
@XmlElement
@XmlElement
(
name
=
"placegiven"
)
private
boolean
placegiven
;
private
boolean
placegiven
;
@XmlElement
(
name
=
"productid"
)
private
Integer
productId
;
@XmlElement
(
name
=
"productname"
)
private
String
productName
;
public
String
getPlacename
()
{
public
String
getPlacename
()
{
return
placename
;
return
placename
;
...
@@ -35,4 +39,20 @@ public class UserReservationPlacePojo {
...
@@ -35,4 +39,20 @@ public class UserReservationPlacePojo {
this
.
placeid
=
placeid
;
this
.
placeid
=
placeid
;
}
}
public
Integer
getProductId
()
{
return
productId
;
}
public
void
setProductId
(
Integer
productId
)
{
this
.
productId
=
productId
;
}
public
String
getProductName
()
{
return
productName
;
}
public
void
setProductName
(
String
productName
)
{
this
.
productName
=
productName
;
}
}
}
code/moya-web/src/main/java/fi/codecrew/moya/rest/PojoUtils.java
View file @
d45b2ca
...
@@ -8,6 +8,7 @@ import javax.xml.bind.annotation.XmlElement;
...
@@ -8,6 +8,7 @@ import javax.xml.bind.annotation.XmlElement;
import
fi.codecrew.moya.model.EventMap
;
import
fi.codecrew.moya.model.EventMap
;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.model.GroupMembership
;
import
fi.codecrew.moya.model.Place
;
import
fi.codecrew.moya.model.Place
;
import
fi.codecrew.moya.model.PrintedCard
;
import
fi.codecrew.moya.model.PrintedCard
;
import
fi.codecrew.moya.model.Product
;
import
fi.codecrew.moya.model.Product
;
...
@@ -27,6 +28,7 @@ import fi.codecrew.moya.rest.pojo.userinfo.v1.CardRoot;
...
@@ -27,6 +28,7 @@ import fi.codecrew.moya.rest.pojo.userinfo.v1.CardRoot;
import
fi.codecrew.moya.rest.pojo.userinfo.v1.EventUserRestPojo
;
import
fi.codecrew.moya.rest.pojo.userinfo.v1.EventUserRestPojo
;
import
fi.codecrew.moya.rest.pojo.userinfo.v1.PrintedCardRestPojo
;
import
fi.codecrew.moya.rest.pojo.userinfo.v1.PrintedCardRestPojo
;
import
fi.codecrew.moya.rest.pojo.userinfo.v1.SimpleEventuserRoot
;
import
fi.codecrew.moya.rest.pojo.userinfo.v1.SimpleEventuserRoot
;
import
fi.codecrew.moya.rest.pojo.userinfo.v1.UserReservationPlacePojo
;
public
class
PojoUtils
{
public
class
PojoUtils
{
public
static
EventUserRestPojo
initEventUserRestPojo
(
EventUser
user
)
public
static
EventUserRestPojo
initEventUserRestPojo
(
EventUser
user
)
...
@@ -275,4 +277,18 @@ public class PojoUtils {
...
@@ -275,4 +277,18 @@ public class PojoUtils {
ret
.
setHeight
(
map
.
getHeight
());
ret
.
setHeight
(
map
.
getHeight
());
return
ret
;
return
ret
;
}
}
public
static
UserReservationPlacePojo
initUserReservationPlace
(
GroupMembership
g
)
{
UserReservationPlacePojo
ur
=
new
UserReservationPlacePojo
();
ur
.
setPlacegiven
(
g
.
getEnteredEvent
()
!=
null
);
Place
place
=
g
.
getPlaceReservation
();
if
(
place
!=
null
)
{
ur
.
setPlaceid
(
place
.
getId
());
ur
.
setPlacename
(
place
.
getName
());
ur
.
setProductId
(
place
.
getProduct
().
getId
());
ur
.
setProductName
(
place
.
getProduct
().
getName
());
}
return
ur
;
}
}
}
code/moya-web/src/main/java/fi/codecrew/moya/rest/UserRestView.java
View file @
d45b2ca
...
@@ -110,11 +110,8 @@ public class UserRestView {
...
@@ -110,11 +110,8 @@ public class UserRestView {
ret
.
setUser
(
PojoUtils
.
initEventUserRestPojo
(
eu
));
ret
.
setUser
(
PojoUtils
.
initEventUserRestPojo
(
eu
));
for
(
GroupMembership
g
:
gms
)
{
for
(
GroupMembership
g
:
gms
)
{
UserReservationPlacePojo
ur
=
new
UserReservationPlacePojo
();
ur
.
setPlaceid
(
g
.
getPlaceReservation
().
getId
());
ret
.
getReservations
().
add
(
PojoUtils
.
initUserReservationPlace
(
g
));
ur
.
setPlacegiven
(
g
.
getEnteredEvent
()
!=
null
);
ur
.
setPlacename
(
g
.
getPlaceReservation
().
getName
());
ret
.
getReservations
().
add
(
ur
);
}
}
return
Response
.
ok
(
ret
).
build
();
return
Response
.
ok
(
ret
).
build
();
}
}
...
@@ -133,13 +130,7 @@ public class UserRestView {
...
@@ -133,13 +130,7 @@ public class UserRestView {
UserReservationRoot
ret
=
new
UserReservationRoot
();
UserReservationRoot
ret
=
new
UserReservationRoot
();
ret
.
setUser
(
PojoUtils
.
initEventUserRestPojo
(
eu
));
ret
.
setUser
(
PojoUtils
.
initEventUserRestPojo
(
eu
));
for
(
GroupMembership
g
:
gms
)
{
for
(
GroupMembership
g
:
gms
)
{
UserReservationPlacePojo
ur
=
new
UserReservationPlacePojo
();
ret
.
getReservations
().
add
(
PojoUtils
.
initUserReservationPlace
(
g
));
ur
.
setPlaceid
(
g
.
getPlaceReservation
().
getId
());
ur
.
setPlacename
(
g
.
getPlaceReservation
().
getName
());
ur
.
setPlacegiven
(
g
.
getEnteredEvent
()
!=
null
);
ret
.
getReservations
().
add
(
ur
);
}
}
return
Response
.
ok
(
ret
).
build
();
return
Response
.
ok
(
ret
).
build
();
}
}
...
...
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