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 7b1d2fa9
authored
Jan 10, 2015
by
Tuukka Kivilahti
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master' into incomingMuutoksia
2 parents
d89b0eec
7df098f7
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
144 additions
and
8 deletions
code/moya-beans/ejbModule/fi/codecrew/moya/beans/BootstrapBean.java
code/moya-database/src/main/java/fi/codecrew/moya/model/GroupMembership.java
code/moya-restpojo/pom.xml
code/moya-restpojo/src/main/java/fi/codecrew/moya/rest/pojo/userinfo/v1/PrintedCardRestPojo.java
code/moya-restpojo/src/main/java/fi/codecrew/moya/rest/pojo/userinfo/v1/UserReservationPlacePojo.java
code/moya-restpojo/src/main/java/fi/codecrew/moya/rest/pojo/userinfo/v1/UserReservationRoot.java
code/moya-web/WebContent/error.xhtml
code/moya-web/pom.xml
code/moya-web/src/main/java/fi/codecrew/moya/rest/UserRestView.java
code/moya-beans/ejbModule/fi/codecrew/moya/beans/BootstrapBean.java
View file @
7b1d2fa
...
@@ -241,6 +241,12 @@ public class BootstrapBean implements BootstrapBeanLocal {
...
@@ -241,6 +241,12 @@ public class BootstrapBean implements BootstrapBeanLocal {
"ALTER TABLE maps ADD COLUMN mime_type TEXT default 'image/png'"
,
"ALTER TABLE maps ADD COLUMN mime_type TEXT default 'image/png'"
,
});
});
dbUpdates
.
add
(
new
String
[]
{
"ALTER TABLE group_memberships ADD COLUMN entered_event_admin_id INTEGER"
,
"ALTER TABLE group_memberships ADD CONSTRAINT FK_group_memberships_entered_event_admin_id FOREIGN KEY (entered_event_admin_id) REFERENCES event_users (id)"
,
});
}
}
public
BootstrapBean
()
{
public
BootstrapBean
()
{
...
...
code/moya-database/src/main/java/fi/codecrew/moya/model/GroupMembership.java
View file @
7b1d2fa
...
@@ -79,10 +79,22 @@ public class GroupMembership extends GenericEntity {
...
@@ -79,10 +79,22 @@ public class GroupMembership extends GenericEntity {
@ManyToOne
@ManyToOne
private
EventUser
user
;
private
EventUser
user
;
/**
* When user has redeemed ticket at the door
*/
@Column
(
name
=
"entered_event"
)
@Column
(
name
=
"entered_event"
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
private
Calendar
enteredEvent
;
private
Calendar
enteredEvent
;
/**
* User who has given the entrance to the event (ie who has set the
* enteredEvent field to not null)
*
*/
@ManyToOne
()
@JoinColumn
(
name
=
"entered_event_admin_id"
)
private
EventUser
enteredEventAdmin
;
public
GroupMembership
()
{
public
GroupMembership
()
{
}
}
...
@@ -125,9 +137,9 @@ public class GroupMembership extends GenericEntity {
...
@@ -125,9 +137,9 @@ public class GroupMembership extends GenericEntity {
this
.
placeGroup
=
groupsId
;
this
.
placeGroup
=
groupsId
;
}
}
/**
/**
* When user has selected place from map, it will be put on this.
* When user has selected place from map, it will be put on this.
*
* @return
* @return
*/
*/
public
Place
getPlaceReservation
()
{
public
Place
getPlaceReservation
()
{
...
@@ -169,10 +181,10 @@ public class GroupMembership extends GenericEntity {
...
@@ -169,10 +181,10 @@ public class GroupMembership extends GenericEntity {
return
inviteToken
;
return
inviteToken
;
}
}
/**
/**
*
*
* PlaceProduct is part of membership BEFORE user has selected place.
* PlaceProduct is part of membership BEFORE user has selected place.
*
* @return
* @return
*/
*/
public
Product
getPlaceProduct
()
{
public
Product
getPlaceProduct
()
{
...
...
code/moya-restpojo/pom.xml
View file @
7b1d2fa
...
@@ -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
</version>
<version>
1.0
.2
</version>
<build>
<build>
<plugins>
<plugins>
<plugin>
<plugin>
...
...
code/moya-restpojo/src/main/java/fi/codecrew/moya/rest/pojo/userinfo/v1/PrintedCardRestPojo.java
View file @
7b1d2fa
...
@@ -31,6 +31,7 @@ public class PrintedCardRestPojo {
...
@@ -31,6 +31,7 @@ public class PrintedCardRestPojo {
private
String
template
;
private
String
template
;
private
String
username
;
private
String
username
;
private
String
wholeName
;
private
String
wholeName
;
private
String
state
;
private
String
state
;
private
Date
printTime
;
private
Date
printTime
;
...
@@ -65,6 +66,19 @@ public class PrintedCardRestPojo {
...
@@ -65,6 +66,19 @@ public class PrintedCardRestPojo {
return
wholeName
;
return
wholeName
;
}
}
/**
* Possible values: ( from CardState )
*
* <ul>
* <li>DATA_MISSING,
* <li>PENDING_VALIDATION,
* <li>REJECTED,
* <li>VALIDATED,
* <li>PRINTING_IN_PROGRESS,
* <li>PRINTED,
* <li>DELIVERED;
* </ul>
*/
@XmlElement
(
name
=
"state"
)
@XmlElement
(
name
=
"state"
)
public
String
getState
()
{
public
String
getState
()
{
return
state
;
return
state
;
...
...
code/moya-restpojo/src/main/java/fi/codecrew/moya/rest/pojo/userinfo/v1/UserReservationPlacePojo.java
0 → 100644
View file @
7b1d2fa
package
fi
.
codecrew
.
moya
.
rest
.
pojo
.
userinfo
.
v1
;
import
javax.xml.bind.annotation.XmlElement
;
public
class
UserReservationPlacePojo
{
@XmlElement
private
Integer
placeid
;
@XmlElement
private
String
placename
;
@XmlElement
private
boolean
placegiven
;
public
String
getPlacename
()
{
return
placename
;
}
public
void
setPlacename
(
String
placename
)
{
this
.
placename
=
placename
;
}
public
boolean
isPlacegiven
()
{
return
placegiven
;
}
public
void
setPlacegiven
(
boolean
placegiven
)
{
this
.
placegiven
=
placegiven
;
}
public
Integer
getPlaceid
()
{
return
placeid
;
}
public
void
setPlaceid
(
Integer
placeid
)
{
this
.
placeid
=
placeid
;
}
}
code/moya-restpojo/src/main/java/fi/codecrew/moya/rest/pojo/userinfo/v1/UserReservationRoot.java
0 → 100644
View file @
7b1d2fa
/*
* Copyright Codecrew Ry
*
* All rights reserved.
*
* This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software.
*
* Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the
* copyright owner.
*
* A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in
* future versions of the Software.
*
*/
package
fi
.
codecrew
.
moya
.
rest
.
pojo
.
userinfo
.
v1
;
import
java.util.List
;
import
javax.xml.bind.annotation.XmlRootElement
;
@XmlRootElement
()
public
class
UserReservationRoot
{
private
List
<
UserReservationRoot
>
eventusers
;
public
UserReservationRoot
()
{
super
();
}
public
List
<
UserReservationRoot
>
getEventusers
()
{
return
eventusers
;
}
public
void
setEventusers
(
List
<
UserReservationRoot
>
eventusers
)
{
this
.
eventusers
=
eventusers
;
}
}
code/moya-web/WebContent/error.xhtml
View file @
7b1d2fa
...
@@ -19,7 +19,8 @@
...
@@ -19,7 +19,8 @@
<ui:fragment
rendered=
"#{sessionHandler.isInDevelopmentMode()}"
>
<ui:fragment
rendered=
"#{sessionHandler.isInDevelopmentMode()}"
>
<br/>
<br/>
<center>
<center>
<img
src=
"#{request.contextPath}/resources/media/error.jpg"
/>
<img
src=
"http://thecatapi.com/api/images/get?format=src&type=gif"
/>
<!-- <img src="#{request.contextPath}/resources/media/error.jpg" /> -->
<h1>
LOL, ERROR!
</h1>
<h1>
LOL, ERROR!
</h1>
<br/>
<br/>
</center>
</center>
...
...
code/moya-web/pom.xml
View file @
7b1d2fa
...
@@ -44,7 +44,7 @@
...
@@ -44,7 +44,7 @@
<dependency>
<dependency>
<groupId>
fi.codecrew.moya
</groupId>
<groupId>
fi.codecrew.moya
</groupId>
<artifactId>
moya-restpojo
</artifactId>
<artifactId>
moya-restpojo
</artifactId>
<version>
${moya.version}
</version>
<version>
1.0.2
</version>
</dependency>
</dependency>
</dependencies>
</dependencies>
<parent>
<parent>
...
...
code/moya-web/src/main/java/fi/codecrew/moya/rest/UserRestView.java
View file @
7b1d2fa
...
@@ -19,10 +19,9 @@
...
@@ -19,10 +19,9 @@
package
fi
.
codecrew
.
moya
.
rest
;
package
fi
.
codecrew
.
moya
.
rest
;
import
java.security.Principal
;
import
java.security.Principal
;
import
java.util.List
;
import
javax.annotation.Resource
;
import
javax.ejb.EJB
;
import
javax.ejb.EJB
;
import
javax.ejb.SessionContext
;
import
javax.enterprise.context.RequestScoped
;
import
javax.enterprise.context.RequestScoped
;
import
javax.servlet.ServletException
;
import
javax.servlet.ServletException
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
@@ -41,17 +40,20 @@ import javax.ws.rs.core.Response;
...
@@ -41,17 +40,20 @@ import javax.ws.rs.core.Response;
import
javax.ws.rs.core.Response.ResponseBuilder
;
import
javax.ws.rs.core.Response.ResponseBuilder
;
import
javax.ws.rs.core.Response.Status
;
import
javax.ws.rs.core.Response.Status
;
import
org.apache.http.HttpRequest
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
fi.codecrew.moya.beans.CardTemplateBeanLocal
;
import
fi.codecrew.moya.beans.CardTemplateBeanLocal
;
import
fi.codecrew.moya.beans.PermissionBeanLocal
;
import
fi.codecrew.moya.beans.PermissionBeanLocal
;
import
fi.codecrew.moya.beans.PlaceGroupBeanLocal
;
import
fi.codecrew.moya.beans.UserBeanLocal
;
import
fi.codecrew.moya.beans.UserBeanLocal
;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.model.GroupMembership
;
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
;
import
fi.codecrew.moya.rest.pojo.userinfo.v1.UserReservationRoot
;
import
fi.codecrew.moya.util.UserSearchQuery
;
import
fi.codecrew.moya.util.UserSearchQuery
;
import
fi.codecrew.moya.utilities.SearchQuery.QuerySortOrder
;
import
fi.codecrew.moya.utilities.SearchQuery.QuerySortOrder
;
import
fi.codecrew.moya.utilities.SearchResult
;
import
fi.codecrew.moya.utilities.SearchResult
;
...
@@ -76,6 +78,27 @@ public class UserRestView {
...
@@ -76,6 +78,27 @@ public class UserRestView {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
UserRestView
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
UserRestView
.
class
);
@EJB
private
PlaceGroupBeanLocal
placegroupbean
;
@GET
@Path
(
"/{userid}/reservations"
)
public
Response
usersPlaces
(
@QueryParam
(
"userid"
)
Integer
userid
)
{
EventUser
eu
=
userbean
.
findByUserId
(
userid
,
false
);
if
(
eu
!=
null
)
{
List
<
GroupMembership
>
gms
=
placegroupbean
.
getMemberships
(
eu
);
UserReservationRoot
ret
=
new
UserReservationRoot
();
for
(
GroupMembership
g
:
gms
)
{
UserReservationPlacePojo
ur
=
new
UserReservationPlacePojo
();
ur
.
setPlaceid
(
g
.
getPlaceReservation
().
getId
());
ur
.
setPlacegiven
(
g
.
getEnteredEvent
()
!=
null
);
ur
.
setPlacename
(
g
.
getPlaceReservation
().
getName
());
}
return
Response
.
ok
(
ret
).
build
();
}
return
Response
.
status
(
Status
.
NOT_FOUND
).
build
();
}
@POST
@POST
@Path
(
"/auth"
)
@Path
(
"/auth"
)
@Produces
({
MediaType
.
APPLICATION_JSON
})
@Produces
({
MediaType
.
APPLICATION_JSON
})
...
...
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