/**
   * Import borrows
   *
   * @param nodes
   * @return
   */
  public Boolean processBorrows(NodeList nodes) {
    NodeList borrows = nodes.item(0).getChildNodes();

    for (int i = 0; i < borrows.getLength(); i++) {
      if (borrows.item(i).getNodeType() == Node.ELEMENT_NODE) {
        Element borrowNode = (Element) borrows.item(i);

        Borrow borrow = new Borrow();

        borrow.setIdborrow(Integer.parseInt(getTagValue("idborrow", borrowNode)));
        borrow.setProlongations(Integer.parseInt(getTagValue("prolongations", borrowNode)));
        borrow.setBorrowed(
            DatatypeConverter.parseDateTime(getTagValue("borrowed", borrowNode)).getTime());

        // set returned date (can be null)
        try {
          if (getTagValue("returned", borrowNode) != null) {
            borrow.setReturned(
                DatatypeConverter.parseDateTime(getTagValue("returned", borrowNode)).getTime());
          }
        } catch (NullPointerException e) {
        }

        User user = userMgr.findByIduser(Integer.parseInt(getTagValue("user", borrowNode)));
        if (user == null) {
          continue;
        }

        borrow.setUser(user);

        Exemplar exemplar =
            exemplarMgr.findByIdexemplar(Integer.parseInt(getTagValue("exemplar", borrowNode)));
        if (exemplar == null) {
          continue;
        }

        borrow.setExemplar(exemplar);

        try {
          borrowMgr.Save(borrow);
        } catch (EJBException ex) {
          ex.printStackTrace(System.out);
        }
      }
    }
    return true;
  }
  /**
   * Import bookings
   *
   * @param nodes
   * @return
   */
  private Boolean processBookings(NodeList nodes) {
    NodeList bookings = nodes.item(0).getChildNodes();

    for (int i = 0; i < bookings.getLength(); i++) {
      if (bookings.item(i).getNodeType() == Node.ELEMENT_NODE) {
        Element bookingNode = (Element) bookings.item(i);

        Booking booking = new Booking();

        booking.setIdbooking(Integer.parseInt(getTagValue("idbooking", bookingNode)));
        booking.setState(Integer.parseInt(getTagValue("state", bookingNode)));
        booking.setDate(
            DatatypeConverter.parseDateTime(getTagValue("date", bookingNode)).getTime());

        Book book = bookMgr.findByIdbook(Integer.parseInt(getTagValue("book", bookingNode)));
        if (book == null) {
          continue;
        }

        booking.setBook(book);

        User user = userMgr.findByIduser(Integer.parseInt(getTagValue("user", bookingNode)));
        if (user == null) {
          continue;
        }

        booking.setUser(user);

        try {
          bookingMgr.Save(booking);
        } catch (EJBException ex) {
          ex.printStackTrace(System.out);
        }
      }
    }
    return true;
  }