Package beans

Examples of beans.Reservation


    public Reservation startReservationManagement(int nextID,Product product, User u) {
        System.out.println("next id: " + nextID);
        RestClient add_reservationto_server = new RestClient();
       
        if (product instanceof Video){
            Reservation reservation = new Reservation(nextID,u,product,new Date(),new Date(),false);
            //System.out.println("json: " + encodeJsonObject(reservation).toJSONString());
            //System.out.println("json: " + encodeJsonObjectProductstats(reservation).toJSONString());           
            add_reservationto_server.apacheHttpClientPost(Login.url+"api/reservation/reservation/", reservation.getUser().getUsername(), reservation.getUser().getPassword(), encodeJsonObject(reservation));
            add_reservationto_server.apacheHttpClientPatch(Login.url+"api/reservation/product/"+reservation.getProduct().getId()+"/", reservation.getUser().getUsername(), reservation.getUser().getPassword(), encodeJsonObjectProductstats(reservation));
            return reservation;
        }
        else if (product instanceof Book ){
            Reservation reservation = new Reservation(nextID,u,product,new Date(),new Date(),false);
            //System.out.println(encodeJsonObject(reservation).toJSONString());
            add_reservationto_server.apacheHttpClientPost(Login.url+"api/reservation/reservation/", reservation.getUser().getUsername(), reservation.getUser().getPassword(), encodeJsonObject(reservation));
            add_reservationto_server.apacheHttpClientPatch(Login.url+"api/reservation/product/"+reservation.getProduct().getId()+"/", reservation.getUser().getUsername(), reservation.getUser().getPassword(), encodeJsonObjectProductstats(reservation));
            return reservation;
        }
        return null;
    }
View Full Code Here


            if (temp!=null){
                authors_node.add(new javax.swing.tree.DefaultMutableTreeNode(temp.getName()));
            }
        }
        for (int i = 0; i< this.window_login.getReservations().size();i++){
            Reservation temp = (Reservation)this.window_login.getReservations().get(i);
            if (temp!=null){
                if (temp.getProduct()!=null){
                    reservations_node.add(new javax.swing.tree.DefaultMutableTreeNode(temp.getProduct().getName()));
                }
            }
        }
        //***************************************************************************************

 
View Full Code Here

                        break;
                    }
                }
            }
            for (int i = 0; i< this.window_login.getReservations().size();i++){
                Reservation temp = (Reservation)this.window_login.getReservations().get(i);
                if (temp!=null){
                    if (temp.getProduct()!=null){
                        if (this.jTextField.getText().toLowerCase().contains(temp.getProduct().getName().toLowerCase())){
                            reservations_node = new DefaultMutableTreeNode("Reservations");
                            reservations_node.add(new javax.swing.tree.DefaultMutableTreeNode(temp.getProduct().getName()));
                            break;
                        }
                    }
                }
            }
View Full Code Here

                            reserv_date_start = sdf.parse((String) jsonObject.get("reserv_date_start"));
                            reserv_finish = sdf.parse((String) jsonObject.get("reserv_finish"));
                        } catch (java.text.ParseException ex) {
                            Logger.getLogger(Login.class.getName()).log(Level.SEVERE, null, ex);
                        }
                        Reservation reservation = new Reservation(Integer.parseInt((String)jsonObject.get("id")), u, product, reserv_date_start,reserv_finish, (boolean) jsonObject.get("penalty"));
                        login.getReservations().add(reservation);
                        login.getReservations_map().put(reservation.getId(), reservation);
                    }
                } catch (ParseException ex) {
                    Logger.getLogger(Login.class.getName()).log(Level.SEVERE, null, ex);
                }
                flag = true;
View Full Code Here

        * it calls this method, which resets the string buffer
        */
       public void startElement(String uri, String localName,String qName, Attributes attributes) throws SAXException {
              temp = "";
              if (qName.equalsIgnoreCase("Object")) {
                     this.reservation = new Reservation();
              }
       }
View Full Code Here

    }   
       private void readList() {
              System.out.println("Names of  the reservations '" + this.login.getReservations().size()  + "'.");
              Iterator<Reservation> it = this.login.getReservations().iterator();
              while (it.hasNext()) {
                  Reservation aux = it.next();
                  System.out.println(aux.getId());
                  System.out.println(aux.isPenalty());
              }     
       }
View Full Code Here

        // TODO add your handling code here:

        Map<Integer, Reservation> treeMap = new TreeMap <Integer, Reservation>(this.menu_window.getLogin_window().getReservations_map());     
       
        if (this.product instanceof Video){
            Reservation reservation = this.product.startReservationManagement(getNextID(treeMap),menu_window.getUser());
            this.menu_window.getLogin_window().getReservations_map().put(reservation.getId(), reservation);
            System.out.println("Instance of VideReservation " + reservation.getReserv_date_start());        
        }
        else if (this.product instanceof Book ){
            Reservation reservation = this.product.startReservationManagement(getNextID(treeMap),menu_window.getUser());
            this.menu_window.getLogin_window().getReservations_map().put(reservation.getId(), reservation);
            System.out.println("Instance of BookReservation " + reservation.getUser().getUsername());
        }
       
        this.menu_window.setVisible(true);
        this.dispose();
       
View Full Code Here

                            System.out.println("coiso: "+(String)jsonObject.get("user"));
                            Matcher makeMatch = Pattern.compile("\\d+").matcher((String)jsonObject.get("product"));
                            makeMatch.find();
                            String inputInt = makeMatch.group();
                            Product aux = (Product)this.menu_window.getLogin_window().getProducts_map().get(Integer.parseInt(inputInt));
                            Reservation r = new Reservation();
                            r.setId(Integer.parseInt((String)jsonObject.get("id")));
                            r.setProduct(aux);
                            this.reservation.add(r);
                            this.jComboBox1.addItem(aux.getName());
                        }

                       
View Full Code Here

    }//GEN-LAST:event_jButton2ActionPerformed

    private void cancel_reservationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancel_reservationActionPerformed
        // TODO add your handling code here:
        for (int i =0; i<this.reservation.size();i++){
            Reservation r = (Reservation)this.reservation.get(i);
            if (r.getProduct().getName().equals(this.product.getName())){
                System.out.println("teste: "+Login.url+"api/reservation/reservation/"+r.getId()+"/?format=json");
                try {
                    new RestClient().doDelete(Login.url+"api/reservation/reservation/"+r.getId()+"/?format=json", this.menu_window.getUser().getUsername(), this.menu_window.getUser().getPassword());
                    System.out.println("Deleted");
                    this.dispose();

                } catch (HttpException ex) {
                    Logger.getLogger(CancelReservationUI.class.getName()).log(Level.SEVERE, null, ex);
View Full Code Here

public class RemoveReservationAPI implements ReservationAPI {

     @Override
    public Reservation startReservationManagement(int nextID,Product product, User u) {
        if (product instanceof Video){
            return new Reservation(nextID,u,product,new Date(),new Date(),false);
        }
        else if (product instanceof Book ){
            return new Reservation(nextID,u,product,new Date(),new Date(),false);
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of beans.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.