Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
d28f264
maven srping boot
franciscofarrando Apr 22, 2025
2c2523b
uml
planetWeb252 Apr 22, 2025
bb8c067
class created
planetWeb252 Apr 22, 2025
3017fc8
create class and write
planetWeb252 Apr 22, 2025
67eddd7
create class and write
planetWeb252 Apr 22, 2025
3dc666e
implement book
AsterixKo Apr 22, 2025
c66ede2
merge francisco main clase isssue
franciscofarrando Apr 22, 2025
f56647b
Merge branch 'main' into javier
AsterixKo Apr 22, 2025
0a4ad34
issue repository
franciscofarrando Apr 22, 2025
37a2839
Entity creadas y propierties
planetWeb252 Apr 22, 2025
e99cf23
Merge branch 'Juanjo'
planetWeb252 Apr 22, 2025
feb6f89
issue done
franciscofarrando Apr 22, 2025
daf6ab4
class Author
planetWeb252 Apr 22, 2025
11d9a11
clase book
AsterixKo Apr 22, 2025
849b6a8
Merge branch 'main' into javier
AsterixKo Apr 22, 2025
8f4f613
Merge branch 'main' into francisco
franciscofarrando Apr 22, 2025
e89162b
francisco v2
franciscofarrando Apr 22, 2025
38ae49f
no erros, created tables in mysql
planetWeb252 Apr 22, 2025
f786b4e
Implementar menu
AsterixKo Apr 22, 2025
ce95026
resolver conflictos
AsterixKo Apr 22, 2025
8ee9a05
Delete src/main/resources/application.properties
franciscofarrando Apr 22, 2025
6ce7608
Merge branch 'javier'
AsterixKo Apr 22, 2025
2bd31ba
spring.application.name restored
franciscofarrando Apr 22, 2025
aef2204
git ignore fixed aplication properties
franciscofarrando Apr 22, 2025
7005509
embedded
planetWeb252 Apr 22, 2025
0650d68
Merge branch 'Juanjo'
planetWeb252 Apr 22, 2025
2ee8965
menu created
planetWeb252 Apr 23, 2025
a23ee54
Merge branch 'Juanjo'
planetWeb252 Apr 23, 2025
5f34c37
implementar ironlibraryAppliation
AsterixKo Apr 23, 2025
c7a0a62
resolve conflicts
AsterixKo Apr 23, 2025
70ab7b3
whit run
planetWeb252 Apr 23, 2025
628801d
addbook
AsterixKo Apr 23, 2025
40730e3
whit findByTitle
planetWeb252 Apr 23, 2025
258129c
whit findByTitle
planetWeb252 Apr 23, 2025
c2b240d
add book
AsterixKo Apr 23, 2025
70a82fc
resolver conflictos
AsterixKo Apr 23, 2025
e73a904
whit points 2,3,4
planetWeb252 Apr 23, 2025
8a61439
Author class
planetWeb252 Apr 29, 2025
92ded5d
solucionar conflictos
AsterixKo Apr 29, 2025
43feb08
book y issue
AsterixKo Apr 29, 2025
e5969fd
fixed
franciscofarrando Apr 29, 2025
95a68c0
fixed v2
franciscofarrando Apr 29, 2025
1cf14e1
repositories
planetWeb252 Apr 29, 2025
6ef2147
repositories v2
franciscofarrando Apr 29, 2025
20e0b33
LibraryApplication
AsterixKo Apr 29, 2025
6b4f058
appHandler
planetWeb252 Apr 29, 2025
f02f83f
exceptions
franciscofarrando Apr 29, 2025
b278779
insert
planetWeb252 Apr 29, 2025
f4eeea4
uml
franciscofarrando Apr 29, 2025
25618f0
test
planetWeb252 Apr 29, 2025
26ca57f
test2
planetWeb252 Apr 29, 2025
2192804
test2
planetWeb252 Apr 29, 2025
0ba2543
implementar find byAuthor y along author
AsterixKo Apr 29, 2025
585c347
last dataTransfer
franciscofarrando Apr 29, 2025
8db12d4
test3
planetWeb252 Apr 29, 2025
cc9c3a4
test added
franciscofarrando Apr 29, 2025
c36a01b
readme
planetWeb252 Apr 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/mvnw text eol=lf
*.cmd text eol=crlf
35 changes: 35 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/

