Commit 1869d0d0 by Juho Juopperi

rest view for printedcard

1 parent 59563005
package fi.codecrew.moya.rest; package fi.codecrew.moya.rest.meta;
import java.util.List; import java.util.List;
...@@ -17,28 +17,28 @@ import fi.codecrew.moya.beans.CardTemplateBeanLocal; ...@@ -17,28 +17,28 @@ import fi.codecrew.moya.beans.CardTemplateBeanLocal;
import fi.codecrew.moya.model.PrintedCard; import fi.codecrew.moya.model.PrintedCard;
@RequestScoped @RequestScoped
@Path("/meta") @Path("/meta/printedcard")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON + "; charset=UTF-8" }) @Produces({ MediaType.APPLICATION_JSON + "; charset=UTF-8" })
public class MetaRestView { public class PrintedCardRestView {
@EJB @EJB
CardTemplateBeanLocal cardTemplateBeanLocal; CardTemplateBeanLocal cardTemplateBeanLocal;
/** /**
* Get printed card metadata. * Metadata for entity.
* *
* @param cardId * @param id
* @param keys * @param keys
* The path segments after card id * The path segments after card id
* @return * @return
*/ */
@GET @GET
@Path("/printedcard/{id}/{keys:.*}") @Path("/{id}/{keys:.*}")
public String getPrintedCardMeta(@PathParam("id") Integer cardId, public String getPrintedCardMeta(@PathParam("id") Integer id,
@PathParam("key") List<PathSegment> keys) { @PathParam("key") List<PathSegment> keys) {
PrintedCard printedCard = cardTemplateBeanLocal.findCard(cardId); PrintedCard printedCard = cardTemplateBeanLocal.findCard(id);
JsonObject meta = printedCard.getMeta(); JsonObject meta = printedCard.getMeta();
return meta.toString(); return meta.toString() + "\n";
} }
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!