Blame view

src/main/java/fr/plil/sio/examen/services/OwnerServiceImpl.java 893 Bytes
589e1ad3   jcartign   First version
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  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;

      }

      

  }