Package beans

Examples of beans.Author


       
        books_node = new SearchBookDecorator(aux).search(this.window_login.getBooks());

        //***************************************************************************************
        for (int i = 0; i < this.window_login.getAuthors().size();i++){
            Author temp = (Author)this.window_login.getAuthors().get(i);
            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


                }
            }

            //***************************************************************************************
            for (int i = 0; i < this.window_login.getAuthors().size();i++){
                Author temp = (Author)this.window_login.getAuthors().get(i);
                if (temp!=null){
                    if (this.jTextField.getText().toLowerCase().contains(temp.getName().toLowerCase())){
                        authors_node = new DefaultMutableTreeNode("Authors");
                        authors_node.add(new javax.swing.tree.DefaultMutableTreeNode(temp.getName()));
                        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

                    login.setAuthors(new ArrayList ());
                    login.setAuthors_map(new HashMap());
                    JSONObject jsonObject = (JSONObject) new JSONParser().parse(data);
                    for (Object c : (JSONArray) jsonObject.get("objects")){
                        jsonObject = (JSONObject) c;
                        Author author = new Author(Integer.parseInt((String)jsonObject.get("id")),(String) jsonObject.get("name"),(String) jsonObject.get("email"));
                        login.getAuthors().add(author);                  
                        login.getAuthors_map().put(author.getId(), author);
                    }
                } catch (ParseException ex) {
                    Logger.getLogger(Login.class.getName()).log(Level.SEVERE, null, ex);
                }
                flag = true;
            }
            else {        
                flag=false;
            }

            data = new RestClient().apacheHttpClientGet(Login.url+"api/reservation/product/?format=json", username.getText(), password.getPassword());
            if( data!=null) {
                try {
                    login.setProducts(new ArrayList ());
                    login.setProducts_map(new HashMap());
                    JSONObject jsonObject = (JSONObject) new JSONParser().parse(data);
                    for (Object c : (JSONArray) jsonObject.get("objects")){
                        jsonObject = (JSONObject) c;
                        Matcher makeMatch = Pattern.compile("\\d+").matcher((String)jsonObject.get("author"));
                        makeMatch.find();
                        String inputInt = makeMatch.group();
                        Author author = (Author) login.getAuthors_map().get(Integer.parseInt(inputInt));
                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
                        Date date=null;
                        try {
                            date = sdf.parse((String) jsonObject.get("pub_date"));
                        } catch (java.text.ParseException ex) {
                            Logger.getLogger(Login.class.getName()).log(Level.SEVERE, null, ex);
                        }
                        Product product = new Product(Integer.parseInt((String)jsonObject.get("id")),author,(String) jsonObject.get("name"),(String) jsonObject.get("genre"),date);
                        product.setCount((long) jsonObject.get("count"));
                        if (product!=null){
                            login.getProducts().add(product);                   
                            login.getProducts_map().put(product.getId(), product);
                        }
                    }
                } catch (ParseException ex) {
                    Logger.getLogger(Login.class.getName()).log(Level.SEVERE, null, ex);
                }
                flag = true;
            }
            else {
                flag = false;
            }

            data = new RestClient().apacheHttpClientGet(Login.url+"api/reservation/video/?format=json", username.getText(), password.getPassword());
            if( data!=null) {
                try {
                    login.setVideos(new ArrayList ());
                    login.setVideos_map(new HashMap());
                    JSONObject jsonObject = (JSONObject) new JSONParser().parse(data);
                    for (Object c : (JSONArray) jsonObject.get("objects")){
                        jsonObject = (JSONObject) c;
                        Author author = (Author) login.getAuthors_map().get(Integer.parseInt((String)jsonObject.get("id")));
                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
                        Date date=null;
                        try {
                            date = sdf.parse((String) jsonObject.get("pub_date"));
                        } catch (java.text.ParseException ex) {
                            Logger.getLogger(Login.class.getName()).log(Level.SEVERE, null, ex);
                        }
                        Video video = new Video (Integer.parseInt((String)jsonObject.get("id")),author,(String) jsonObject.get("name"),(String) jsonObject.get("genre"),date);
                        video.setCount((long) jsonObject.get("count"));
                        login.getVideos().add(video);              
                        login.getVideos_map().put(video.getId(), video);
                    }
                } catch (ParseException ex) {
                    Logger.getLogger(Login.class.getName()).log(Level.SEVERE, null, ex);
                }
                flag = true;
            }
            else {
                flag = false;
            }

            data = new RestClient().apacheHttpClientGet(Login.url+"api/reservation/book/?format=json", username.getText(), password.getPassword());
            if( data!=null) {
                try {
                    login.setBooks(new ArrayList ());
                    login.setBooks_map(new HashMap());
                    JSONObject jsonObject = (JSONObject) new JSONParser().parse(data);
                    for (Object c : (JSONArray) jsonObject.get("objects")){
                        jsonObject = (JSONObject) c;
                        Author author = (Author) login.getAuthors_map().get(Integer.parseInt((String)jsonObject.get("id")));
                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
                        Date date=null;
                        try {
                            date = sdf.parse((String) jsonObject.get("pub_date"));
                        } catch (java.text.ParseException ex) {
                            Logger.getLogger(Login.class.getName()).log(Level.SEVERE, null, ex);
                        }
                        Book book = new Book (Integer.parseInt((String)jsonObject.get("id")),author,(String) jsonObject.get("name"),(String) jsonObject.get("genre"),date);
                        book.setCount((long) jsonObject.get("count"));
                        login.getBooks().add(book);                 
                        login.getBooks_map().put(book.getId(), book);
                    }
                } catch (ParseException ex) {
                    Logger.getLogger(Login.class.getName()).log(Level.SEVERE, null, ex);
                }
                flag = true;
            }
            else {
                flag = false;
            }

            data = new RestClient().apacheHttpClientGet(Login.url+"api/reservation/reservation/?format=json", username.getText(), password.getPassword());
            if( data!=null) {
                try {
                    login.setReservations(new ArrayList ());
                    login.setReservations_map(new HashMap());
                    JSONObject jsonObject = (JSONObject) new JSONParser().parse(data);
                    for (Object c : (JSONArray) jsonObject.get("objects")){
                        jsonObject = (JSONObject) c;
                        System.out.println((String)jsonObject.get("user"));
                        Matcher makeMatch = Pattern.compile("\\d+").matcher((String)jsonObject.get("product"));
                        makeMatch.find();
                        String inputInt = makeMatch.group();
                        Product product = (Product) login.getProducts_map().get(Integer.parseInt(inputInt));
                        Author author = (Author) login.getAuthors_map().get(product.getAuthor().getId());
                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
                        Date reserv_date_start=null;
                        Date reserv_finish =null;
                        try {
                            reserv_date_start = sdf.parse((String) jsonObject.get("reserv_date_start"));
View Full Code Here

              else if (qName.equalsIgnoreCase("Product")) {         
                    Matcher makeMatch = Pattern.compile("\\d+").matcher((String)temp);
                    makeMatch.find();
                    String inputInt = makeMatch.group();
                    Product product = (Product) this.login.getProducts_map().get(Integer.parseInt(inputInt));
                    Author author = (Author) login.getAuthors_map().get(product.getAuthor().getId());
                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
                    Date reserv_date_start=null;
                    Date reserv_finish =null;
                    try {
                        if (reserv_date_start!=null && reserv_finish!=null){
View Full Code Here

                    jsonObject = (JSONObject) c;
                    Matcher makeMatch = Pattern.compile("\\d+").matcher((String)jsonObject.get("author"));
                    makeMatch.find();
                    String inputInt = makeMatch.group();
                //    Author author = (Author) this.getAuthors_map().get(Integer.parseInt(inputInt));
                    Author author=null;
                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
                    Date date=null;
                    try {
                        date = sdf.parse((String) jsonObject.get("pub_date"));
                    } catch (java.text.ParseException ex) {
View Full Code Here

              }
              else if (qName.equalsIgnoreCase("Author")) {         
                    Matcher makeMatch = Pattern.compile("\\d+").matcher((String)temp);
                    makeMatch.find();
                    String inputInt = makeMatch.group();
                    Author author = (Author) this.login.getAuthors_map().get(Integer.parseInt(inputInt));
                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
                    Date date=null;
                    try {
                        if (this.temp_pub_date!=null){
                            date = sdf.parse((String) this.temp_pub_date);
View Full Code Here

                for (Object c : (JSONArray) jsonObject.get("objects")){
                    jsonObject = (JSONObject) c;
                    Matcher makeMatch = Pattern.compile("\\d+").matcher((String)jsonObject.get("author"));
                    makeMatch.find();
                    String inputInt = makeMatch.group();
                    Author author = (Author) this.login_window.getAuthors_map().get(Integer.parseInt(inputInt));
                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
                    Date date=null;
                    try {
                        date = sdf.parse((String) jsonObject.get("pub_date"));
                    } catch (java.text.ParseException ex) {
                        Logger.getLogger(Login.class.getName()).log(Level.SEVERE, null, ex);
                    }
                
                    productcreator.setProduct(videobuilder);
                    productcreator.constructProduct(Integer.parseInt((String)jsonObject.get("id")),author,(String) jsonObject.get("name"),(String) jsonObject.get("genre"),date);
                    Product product = productcreator.getProduct();
                    this.newvideos.add(product);
                }
            } catch (ParseException ex) {
                Logger.getLogger(Login.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
       
       
        data = new RestClient().apacheHttpClientGet(Login.url+"api/reservation/book/?format=json", this.user.getUsername(), this.user.getPassword());
        if( data!=null) {
            try {
                this.newbooks = new ArrayList();
                JSONObject jsonObject = (JSONObject) new JSONParser().parse(data);
                for (Object c : (JSONArray) jsonObject.get("objects")){
                    jsonObject = (JSONObject) c;
                    Matcher makeMatch = Pattern.compile("\\d+").matcher((String)jsonObject.get("author"));
                    makeMatch.find();
                    String inputInt = makeMatch.group();
                    Author author = (Author) this.login_window.getAuthors_map().get(Integer.parseInt(inputInt));
                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
                    Date date=null;
                    try {
                        date = sdf.parse((String) jsonObject.get("pub_date"));
                    } catch (java.text.ParseException ex) {
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.author = new Author();
              }
       }
View Full Code Here

    }
       private void readList() {
              System.out.println("Emails of  the authors '" + this.login.getAuthors().size()  + "'.");
              Iterator<Author> it = this.login.getAuthors().iterator();
              while (it.hasNext()) {
                  Author aux = it.next();
                  System.out.println(aux.getEmail());
              }
       }
View Full Code Here

              }
              else if (qName.equalsIgnoreCase("Author")) {         
                    Matcher makeMatch = Pattern.compile("\\d+").matcher((String)temp);
                    makeMatch.find();
                    String inputInt = makeMatch.group();
                    Author author = (Author) this.login.getAuthors_map().get(Integer.parseInt(inputInt));
                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
                    Date date=null;
                    try {
                        if (this.temp_pub_date!=null){
                            date = sdf.parse((String) this.temp_pub_date);
View Full Code Here

TOP

Related Classes of beans.Author

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.