Commit f41d06e3 authored by benhoumine's avatar benhoumine

Infrastructure total du projet

parent d1286988
package isima.f2.DAO;
import org.springframework.data.jpa.repository.JpaRepository;
import isima.f2.model.Action;
public interface IActionDAO extends JpaRepository<Action, Long>{
}
package isima.f2.contrats;
import java.util.List;
import java.util.Optional;
import isima.f2.model.Action;
public interface IAction {
public Action ajouterAction(Action action);
public void deleteAction(Long id);
public Action modifierAction(Action action);
public Optional<Action> getAction(Long id);
public List<Action> getActions();
}
package isima.f2.contrats;
public interface IAvertissement {
}
package isima.f2.contrats;
public interface ICamion {
}
package isima.f2.contrats;
public interface IEmploye {
}
package isima.f2.contrats;
public interface IPoubelle {
}
package isima.f2.contrats;
public interface IRaison {
}
package isima.f2.controllers;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class ActionController {
}
......@@ -3,28 +3,50 @@ package isima.f2.model;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
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 ;
@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;
}
}
public void setId(Long id) {
this.id = id;
}
}
package isima.f2.model;
public class TypeAction {
public enum TypeAction {
RAMASSER, NETOYER, REPARER
}
package isima.f2.services;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import isima.f2.DAO.IActionDAO;
import isima.f2.contrats.IAction;
import isima.f2.model.Action;
public class ImpAction implements IAction {
@Autowired
private IActionDAO actionDao ;
@Override
public Action ajouterAction(Action action) {
return actionDao.save(action);
}
@Override
public void deleteAction(Long id) {
actionDao.deleteById(id);
}
@Override
public Action modifierAction(Action action) {
deleteAction(action.getId());
return ajouterAction(action);
}
@Override
public Optional<Action> getAction(Long id) {
return actionDao.findById(id);
}
@Override
public List<Action> getActions() {
return actionDao.findAll();
}
}
package isima.f2.services;
import isima.f2.contrats.IAvertissement;
public class ImpAvertissement implements IAvertissement {
}
package isima.f2.services;
import isima.f2.contrats.ICamion;
public class ImpCamion implements ICamion {
}
package isima.f2.services;
import isima.f2.contrats.IEmploye;
public class ImpEmploye implements IEmploye {
}
package isima.f2.services;
import isima.f2.contrats.IPoubelle;
public class ImpPoubelle implements IPoubelle{
}
package isima.f2.services;
import isima.f2.contrats.IRaison;
public class ImpRaison implements IRaison{
}
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