Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Codecrew
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
30
Merge Requests
2
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit c3428b5b
authored
Mar 02, 2014
by
Tuukka Kivilahti
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into barcodefuckup
2 parents
911702a4
78dcf6db
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
0 deletions
code/MoyaWeb/src/fi/codecrew/moya/rest/UserRestView.java
code/MoyaWeb/src/fi/codecrew/moya/rest/pojo/MapRoot.java
code/MoyaWeb/src/fi/codecrew/moya/rest/pojo/PrintedCardRestPojo.java
code/MoyaWeb/src/fi/codecrew/moya/servlet/TimeServlet.java
code/MoyaWeb/src/fi/codecrew/moya/rest/UserRestView.java
View file @
c3428b5
...
...
@@ -5,11 +5,14 @@ import javax.enterprise.context.RequestScoped;
import
javax.ws.rs.Consumes
;
import
javax.ws.rs.GET
;
import
javax.ws.rs.Path
;
import
javax.ws.rs.PathParam
;
import
javax.ws.rs.Produces
;
import
javax.ws.rs.core.MediaType
;
import
fi.codecrew.moya.beans.CardTemplateBeanLocal
;
import
fi.codecrew.moya.beans.UserBeanLocal
;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.rest.pojo.PrintedCardRestPojo
;
import
fi.codecrew.moya.rest.pojo.SimpleEventuserRoot
;
import
fi.codecrew.moya.util.UserSearchQuery
;
import
fi.codecrew.moya.utilities.SearchQuery.QuerySortOrder
;
...
...
@@ -24,6 +27,9 @@ public class UserRestView {
@EJB
private
UserBeanLocal
userbean
;
@EJB
private
CardTemplateBeanLocal
cardbean
;
@GET
@Path
(
"/eventusers"
)
public
SimpleEventuserRoot
getEventUsers
()
{
...
...
@@ -31,4 +37,12 @@ public class UserRestView {
SearchResult
<
EventUser
>
users
=
userbean
.
getThisEventsUsers
(
q
);
return
SimpleEventuserRoot
.
parse
(
users
.
getResults
());
}
@GET
@Path
(
"/card/{eventuserId}"
)
public
PrintedCardRestPojo
getUsersCard
(
@PathParam
(
"eventuserId"
)
Integer
eventuserid
)
{
EventUser
user
=
userbean
.
findByEventUserId
(
eventuserid
);
return
new
PrintedCardRestPojo
(
cardbean
.
checkPrintedCard
(
user
));
}
}
code/MoyaWeb/src/fi/codecrew/moya/rest/pojo/MapRoot.java
View file @
c3428b5
...
...
@@ -51,6 +51,11 @@ public class MapRoot {
return
map
.
getId
();
}
@XmlElement
(
name
=
"active"
)
public
boolean
isActive
()
{
return
map
.
isActive
();
}
}
public
static
MapRoot
parseMaps
(
List
<
EventMap
>
eventMaps
)
{
...
...
code/MoyaWeb/src/fi/codecrew/moya/rest/pojo/PrintedCardRestPojo.java
View file @
c3428b5
...
...
@@ -20,6 +20,11 @@ public class PrintedCardRestPojo {
this
.
card
=
card
;
}
@XmlElement
(
name
=
"eventuserId"
)
public
Integer
getEventuserId
()
{
return
card
.
getUser
().
getId
();
}
@XmlTransient
private
final
PrintedCard
card
;
...
...
code/MoyaWeb/src/fi/codecrew/moya/servlet/TimeServlet.java
0 → 100644
View file @
c3428b5
package
fi
.
codecrew
.
moya
.
servlet
;
import
java.io.IOException
;
import
java.io.PrintWriter
;
import
javax.servlet.ServletException
;
import
javax.servlet.annotation.WebServlet
;
import
javax.servlet.http.HttpServlet
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
/**
* Servlet implementation class UploadServlet
*/
@WebServlet
(
urlPatterns
=
{
"/currenttime"
})
public
class
TimeServlet
extends
HttpServlet
{
private
static
final
long
serialVersionUID
=
1L
;
@Override
protected
void
doGet
(
HttpServletRequest
req
,
HttpServletResponse
resp
)
throws
ServletException
,
IOException
{
PrintWriter
w
=
resp
.
getWriter
();
w
.
write
(
String
.
valueOf
(
System
.
currentTimeMillis
()));
w
.
flush
();
w
.
close
();
}
}
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