Commit 1edc61fe authored by benhoumine's avatar benhoumine

L'ajout de services et controllers

parent f41d06e3
package isima.f2.DAO;
package isima.f2.dao;
import org.springframework.data.jpa.repository.JpaRepository;
......
package isima.f2.dao;
import org.springframework.data.jpa.repository.JpaRepository;
import isima.f2.model.Avertissement;
public interface IAvertissementDAO extends JpaRepository<Avertissement, Long>{
}
package isima.f2.dao;
import org.springframework.data.jpa.repository.JpaRepository;
import isima.f2.model.Camion;
public interface ICamionDAO extends JpaRepository<Camion, Long> {
}
package isima.f2.dao;
import org.springframework.data.jpa.repository.JpaRepository;
import isima.f2.model.Employe;
public interface IEmployeDAO extends JpaRepository<Employe, Long> {
}
package isima.f2.dao;
import org.springframework.data.jpa.repository.JpaRepository;
import isima.f2.model.Poubelle;
public interface IPoubelleDAO extends JpaRepository<Poubelle, Long> {
}
package isima.f2.dao;
import org.springframework.data.jpa.repository.JpaRepository;
import isima.f2.model.Raison;
public interface IRaisonDAO extends JpaRepository<Raison, Long>{
}
package isima.f2.contrats;
public interface IAvertissement {
import java.util.List;
import java.util.Optional;
import isima.f2.model.Avertissement;
public interface IAvertissement {
public Avertissement ajouterAvertissement(Avertissement avertissement);
public void deleteAvertissement(Long id);
public Avertissement modifierAvertissement(Avertissement avertissement);
public Optional<Avertissement> getAvertissement(Long id);
public List<Avertissement> getAvertissements();
}
package isima.f2.contrats;
public interface ICamion {
import java.util.List;
import java.util.Optional;
import isima.f2.model.Camion;
public interface ICamion {
public Camion ajouterCamion(Camion camion);
public void deleteCamion(Long id);
public Camion modifierCamion(Camion camion);
public Optional<Camion> getCamion(Long id);
public List<Camion> getCamions();
}
package isima.f2.contrats;
public interface IEmploye {
import java.util.List;
import java.util.Optional;
import isima.f2.model.Employe;
public interface IEmploye {
public Employe ajouterEmploye(Employe employe);
public void deleteEmploye(Long id);
public Employe modifierEmploye(Employe employe);
public Optional<Employe> getEmploye(Long id);
public List<Employe> getEmployes();
}
package isima.f2.contrats;
public interface IPoubelle {
import java.util.List;
import java.util.Optional;
import isima.f2.model.Poubelle;
public interface IPoubelle {
public Poubelle ajouterPoubelle(Poubelle poubelle);
public void deletePoubelle(Long id);
public Poubelle modifierPoubelle(Poubelle poubelle);
public Optional<Poubelle> getPoubelle(Long id);
public List<Poubelle> getPoubelles();
}
package isima.f2.contrats;
public interface IRaison {
import java.util.List;
import java.util.Optional;
import isima.f2.model.Raison;
public interface IRaison {
public Raison ajouterRaison(Raison raison);
public void deleteRaison(Long id);
public Raison modifierRaison(Raison raison);
public Optional<Raison> getRaison(Long id);
public List<Raison> getRaisons();
}
package isima.f2.controllers;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import isima.f2.model.Action;
import isima.f2.services.ImpAction;
@RestController
@RequestMapping("actions")
public class ActionController {
@Autowired
private ImpAction actions;
@GetMapping("/")
public List<Action> getActions() {
return actions.getActions();
}
@GetMapping("/{id}")
public Action getAction(@PathVariable Long id) {
return actions.getAction(id).orElse(null);
}
}
package isima.f2.controllers;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class AvertissementController {
}
......@@ -9,44 +9,35 @@ import javax.persistence.GeneratedValue;
import javax.persistence.Id;
@Entity
public class Action implements Serializable{
public class Action implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
private Long id ;
private Long id;
@Enumerated(EnumType.STRING)
private TypeAction typeAction;
public Action() {
super();
}
public Action(Long id, TypeAction typeAction) {
super();
this.id = id;
this.typeAction = typeAction;
}
public TypeAction getTypeAction() {
return typeAction;
}
public void setTypeAction(TypeAction typeAction) {
this.typeAction = typeAction;
}
public Long getId() {
return id;
}
}
......@@ -4,11 +4,13 @@ import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import isima.f2.DAO.IActionDAO;
import isima.f2.dao.IActionDAO;
import isima.f2.contrats.IAction;
import isima.f2.model.Action;
@Service
public class ImpAction implements IAction {
@Autowired
......
package isima.f2.services;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import isima.f2.contrats.IAvertissement;
import isima.f2.dao.IAvertissementDAO;
import isima.f2.model.Avertissement;
public class ImpAvertissement implements IAvertissement {
@Autowired
private IAvertissementDAO avertissementDAO ;
@Override
public Avertissement ajouterAvertissement(Avertissement avertissement) {
return avertissementDAO.save(avertissement);
}
@Override
public void deleteAvertissement(Long id) {
avertissementDAO.deleteById(id);
}
@Override
public Avertissement modifierAvertissement(Avertissement avertissement) {
deleteAvertissement(avertissement.getId());
return ajouterAvertissement(avertissement);
}
@Override
public Optional<Avertissement> getAvertissement(Long id) {
return avertissementDAO.findById(id);
}
@Override
public List<Avertissement> getAvertissements() {
return avertissementDAO.findAll();
}
}
package isima.f2.services;
import java.util.List;
import java.util.Optional;
import isima.f2.contrats.ICamion;
import isima.f2.model.Camion;
public class ImpCamion implements ICamion {
@Override
public Camion ajouterCamion(Camion camion) {
// TODO Auto-generated method stub
return null;
}
@Override
public void deleteCamion(Long id) {
// TODO Auto-generated method stub
}
@Override
public Camion modifierCamion(Camion camion) {
// TODO Auto-generated method stub
return null;
}
@Override
public Optional<Camion> getCamion(Long id) {
// TODO Auto-generated method stub
return null;
}
@Override
public List<Camion> getCamions() {
// TODO Auto-generated method stub
return null;
}
}
package isima.f2.services;
import java.util.List;
import java.util.Optional;
import isima.f2.contrats.IEmploye;
import isima.f2.model.Employe;
public class ImpEmploye implements IEmploye {
@Override
public Employe ajouterEmploye(Employe employe) {
// TODO Auto-generated method stub
return null;
}
@Override
public void deleteEmploye(Long id) {
// TODO Auto-generated method stub
}
@Override
public Employe modifierEmploye(Employe employe) {
// TODO Auto-generated method stub
return null;
}
@Override
public Optional<Employe> getEmploye(Long id) {
// TODO Auto-generated method stub
return null;
}
@Override
public List<Employe> getEmployes() {
// TODO Auto-generated method stub
return null;
}
}
package isima.f2.services;
import java.util.List;
import java.util.Optional;
import isima.f2.contrats.IPoubelle;
import isima.f2.model.Poubelle;
public class ImpPoubelle implements IPoubelle{
@Override
public Poubelle ajouterPoubelle(Poubelle poubelle) {
// TODO Auto-generated method stub
return null;
}
@Override
public void deletePoubelle(Long id) {
// TODO Auto-generated method stub
}
@Override
public Poubelle modifierPoubelle(Poubelle poubelle) {
// TODO Auto-generated method stub
return null;
}
@Override
public Optional<Poubelle> getPoubelle(Long id) {
// TODO Auto-generated method stub
return null;
}
@Override
public List<Poubelle> getPoubelles() {
// TODO Auto-generated method stub
return null;
}
}
package isima.f2.services;
import java.util.List;
import java.util.Optional;
import isima.f2.contrats.IRaison;
import isima.f2.model.Raison;
public class ImpRaison implements IRaison{
@Override
public Raison ajouterRaison(Raison raison) {
// TODO Auto-generated method stub
return null;
}
@Override
public void deleteRaison(Long id) {
// TODO Auto-generated method stub
}
@Override
public Raison modifierRaison(Raison raison) {
// TODO Auto-generated method stub
return null;
}
@Override
public Optional<Raison> getRaison(Long id) {
// TODO Auto-generated method stub
return null;
}
@Override
public List<Raison> getRaisons() {
// TODO Auto-generated method stub
return null;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment