bda-controller/src/main/java/gr/ntua/ece/cslab/selis/bda/controller/resources/RecipeResource.java
@POST
    @Path("{slug}/{recipeId}")
    @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    public Response insert(@PathParam("slug") String slug,
                           @PathParam("recipeId") int recipeId,
                           @QueryParam("name") String name,
                           RecipeArguments args) {
        String details = "";
        Recipe r;

        try {
            r = Recipe.createFromSharedRecipe(recipeId, name, args);
            r.save(slug);
            details = Integer.toString(r.getId());
        } catch (Exception e) {
            e.printStackTrace();

            return Response.serverError().entity(
                    new RequestResponse("ERROR", "Could not create Recipe.")
            ).build();
        }

        return Response.ok(
                new RequestResponse("OK", details)
        ).build();
    }
/**
     * Method to create a Recipe from an existing shared recipe
     * @param recipeId the shared recipe id
     * @param args the recipe arguments
     */
Method to create a Recipe from an existing shared recipe
@param recipeId the shared recipe id
@param args the recipe arguments
Method to create a Recipe from an existing shared recipe @param recipeId the shared recipe id @param args the recipe arguments
@POST
    @Path("{slug}/{recipeId}")
    @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    public Response insert(@PathParam("slug") String slug,
                           @PathParam("recipeId") int recipeId,
                           @QueryParam("name") String name,
                           RecipeArguments args) {
        String details = "";
        Recipe r;
        try {
            r = Recipe.createFromSharedRecipe(recipeId, name, args);
            r.save(slug);
            details = Integer.toString(r.getId());
        } catch (Exception e) {
            e.printStackTrace();
            return Response.serverError().entity(
                    new RequestResponse("ERROR", "Could not create Recipe.")
            ).build();
        }
        return Response.ok(
                new RequestResponse("OK", details)
        ).build();
    }
@ POST @ Path ( "{slug}/{recipeId}" ) @ Consumes ( { MediaType . APPLICATION_JSON , MediaType . APPLICATION_XML } ) @ Produces ( { MediaType . APPLICATION_JSON , MediaType . APPLICATION_XML } ) public Response insert ( @ PathParam ( "slug" ) String slug , @ PathParam ( "recipeId" ) int recipeId , @ QueryParam ( "name" ) String name , RecipeArguments args ) { String details = "" ; Recipe r ; try { r = Recipe . createFromSharedRecipe ( recipeId , name , args ) ; r . save ( slug ) ; details = Integer . toString ( r . getId ( ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; return Response . serverError ( ) . entity ( new RequestResponse ( "ERROR" , "Could not create Recipe." ) ) . build ( ) ; } return Response . ok ( new RequestResponse ( "OK" , details ) ) . build ( ) ; }
Method to create a Recipe from an existing shared recipe
 @param recipeId the shared recipe id
 @param args the recipe arguments
Method to create a Recipe from an existing shared recipe @param recipeId the shared recipe id @param args the recipe arguments