StudentLoanManagement
|
Public Member Functions | |
List< Item > | getAllItems () |
List< Item > | getAvailableItems () |
Optional< Item > | getItemById (Long id) |
List< Item > | getItemsById (List< Long > itemsId) |
List< Item > | getItemsByUser (Long id) |
List< Item > | getItemsByAvailability (ItemStatus status) |
Item | saveItem (Item item) |
List< LoanAndItemDto > | getItemsLentByUserWithActiveLoans (Long userId) |
List< LoanAndItemDto > | getItemsBorrowedByUserWithActiveLoans (Long userId) |
Item | createItem (Item item) |
void | deleteItem (Long id) |
Service class for managing items in the system. Handles operations such as retrieving, creating, saving, and deleting items.
Definition at line 24 of file ItemService.java.
Item com.student_loan.service.ItemService.createItem | ( | Item | item | ) |
Creates a new item in the repository.
item | The item to create. |
RuntimeException | if the item already exists or the owner does not exist. |
Definition at line 160 of file ItemService.java.
void com.student_loan.service.ItemService.deleteItem | ( | Long | id | ) |
Deletes an item by its ID.
id | The ID of the item to delete. |
Definition at line 177 of file ItemService.java.
List< Item > com.student_loan.service.ItemService.getAllItems | ( | ) |
Retrieves all items from the repository.
Definition at line 37 of file ItemService.java.
List< Item > com.student_loan.service.ItemService.getAvailableItems | ( | ) |
Retrieves only items with AVAILABLE status.
Definition at line 46 of file ItemService.java.
Optional< Item > com.student_loan.service.ItemService.getItemById | ( | Long | id | ) |
Finds an item by its ID.
id | The item ID. |
Definition at line 56 of file ItemService.java.
List< LoanAndItemDto > com.student_loan.service.ItemService.getItemsBorrowedByUserWithActiveLoans | ( | Long | userId | ) |
Definition at line 130 of file ItemService.java.
List< Item > com.student_loan.service.ItemService.getItemsByAvailability | ( | ItemStatus | status | ) |
Saves an item to the repository.
item | The item to save. |
RuntimeException | if the item's owner does not exist. |
Definition at line 98 of file ItemService.java.
List< Item > com.student_loan.service.ItemService.getItemsById | ( | List< Long > | itemsId | ) |
Finds a list of items by their IDs.
itemsId | List of item IDs. |
Definition at line 66 of file ItemService.java.
List< Item > com.student_loan.service.ItemService.getItemsByUser | ( | Long | id | ) |
Retrieves all items owned by a specific user.
id | User ID. |
RuntimeException | if the user is not found. |
Definition at line 83 of file ItemService.java.
List< LoanAndItemDto > com.student_loan.service.ItemService.getItemsLentByUserWithActiveLoans | ( | Long | userId | ) |
Definition at line 109 of file ItemService.java.
Item com.student_loan.service.ItemService.saveItem | ( | Item | item | ) |
Definition at line 101 of file ItemService.java.