use of fi.otavanopisto.muikku.plugins.material.model.MaterialMetaKey in project muikku by otavanopisto.
the class MaterialMetaRESTService method findMaterialMeta.
@GET
@Path("/materials/{id}/meta/{KEY}")
@Produces(MediaType.APPLICATION_JSON)
@RESTPermitUnimplemented
public Response findMaterialMeta(@PathParam("id") Long id, @PathParam("KEY") String key) {
Material material = materialController.findMaterialById(id);
if (material == null) {
return Response.status(Status.NOT_FOUND).entity("Material not found").build();
}
MaterialMetaKey materialMetaKey = materialController.findMaterialMetaKey(key);
if (materialMetaKey == null) {
return Response.status(Status.BAD_REQUEST).entity("Invalid key").build();
}
MaterialMeta materialMeta = materialController.findMaterialMeta(material, materialMetaKey);
if (materialMeta == null) {
return Response.status(Status.NOT_FOUND).entity("Material meta not found").build();
}
return Response.ok(createRestModel(materialMeta)).build();
}
Aggregations