Documentation
This commit is contained in:
@@ -3,19 +3,31 @@ package de.etecture.ga.service;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import de.etecture.ga.model.Garage;
|
||||
import de.etecture.ga.repository.GarageRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
/**
|
||||
* Service to handle all {@link Garage} related tasks
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class GarageService {
|
||||
|
||||
private final GarageRepository repository;
|
||||
|
||||
|
||||
public Optional<Garage> getGarage(long id) {
|
||||
return repository.findById(id);
|
||||
|
||||
/**
|
||||
* Reads the {@link Garage} object for the given id.
|
||||
*
|
||||
* @param garageId id of {@link Garage} to read
|
||||
*
|
||||
* @return a {@link Garage} for the given id
|
||||
*/
|
||||
public Optional<Garage> getGarage(long garageId) {
|
||||
Assert.isTrue(garageId > 0, "A valid garageId must be given");
|
||||
|
||||
return repository.findById(garageId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user