OwnerServiceImpl.java
893 Bytes
package fr.plil.sio.examen.services;
import fr.plil.sio.examen.api.Owner;
import fr.plil.sio.examen.repositories.OwnerRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class OwnerServiceImpl implements OwnerService {
@Autowired
private OwnerRepository ownerRepository;
@Override
public void delete(Owner owner) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Owner create(String name) {
if(name == null) {
throw new IllegalArgumentException("name must be not null");
}
Owner owner = new Owner();
owner.setName(name);
ownerRepository.save(owner);
return owner;
}
}