Commit 0357803e by Tuukka Kivilahti

Merge branch 'restfix' into 'master'

Restfix

Muutamia restijuttuja

kattoi: @tkfftk
2 parents 009690c8 3b7d50df
...@@ -5,11 +5,14 @@ import javax.enterprise.context.RequestScoped; ...@@ -5,11 +5,14 @@ import javax.enterprise.context.RequestScoped;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
import javax.ws.rs.GET; import javax.ws.rs.GET;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import fi.codecrew.moya.beans.CardTemplateBeanLocal;
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.rest.pojo.PrintedCardRestPojo;
import fi.codecrew.moya.rest.pojo.SimpleEventuserRoot; import fi.codecrew.moya.rest.pojo.SimpleEventuserRoot;
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;
...@@ -24,6 +27,9 @@ public class UserRestView { ...@@ -24,6 +27,9 @@ public class UserRestView {
@EJB @EJB
private UserBeanLocal userbean; private UserBeanLocal userbean;
@EJB
private CardTemplateBeanLocal cardbean;
@GET @GET
@Path("/eventusers") @Path("/eventusers")
public SimpleEventuserRoot getEventUsers() { public SimpleEventuserRoot getEventUsers() {
...@@ -31,4 +37,12 @@ public class UserRestView { ...@@ -31,4 +37,12 @@ public class UserRestView {
SearchResult<EventUser> users = userbean.getThisEventsUsers(q); SearchResult<EventUser> users = userbean.getThisEventsUsers(q);
return SimpleEventuserRoot.parse(users.getResults()); 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));
}
} }
...@@ -51,6 +51,11 @@ public class MapRoot { ...@@ -51,6 +51,11 @@ public class MapRoot {
return map.getId(); return map.getId();
} }
@XmlElement(name = "active")
public boolean isActive() {
return map.isActive();
}
} }
public static MapRoot parseMaps(List<EventMap> eventMaps) { public static MapRoot parseMaps(List<EventMap> eventMaps) {
......
...@@ -20,6 +20,11 @@ public class PrintedCardRestPojo { ...@@ -20,6 +20,11 @@ public class PrintedCardRestPojo {
this.card = card; this.card = card;
} }
@XmlElement(name = "eventuserId")
public Integer getEventuserId() {
return card.getUser().getId();
}
@XmlTransient @XmlTransient
private final PrintedCard card; private final PrintedCard card;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!