src/main/resources/application.properties
19 changes: 19 additions & 0 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
wrapperVersion=3.3.2
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
210 changes: 50 additions & 160 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,188 +1,78 @@
![logo_ironhack_blue 7](https://user-images.githubusercontent.com/23629340/40541063-a07a0a8a-601a-11e8-91b5-2f13e4e6b441.png)
# 📚 IronLibrary – Sistema de Gestión de Biblioteca en Java

# HW | Java IronLibrary (Unit 3 homework)
Este proyecto es una aplicación de consola desarrollada en Java que permite gestionar una biblioteca académica. A través de un menú interactivo, los usuarios pueden registrar libros y autores, emitir préstamos a estudiantes, buscar libros por distintos criterios y consultar información sobre préstamos activos.

## Introduction
## 🧩 Estructura del Proyecto

For this homework, you will be building a Library Management System, that will help managing and acquiring data about the books that are being used by students.
El sistema se basa en cuatro clases principales:

## Instructions
- **Book**: Representa un libro con atributos como `isbn`, `title`, `category` y `quantity`.
- **Author**: Representa un autor con atributos como `authorId`, `name`, `email` y una relación uno a uno con un `Book`.
- **Student**: Representa a un estudiante con atributos como `usn` (número único de estudiante) y `name`.
- **Issue**: Representa un préstamo de libro con atributos como `issueId`, `issueDate`, `returnDate` y relaciones uno a uno con un `Student` y un `Book`.

Let's walk through the details of the homework:
## 🖥️ Funcionalidades

### Classes
- Agregar libros con sus autores.
- Buscar libros por título, categoría o autor.
- Listar todos los libros junto a su autor.
- Emitir libros a estudiantes (gestión de préstamos).
- Consultar los libros prestados a un estudiante por su USN.
- Validación de entradas y control de errores.
- Persistencia de datos con base de datos SQL.

Four main classes are necessary to complete this homework.
## ⚙️ Requisitos Previos

These classes will be called **Author**, **Book**, **Student** and **Issue**.
- **Java**
- **Maven**
- **MySQL** (u otro sistema de gestión de base de datos SQL compatible)
- **IDE recomendado**: IntelliJ IDEA

<br>
## 🧪 Configuración de Base de Datos

**Book class**
**1**. Crea una base de datos en MySQL llamada `ironlibrary`.

This class will have:
```sql
CREATE DATABASE ironlibrary;
```

- Variable called `isbn` of data type `string`, representing the **International Standard Book Number** and acting as the unique identifier for the table book (Private member)
- Variable called `title` of data type `string` (Private member)
- Variable called `category` of data type `string` (Private member)
- Variable called `quantity` of data type `integer` (Private member)
- A parameterized constructor that takes `isbn`, `title`, `category` and a `quantity`
- Public Getter functions to access these variables
- Public Setter functions to change these variables
- Optional attributes are accepted if needed based on the code structure

<br>
**2.Configura tu conexión en el archivo src/main/resources/application.properties (si usas Spring) o directamente en el
código JDBC:**

**Author class**

This class will have:
``` properties

- Variable called `authorId` of data type `integer`, auto-incremented (Private member)
- Variable called `name` of data type `string` (Private member)
- Variable called `email` of data type `string` (Private member)
- Variable called `authorBook` of data type `Book`, representing a One-to-One relationship with `Book` (Private member)
- A parameterized constructor that takes `name`, `email` and `authorBook`
- Public Getter functions to access these variables
- Public Setter functions to change these variables
- Optional attributes are accepted if needed based on the code structure

<br>

**Issue class**

This class will have:

- Variable called `issueId` of data type `integer`, auto-incremented (Private member)
- Variable called `issueDate` of data type `string` (Private member)
- Variable called `returnDate` of data type `string` (Private member)
- Variable called `issueStudent` of data type `Student`, representing a One-to-One relationship with `Student`(Private member)
- Variable called `issueBook` of data type `Book`, representing a One-to-One relationship with `Book` (Private member)
- A parameterized constructor that takes `issueDate`, `returnDate`, `issueStudent` and `issueBook`
- Public Getter functions to access these variables
- Public Setter functions to change these variables
- Optional attributes are accepted if needed based on the code structure

<br>

**Student class**

This class will have:

- Variable called `usn` of data type `string`, representing the **Universal Student Number** and acting as the unique identifier for the table student (Private member)
- Variable called `name` of data type `string` (Private member)
- A parameterized constructor that takes `usn` and `name`
- Public Getter functions to access these variables
- Public Setter functions to change these variables
- Optional attributes are accepted if needed based on the code structure

## How the application works

After starting this application, a list of options will pop up for the user. The user will be asked to input a number based on the list of options displayed, such as adding a book, searching for a book, issuing a book for a student, etc.
After a certain action is executed, the menu is re-displayed for the user automatically.

The menu should have the following options:

1. Add a book
2. Search book by title
3. Search book by category
4. Search book by Author
5. List all books along with author
6. Issue book to student
7. List books by usn
8. Exit

## Actions

1. **Add a book**: This action is responsible of adding a book and its author in the system. The user will be prompted to enter the details of both the book and the author in the following format:

```
Enter your choice: 1
Enter isbn : 978-3-16-148410-0
Enter title : The Notebook
Enter category : Romance
Enter Author name : Nicholas Sparks
Enter Author mail : nicholassparks@gmail.com
Enter number of books : 4
```

2. **Search book by title**: This action is responsible for searching a book by title.

```
Enter your choice: 2
Enter title : The Notebook

Book ISBN Book Title Category No of Books
978-3-16-148410-0 The Notebook Romance 4
jdbc.url=jdbc:mysql://localhost:3306/ironlibrary
jdbc.user=tu_usuario
jdbc.password=tu_contraseña
```
**🚀 Ejecución del Proyecto**
Clonar el repositorio:

3. **Search book by category**: This action is responsible for searching a book by category.
```bash

git clone https://github.com/franciscofarrando/homework-java-ironlibrary.git
cd homework-java-ironlibrary
Compilar y ejecutar (usando Maven):
```
Enter your choice: 3
Enter category : Romance

Book ISBN Book Title Category No of Books
978-3-16-148410-0 The Notebook Romance 4
```

4. **Search book by author**: This action is responsible for searching a book by author name.

```
Enter your choice: 4
Enter name : Nicholas Sparks

Book ISBN Book Title Category No of Books
978-3-16-148410-0 The Notebook Romance 4
```bash
mvn clean install
mvn exec:java
Asegúrate de tener en el pom.xml configurado el plugin exec-maven-plugin con el mainClass correcto.
```
## ✅ Pruebas
**Este proyecto contiene pruebas unitarias para métodos relevantes. Para ejecutarlas:**

5. **List all books along with author**: This action is responsible for listing all the books available and there corresponding authors.

```
Enter your choice: 5

Book ISBN Book Title Category No of Books Author name Author mail
978-3-16-148410-0 The Notebook Romance 4 Nicholas Sparks nicholassparks@gmail.com
978-3-17-148410-0 Da Vinci Code Mystery 5 Dan Brown danbrown@gmail.com
```

6. **Issue book to student**: This action is responsible for creating a student and issuing him/her the specified book. The date issued represent the current date and the return date should be after 7 days.

```
Enter your choice: 6
Enter usn : 09003688800
Enter name : John Doe
Enter book ISBN : 978-3-17-148410-0

Book issued. Return date : Mon Aug 01 19:45:40 EEST 2022
```bash
mvn test
```

7. **List books by usn**: This action is responsible for listing all books rented by the specified student.

```
Enter your choice: 7
Enter usn : 09003688800

Book Title Student Name Return date
Da Vinci Code John Doe 2022-08-01 16:45:40.636000
```

## Requirements

For this project, you must accomplish all of the following:

1. Navigate through a text-based menu using Standard Input and Output.
2. Create unit tests for every method other than basic getters, setters and constructors (getters and setters with logic do require unit tests).
3. Handle all exceptions gracefully (incorrect input should not crash the program).
4. All data should be stored in a normalized SQL database.

### Bonus

1. Add more options that can help display more information such as **List books to be returned today**, etc.

## Important Notes

- Everyone in the squad should contribute equally to the project in time and lines of code written.
- All code must be reviewed before it is merged into the `master` branch.
- All squad members must participate in code review.
- Every repository should have a README file with clear instructions, demo files, or any documentation needed so other teams don't have problems with the review.
- This is intended to be a challenging assignment. You will have to rely heavily on your teammates and independent research. Learning independently is a hallmark of a good developer and our job is to turn you into good developers. This process may be frustrating but you will learn a ton!
## 👨🏻‍💻 Autores
- **Francisco Farrando** - [franciscofarrando]
- **Javier Moneo** - [AsterixKo]
- **Juan Jose Franco** - [DevJerryX]
Loading