Package classes

Examples of classes.Reservation


                                         @PathParam("id") Long id) {

        DAO db = DAO.getInstance();
        ResponseBuilder builder = null;

        Reservation newReservation = reservation.getValue();

        /* means that the ID of the reservation was included in link
         * so i will update this reservation => the xml file does not
         * need to have the resrvation id in his content otherwise it has to
         */
        if (id != null && id.equals(newReservation.getId())) {
            newReservation.setId(id);
        } else {
            builder = Response.status(Response.Status.BAD_REQUEST).
                    entity(HandlingMessage("Error", "error",
                                           "The ID of the reservation is not valid or don't exists!"
                    + "The mentioned id should be the same with the one from"
View Full Code Here


    public Response addFlight(JAXBElement<Reservation> reservation) {

        DAO db = DAO.getInstance();
        ResponseBuilder builder = null;

        Reservation addNewReservation = reservation.getValue();
        Long ReservationId = addNewReservation.getId();

        /* if the Xml file contains all the req fields and it has a reservation
         * number and it's the same like the one in the link then it can be updated
         */
        if (isReservationContentCorrect(addNewReservation)
                && ReservationId != null) {
            if (!db.existReservation(ReservationId)) {
                db.addReservation(addNewReservation);

                URI reservationUri = uriInfo.getAbsolutePathBuilder().
                        path(addNewReservation.getId().toString()).
                        build();

                builder = Response.status(Response.Status.CREATED).
                        location(reservationUri).
                        entity(HandlingMessage("Success", "success",
View Full Code Here

    @Path("/reservation/{id}")
    public Response removeReservationWithId(JAXBElement<Reservation> reservation,
                                            @PathParam("id") Long id) {

        DAO db = DAO.getInstance();
        Reservation deleteReservation = reservation.getValue();
        ResponseBuilder builder;
        /* if it's a good request send NO_CONTENT else BADREQ*/
        if (db.existReservation(id) && deleteReservation.getId() == id) {
            /* if I want to delete a reservation afer a given ID*/
            deleteReservation.setId(id);
            db.deleteReservation(deleteReservation);

            builder = Response.status(Response.Status.NO_CONTENT).
                    entity(HandlingMessage("Success", "success",
                                           "Your reservation was successfully deleted"));
View Full Code Here

    @Consumes(MediaType.APPLICATION_XML)
    @Path("/reservation")
    public Response removeReservation(JAXBElement<Reservation> reservation) throws ParserConfigurationException {

        DAO db = DAO.getInstance();
        Reservation deleteReservation = reservation.getValue();

        ResponseBuilder builder = null;
        /* if it's a good request send CREATE else BADREQ*/
        if (deleteReservation.getId() != null
                && db.existReservation(deleteReservation.getId())) {
            db.deleteReservation(deleteReservation);

            builder = Response.status(Response.Status.NO_CONTENT).
                    entity(HandlingMessage("Success", "success",
                                           "Your reservation was successfully deleted"));
View Full Code Here

TOP

Related Classes of classes.Reservation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.