Commit 65f1240c6bc4b04aa73344f491be24fb6d79a429
1 parent
4ca22bac
Ajout des groupes de travail
Showing
16 changed files
with
202 additions
and
93 deletions
Show diff stats
PFE06/src/main/java/com/PFE/ServerManager/AppConfig.java
@@ -21,6 +21,9 @@ public class AppConfig { | @@ -21,6 +21,9 @@ public class AppConfig { | ||
21 | RoleRepository roleRepository; | 21 | RoleRepository roleRepository; |
22 | 22 | ||
23 | @Autowired | 23 | @Autowired |
24 | + TeamRepository teamRepository; | ||
25 | + | ||
26 | + @Autowired | ||
24 | BCryptPasswordEncoder bCryptPasswordEncoder; | 27 | BCryptPasswordEncoder bCryptPasswordEncoder; |
25 | 28 | ||
26 | @PostConstruct | 29 | @PostConstruct |
@@ -32,11 +35,11 @@ public class AppConfig { | @@ -32,11 +35,11 @@ public class AppConfig { | ||
32 | if(roleRepository.count() != 2) { | 35 | if(roleRepository.count() != 2) { |
33 | roleRepository.deleteAll(); | 36 | roleRepository.deleteAll(); |
34 | Role roleAdmin = new Role(); | 37 | Role roleAdmin = new Role(); |
35 | - roleAdmin.setRole_id(1); | 38 | + roleAdmin.setRoleId(1); |
36 | roleAdmin.setRole("ADMIN"); | 39 | roleAdmin.setRole("ADMIN"); |
37 | roleRepository.save(roleAdmin); | 40 | roleRepository.save(roleAdmin); |
38 | Role roleUser = new Role(); | 41 | Role roleUser = new Role(); |
39 | - roleUser.setRole_id(2); | 42 | + roleUser.setRoleId(2); |
40 | roleUser.setRole("USER"); | 43 | roleUser.setRole("USER"); |
41 | roleRepository.save(roleUser); | 44 | roleRepository.save(roleUser); |
42 | } | 45 | } |
@@ -60,10 +63,38 @@ public class AppConfig { | @@ -60,10 +63,38 @@ public class AppConfig { | ||
60 | 63 | ||
61 | Customer temp = customerRepository.findByEmail(conf.getAdminEmail()); | 64 | Customer temp = customerRepository.findByEmail(conf.getAdminEmail()); |
62 | Role userRole = roleRepository.findByRole("ADMIN"); | 65 | Role userRole = roleRepository.findByRole("ADMIN"); |
63 | - n.setRoles(new HashSet<Role>(Arrays.asList(userRole))); | 66 | + n.setRoles(new HashSet<>(Arrays.asList(userRole))); |
67 | + | ||
68 | + ////////////////////////////////////////// | ||
69 | + /* | ||
70 | + Customer p = new Customer(); | ||
71 | + p.setEmail("admin@admin.fr"); | ||
72 | + p.setPassword(bCryptPasswordEncoder.encode("azerty")); | ||
73 | + p.setId((int)(customerRepository.count() + 2)); | ||
74 | + p.setActive(1); | ||
75 | + | ||
76 | + Role userRole2 = roleRepository.findByRole("USER"); | ||
77 | + p.setRoles(new HashSet<>(Arrays.asList(userRole2))); | ||
78 | + customerRepository.save(p); | ||
79 | + */ | ||
80 | + /////////////////////////////////// | ||
64 | 81 | ||
65 | if(temp == null) { | 82 | if(temp == null) { |
66 | customerRepository.save(n); | 83 | customerRepository.save(n); |
84 | + | ||
67 | } | 85 | } |
86 | + | ||
87 | + /* Partie sur les groupes */ | ||
88 | + Team g = new Team(); | ||
89 | + g.setTeamId((int)(teamRepository.count() +1)); | ||
90 | + g.setTeam("Labo1"); | ||
91 | + Set<Customer> tempC = new HashSet<>(); | ||
92 | + tempC.add(n); | ||
93 | + //tempC.add(p); | ||
94 | + g.setCustomers(tempC); | ||
95 | + //g.setCustomers(new HashSet<>(Arrays.asList(n, p))); | ||
96 | + teamRepository.save(g); | ||
97 | + ////////////////////////// | ||
98 | + | ||
68 | } | 99 | } |
69 | } | 100 | } |
70 | \ No newline at end of file | 101 | \ No newline at end of file |
PFE06/src/main/java/com/PFE/ServerManager/Customer.java
@@ -14,7 +14,7 @@ public class Customer{ | @@ -14,7 +14,7 @@ public class Customer{ | ||
14 | /*@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "customer_seq_gen") | 14 | /*@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "customer_seq_gen") |
15 | @SequenceGenerator(name = "customer_seq_gen", sequenceName = "customer_id_seq", allocationSize=1, initialValue=3)*/ | 15 | @SequenceGenerator(name = "customer_seq_gen", sequenceName = "customer_id_seq", allocationSize=1, initialValue=3)*/ |
16 | @Basic(optional = false) | 16 | @Basic(optional = false) |
17 | - private Integer customer_id; | 17 | + private Integer customerId; |
18 | 18 | ||
19 | @Column(name = "email") | 19 | @Column(name = "email") |
20 | private String email; | 20 | private String email; |
@@ -26,30 +26,31 @@ public class Customer{ | @@ -26,30 +26,31 @@ public class Customer{ | ||
26 | private int active; | 26 | private int active; |
27 | 27 | ||
28 | @ManyToMany(cascade = CascadeType.ALL) | 28 | @ManyToMany(cascade = CascadeType.ALL) |
29 | - @JoinTable(name = "customer_role", joinColumns = @JoinColumn(name = "customer_id"), inverseJoinColumns = @JoinColumn(name = "role_id")) | 29 | + @JoinTable(name = "customer_role", joinColumns = @JoinColumn(name = "customerId"), inverseJoinColumns = @JoinColumn(name = "roleId")) |
30 | private Set<Role> roles; | 30 | private Set<Role> roles; |
31 | 31 | ||
32 | @ManyToMany(cascade = CascadeType.ALL) | 32 | @ManyToMany(cascade = CascadeType.ALL) |
33 | - @JoinTable(name = "customer_maj", joinColumns = @JoinColumn(name = "customer_id"), inverseJoinColumns = @JoinColumn(name = "maj_id")) | ||
34 | - private Set<Maj> maj; | 33 | + @JoinTable(name = "customer_update", joinColumns = @JoinColumn(name = "customerId"), inverseJoinColumns = @JoinColumn(name = "updateId")) |
34 | + private Set<Update> update; | ||
35 | + | ||
35 | 36 | ||
36 | public void setRoles(Set<Role> roles) { this.roles = roles; } | 37 | public void setRoles(Set<Role> roles) { this.roles = roles; } |
37 | public Set<Role> getRoles() { return roles; } | 38 | public Set<Role> getRoles() { return roles; } |
38 | 39 | ||
39 | - public void setMaj(Set<Maj> maj) { | ||
40 | - this.maj = maj; | 40 | + public void setUpdate(Set<Update> update) { |
41 | + this.update = update; | ||
41 | } | 42 | } |
42 | - public Set<Maj> getMaj() { | ||
43 | - return maj; | 43 | + public Set<Update> getUpdate() { |
44 | + return update; | ||
44 | } | 45 | } |
45 | 46 | ||
46 | public String getRole(){ | 47 | public String getRole(){ |
47 | return roles.iterator().next().getRole(); | 48 | return roles.iterator().next().getRole(); |
48 | } | 49 | } |
49 | public void setId(Integer id) { | 50 | public void setId(Integer id) { |
50 | - this.customer_id = id; | 51 | + this.customerId = id; |
51 | } | 52 | } |
52 | - public Integer getCustomer_id() { return customer_id; } | 53 | + public Integer getCustomerId() { return customerId; } |
53 | 54 | ||
54 | public void setEmail(String email) { | 55 | public void setEmail(String email) { |
55 | this.email = email; | 56 | this.email = email; |
PFE06/src/main/java/com/PFE/ServerManager/MainController.java
@@ -31,10 +31,13 @@ public class MainController { | @@ -31,10 +31,13 @@ public class MainController { | ||
31 | CustomerRepository customerRepository; | 31 | CustomerRepository customerRepository; |
32 | 32 | ||
33 | @Autowired | 33 | @Autowired |
34 | + TeamRepository teamRepository; | ||
35 | + | ||
36 | + @Autowired | ||
34 | RoleRepository roleRepository; | 37 | RoleRepository roleRepository; |
35 | 38 | ||
36 | @Autowired | 39 | @Autowired |
37 | - MajRepository majRepository; | 40 | + UpdateRepository updateRepository; |
38 | 41 | ||
39 | @Autowired | 42 | @Autowired |
40 | BCryptPasswordEncoder bCryptPasswordEncoder; | 43 | BCryptPasswordEncoder bCryptPasswordEncoder; |
@@ -66,14 +69,14 @@ public class MainController { | @@ -66,14 +69,14 @@ public class MainController { | ||
66 | return modelAndView; | 69 | return modelAndView; |
67 | } | 70 | } |
68 | 71 | ||
69 | - @GetMapping(value="/session") | ||
70 | - public ModelAndView session() { | 72 | + @GetMapping(value="/update") |
73 | + public ModelAndView update() { | ||
71 | ModelAndView modelAndView = new ModelAndView(); | 74 | ModelAndView modelAndView = new ModelAndView(); |
72 | Authentication auth = SecurityContextHolder.getContext().getAuthentication(); | 75 | Authentication auth = SecurityContextHolder.getContext().getAuthentication(); |
73 | Customer customer = customerRepository.findByEmail(auth.getName()); | 76 | Customer customer = customerRepository.findByEmail(auth.getName()); |
74 | modelAndView.addObject("customerName", customer.getEmail().split("@")[0]); | 77 | modelAndView.addObject("customerName", customer.getEmail().split("@")[0]); |
75 | modelAndView.addObject("customerRole", customer.getRole()); | 78 | modelAndView.addObject("customerRole", customer.getRole()); |
76 | - modelAndView.addObject("customerMaj", customer.getMaj()); | 79 | + modelAndView.addObject("customerMaj", (teamRepository.findByCustomersContaining(customer)).getUpdate()); |
77 | List<Node> nodes = nodeRepository.findAll(); | 80 | List<Node> nodes = nodeRepository.findAll(); |
78 | modelAndView.addObject("nodes", nodes); | 81 | modelAndView.addObject("nodes", nodes); |
79 | 82 | ||
@@ -94,7 +97,7 @@ public class MainController { | @@ -94,7 +97,7 @@ public class MainController { | ||
94 | } | 97 | } |
95 | 98 | ||
96 | modelAndView.addObject("customerFiles", filesName); | 99 | modelAndView.addObject("customerFiles", filesName); |
97 | - modelAndView.setViewName("session"); | 100 | + modelAndView.setViewName("update"); |
98 | 101 | ||
99 | return modelAndView; | 102 | return modelAndView; |
100 | } | 103 | } |
@@ -244,19 +247,20 @@ public class MainController { | @@ -244,19 +247,20 @@ public class MainController { | ||
244 | Authentication auth = SecurityContextHolder.getContext().getAuthentication(); | 247 | Authentication auth = SecurityContextHolder.getContext().getAuthentication(); |
245 | Customer customer = customerRepository.findByEmail(auth.getName()); | 248 | Customer customer = customerRepository.findByEmail(auth.getName()); |
246 | 249 | ||
247 | - Maj maj_c = new Maj(); | ||
248 | - maj_c.setMaj(name); | ||
249 | - maj_c.setDate(date); | ||
250 | - maj_c.setNodes(nodes); | ||
251 | - maj_c.setFile(file); | 250 | + Update update_c = new Update(); |
251 | + update_c.setUpdate(name); | ||
252 | + update_c.setDate(date); | ||
253 | + update_c.setNodes(nodes); | ||
254 | + update_c.setFile(file); | ||
255 | + | ||
256 | + updateRepository.save(update_c); // ajouter la mise a jour dans la table | ||
252 | 257 | ||
253 | - majRepository.save(maj_c); // ajouter la mise a jour dans la table | ||
254 | - HashSet<Maj> majs = new HashSet<Maj>(Arrays.asList(maj_c)); | ||
255 | - majs.addAll(customer.getMaj()); | ||
256 | - customer.setMaj(majs); | ||
257 | - customerRepository.save(customer); // permet de rendre effective la jointure entre customer et maj | 258 | + System.out.println("team name : " + (teamRepository.findByCustomersContaining(customer)).getTeam()); |
259 | + Team teamOfCustomer = teamRepository.findByCustomersContaining(customer); | ||
260 | + teamOfCustomer.addUpdate(update_c); | ||
261 | + teamRepository.save(teamOfCustomer); // permet de rendre effective la jointure entre customer et maj | ||
258 | 262 | ||
259 | - return "redirect:/session"; | 263 | + return "redirect:/update"; |
260 | } | 264 | } |
261 | 265 | ||
262 | @PostMapping(path="/runmaj") | 266 | @PostMapping(path="/runmaj") |
@@ -264,27 +268,27 @@ public class MainController { | @@ -264,27 +268,27 @@ public class MainController { | ||
264 | Authentication auth = SecurityContextHolder.getContext().getAuthentication(); | 268 | Authentication auth = SecurityContextHolder.getContext().getAuthentication(); |
265 | Customer customer = customerRepository.findByEmail(auth.getName()); | 269 | Customer customer = customerRepository.findByEmail(auth.getName()); |
266 | 270 | ||
267 | - Maj maj_c = new Maj(); | ||
268 | - maj_c.setMaj(name); | ||
269 | - maj_c.setDate(date); | ||
270 | - maj_c.setNodes(nodes); | ||
271 | - maj_c.setFile(file); | 271 | + Update update_c = new Update(); |
272 | + update_c.setUpdate(name); | ||
273 | + update_c.setDate(date); | ||
274 | + update_c.setNodes(nodes); | ||
275 | + update_c.setFile(file); | ||
272 | 276 | ||
273 | Map<String, Object> data = new HashMap<String, Object>(); | 277 | Map<String, Object> data = new HashMap<String, Object>(); |
274 | - data.put("name", maj_c.getMaj()); | ||
275 | - data.put("date", maj_c.getDate()); | ||
276 | - data.put("file", maj_c.getFile()); | ||
277 | - data.put("nodes", maj_c.getNodes().split(";")); | 278 | + data.put("name", update_c.getUpdate()); |
279 | + data.put("date", update_c.getDate()); | ||
280 | + data.put("file", update_c.getFile()); | ||
281 | + data.put("nodes", update_c.getNodes().split(";")); | ||
278 | Yaml yaml = new Yaml(); | 282 | Yaml yaml = new Yaml(); |
279 | FileWriter writer = null; | 283 | FileWriter writer = null; |
280 | try { | 284 | try { |
281 | - writer = new FileWriter("toflash/" + customer.getEmail().split("@")[0] + "_" + maj_c.getMaj() + ".yaml"); | 285 | + writer = new FileWriter("toflash/" + customer.getEmail().split("@")[0] + "_" + update_c.getUpdate() + ".yaml"); |
282 | } catch (IOException e) { | 286 | } catch (IOException e) { |
283 | e.printStackTrace(); | 287 | e.printStackTrace(); |
284 | } | 288 | } |
285 | yaml.dump(data, writer); | 289 | yaml.dump(data, writer); |
286 | 290 | ||
287 | - return "redirect:/session"; | 291 | + return "redirect:/update"; |
288 | } | 292 | } |
289 | 293 | ||
290 | @PostMapping(path="/startsavedmaj") | 294 | @PostMapping(path="/startsavedmaj") |
@@ -292,16 +296,16 @@ public class MainController { | @@ -292,16 +296,16 @@ public class MainController { | ||
292 | public void startSavedMaj(@RequestParam String majname){ | 296 | public void startSavedMaj(@RequestParam String majname){ |
293 | Authentication auth = SecurityContextHolder.getContext().getAuthentication(); | 297 | Authentication auth = SecurityContextHolder.getContext().getAuthentication(); |
294 | Customer customer = customerRepository.findByEmail(auth.getName()); | 298 | Customer customer = customerRepository.findByEmail(auth.getName()); |
295 | - Maj maj = majRepository.findByMaj(majname); | 299 | + Update update = updateRepository.findByUpdate(majname); |
296 | Map<String, Object> data = new HashMap<String, Object>(); | 300 | Map<String, Object> data = new HashMap<String, Object>(); |
297 | - data.put("name", maj.getMaj()); | ||
298 | - data.put("date", maj.getDate()); | ||
299 | - data.put("file", maj.getFile()); | ||
300 | - data.put("nodes", maj.getNodes().split(";")); | 301 | + data.put("name", update.getUpdate()); |
302 | + data.put("date", update.getDate()); | ||
303 | + data.put("file", update.getFile()); | ||
304 | + data.put("nodes", update.getNodes().split(";")); | ||
301 | Yaml yaml = new Yaml(); | 305 | Yaml yaml = new Yaml(); |
302 | FileWriter writer = null; | 306 | FileWriter writer = null; |
303 | try { | 307 | try { |
304 | - writer = new FileWriter("toflash/" + customer.getEmail().split("@")[0] + "_" + maj.getMaj() + ".yaml"); | 308 | + writer = new FileWriter("toflash/" + customer.getEmail().split("@")[0] + "_" + update.getUpdate() + ".yaml"); |
305 | } catch (IOException e) { | 309 | } catch (IOException e) { |
306 | e.printStackTrace(); | 310 | e.printStackTrace(); |
307 | } | 311 | } |
PFE06/src/main/java/com/PFE/ServerManager/Role.java
@@ -6,12 +6,12 @@ import javax.persistence.*; | @@ -6,12 +6,12 @@ import javax.persistence.*; | ||
6 | @Table(name = "role") | 6 | @Table(name = "role") |
7 | public class Role { | 7 | public class Role { |
8 | @Id | 8 | @Id |
9 | - @Column(name = "role_id", columnDefinition = "serial") | 9 | + @Column(name = "roleId", columnDefinition = "serial") |
10 | @GeneratedValue(strategy = GenerationType.AUTO) | 10 | @GeneratedValue(strategy = GenerationType.AUTO) |
11 | // inutile d'utiliser les lignes ci-dessous à moins que l'utilisateur n'ajoute des roles par une page Web | 11 | // inutile d'utiliser les lignes ci-dessous à moins que l'utilisateur n'ajoute des roles par une page Web |
12 | //@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "role_seq_gen") | 12 | //@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "role_seq_gen") |
13 | //@SequenceGenerator(name = "role_seq_gen", sequenceName = "role_id_seq", allocationSize=1, initialValue=2) | 13 | //@SequenceGenerator(name = "role_seq_gen", sequenceName = "role_id_seq", allocationSize=1, initialValue=2) |
14 | - private Integer role_id; | 14 | + private Integer roleId; |
15 | 15 | ||
16 | @Column(name = "role") | 16 | @Column(name = "role") |
17 | private String role; | 17 | private String role; |
@@ -21,6 +21,6 @@ public class Role { | @@ -21,6 +21,6 @@ public class Role { | ||
21 | } | 21 | } |
22 | public String getRole() { return role; } | 22 | public String getRole() { return role; } |
23 | 23 | ||
24 | - public void setRole_id(Integer role_id) { this.role_id = role_id; } | ||
25 | - public Integer getRole_id() { return role_id; } | 24 | + public void setRoleId(Integer roleId) { this.roleId = roleId; } |
25 | + public Integer getRoleId() { return roleId; } | ||
26 | } | 26 | } |
27 | \ No newline at end of file | 27 | \ No newline at end of file |
PFE06/src/main/java/com/PFE/ServerManager/Team.java
0 → 100644
@@ -0,0 +1,56 @@ | @@ -0,0 +1,56 @@ | ||
1 | +package com.PFE.ServerManager; | ||
2 | + | ||
3 | +import javax.persistence.*; | ||
4 | +import java.util.Set; | ||
5 | + | ||
6 | +@Entity | ||
7 | +@Table(name = "team") | ||
8 | +public class Team { | ||
9 | + | ||
10 | + @Id | ||
11 | + @Column(columnDefinition = "serial") | ||
12 | + //@GeneratedValue(strategy = GenerationType.AUTO) | ||
13 | + @Basic(optional = false) | ||
14 | + private Integer teamId; | ||
15 | + | ||
16 | + @Column(name = "teamName") | ||
17 | + private String team; | ||
18 | + | ||
19 | + @ManyToMany(cascade = CascadeType.ALL) | ||
20 | + @JoinTable(name = "team_update", joinColumns = @JoinColumn(name = "teamId"), inverseJoinColumns = @JoinColumn(name = "updateId")) | ||
21 | + private Set<Update> update; | ||
22 | + | ||
23 | + @ManyToMany(cascade = CascadeType.ALL) | ||
24 | + @JoinTable(name = "team_customer", joinColumns = @JoinColumn(name = "teamId"), inverseJoinColumns = @JoinColumn(name = "customerId")) | ||
25 | + private Set<Customer> customers; | ||
26 | + | ||
27 | + | ||
28 | + public void setTeam(String team) { | ||
29 | + this.team = team; | ||
30 | + } | ||
31 | + public String getTeam() { | ||
32 | + return team; | ||
33 | + } | ||
34 | + | ||
35 | + public void setTeamId(Integer teamId) { | ||
36 | + this.teamId = teamId; | ||
37 | + } | ||
38 | + public Integer getTeamId() { | ||
39 | + return teamId; | ||
40 | + } | ||
41 | + | ||
42 | + public void setCustomers(Set<Customer> customers) { | ||
43 | + this.customers = customers; | ||
44 | + } | ||
45 | + public Set<Customer> getCustomers() { | ||
46 | + return customers; | ||
47 | + } | ||
48 | + | ||
49 | + public void setUpdate(Set<Update> update) { | ||
50 | + this.update = update; | ||
51 | + } | ||
52 | + public Set<Update> getUpdate() { | ||
53 | + return update; | ||
54 | + } | ||
55 | + public void addUpdate(Update update){this.update.add(update);} | ||
56 | +} |
PFE06/src/main/java/com/PFE/ServerManager/TeamRepository.java
0 → 100644
@@ -0,0 +1,16 @@ | @@ -0,0 +1,16 @@ | ||
1 | +package com.PFE.ServerManager; | ||
2 | + | ||
3 | +import org.springframework.data.jpa.repository.JpaRepository; | ||
4 | +import org.springframework.stereotype.Repository; | ||
5 | + | ||
6 | +import java.util.List; | ||
7 | + | ||
8 | + | ||
9 | +@Repository | ||
10 | +public interface TeamRepository extends JpaRepository<Team, Integer> { | ||
11 | + | ||
12 | + Team findByCustomersContaining(Customer customer); | ||
13 | + | ||
14 | + @Override | ||
15 | + List<Team> findAll(); | ||
16 | +} |
PFE06/src/main/java/com/PFE/ServerManager/Maj.java renamed to PFE06/src/main/java/com/PFE/ServerManager/Update.java
@@ -3,15 +3,15 @@ package com.PFE.ServerManager; | @@ -3,15 +3,15 @@ package com.PFE.ServerManager; | ||
3 | import javax.persistence.*; | 3 | import javax.persistence.*; |
4 | 4 | ||
5 | @Entity | 5 | @Entity |
6 | -@Table(name = "maj") | ||
7 | -public class Maj { | 6 | +@Table(name = "update") |
7 | +public class Update { | ||
8 | @Id | 8 | @Id |
9 | - @Column(name = "maj_id", columnDefinition = "serial") | 9 | + @Column(name = "updateId", columnDefinition = "serial") |
10 | @GeneratedValue(strategy = GenerationType.AUTO) | 10 | @GeneratedValue(strategy = GenerationType.AUTO) |
11 | - private Integer maj_id; | 11 | + private Integer updateId; |
12 | 12 | ||
13 | - @Column(name = "maj") | ||
14 | - private String maj; | 13 | + @Column(name = "update") |
14 | + private String update; | ||
15 | 15 | ||
16 | @Column(name = "date") | 16 | @Column(name = "date") |
17 | private String date; | 17 | private String date; |
@@ -22,13 +22,13 @@ public class Maj { | @@ -22,13 +22,13 @@ public class Maj { | ||
22 | @Column(name = "nodes") | 22 | @Column(name = "nodes") |
23 | private String nodes; | 23 | private String nodes; |
24 | 24 | ||
25 | - public void setMaj_id(Integer maj_id) { this.maj_id = maj_id; } | ||
26 | - public Integer getMaj_id() { return maj_id; } | 25 | + public void setUpdateId(Integer updateId) { this.updateId = updateId; } |
26 | + public Integer getUpdateId() { return updateId; } | ||
27 | 27 | ||
28 | - public void setMaj(String maj) { | ||
29 | - this.maj = maj; | 28 | + public void setUpdate(String update) { |
29 | + this.update = update; | ||
30 | } | 30 | } |
31 | - public String getMaj() { return maj; } | 31 | + public String getUpdate() { return update; } |
32 | 32 | ||
33 | public void setDate(String date) { | 33 | public void setDate(String date) { |
34 | this.date = date; | 34 | this.date = date; |
PFE06/src/main/java/com/PFE/ServerManager/MajRepository.java renamed to PFE06/src/main/java/com/PFE/ServerManager/UpdateRepository.java
@@ -4,6 +4,6 @@ import org.springframework.data.jpa.repository.JpaRepository; | @@ -4,6 +4,6 @@ import org.springframework.data.jpa.repository.JpaRepository; | ||
4 | import org.springframework.stereotype.Repository; | 4 | import org.springframework.stereotype.Repository; |
5 | 5 | ||
6 | @Repository | 6 | @Repository |
7 | -public interface MajRepository extends JpaRepository<Maj, Integer> { | ||
8 | - Maj findByMaj(String maj); | 7 | +public interface UpdateRepository extends JpaRepository<Update, Integer> { |
8 | + Update findByUpdate(String update); | ||
9 | } | 9 | } |
PFE06/src/main/resources/application.properties
@@ -2,15 +2,16 @@ | @@ -2,15 +2,16 @@ | ||
2 | #-----------------------------------------------# | 2 | #-----------------------------------------------# |
3 | #---------- Spring Database management ---------# | 3 | #---------- Spring Database management ---------# |
4 | #-----------------------------------------------# | 4 | #-----------------------------------------------# |
5 | -spring.jpa.hibernate.ddl-auto=update | 5 | +spring.jpa.hibernate.ddl-auto=create-drop |
6 | #update | 6 | #update |
7 | -#"create" recrée la base de données à chaque lancement | 7 | +#"create" ajoute les tables qui n'existent pas encore à la base de données à chaque lancement |
8 | +#"create-drop" supprime tout à la fin de la session donc tout est recréé à la suivante | ||
8 | #"update" met à jour la base données | 9 | #"update" met à jour la base données |
9 | 10 | ||
10 | #Postgres config : | 11 | #Postgres config : |
11 | -spring.datasource.url=jdbc:postgresql://localhost:3306/sql_only | 12 | +spring.datasource.url=jdbc:postgresql://localhost:5432/sql_only |
12 | spring.datasource.username=postgres | 13 | spring.datasource.username=postgres |
13 | -spring.datasource.password=admin | 14 | +spring.datasource.password=glopglop |
14 | #spring.datasource.url=jdbc:postgresql://localhost:5432/sql_only | 15 | #spring.datasource.url=jdbc:postgresql://localhost:5432/sql_only |
15 | #spring.datasource.username=postgres | 16 | #spring.datasource.username=postgres |
16 | #spring.datasource.password=glopglop | 17 | #spring.datasource.password=glopglop |
PFE06/src/main/resources/static/js/session.js renamed to PFE06/src/main/resources/static/js/update.js
PFE06/src/main/resources/templates/all.html
@@ -22,10 +22,10 @@ | @@ -22,10 +22,10 @@ | ||
22 | <div th:remove="tag" th:case="'ADMIN'"> | 22 | <div th:remove="tag" th:case="'ADMIN'"> |
23 | <a class="nav-item nav-link" th:href="@{/registration}">Enregistrer des utilisateurs</a> | 23 | <a class="nav-item nav-link" th:href="@{/registration}">Enregistrer des utilisateurs</a> |
24 | <a class="nav-item nav-link active" th:href="@{/all}">Liste des utilisateurs</a> | 24 | <a class="nav-item nav-link active" th:href="@{/all}">Liste des utilisateurs</a> |
25 | - <a class="nav-item nav-link" th:href="@{/session}">Paramétrer une mise à jour</a> | 25 | + <a class="nav-item nav-link" th:href="@{/update}">Paramétrer une mise à jour</a> |
26 | </div> | 26 | </div> |
27 | <div th:remove="tag" th:case="'USER'"> | 27 | <div th:remove="tag" th:case="'USER'"> |
28 | - <a class="nav-item nav-link" th:href="@{/session}">Paramétrer une mise à jour</a> | 28 | + <a class="nav-item nav-link" th:href="@{/update}">Paramétrer une mise à jour</a> |
29 | </div> | 29 | </div> |
30 | </div> | 30 | </div> |
31 | </div> | 31 | </div> |
@@ -51,7 +51,7 @@ | @@ -51,7 +51,7 @@ | ||
51 | <tr th:each="prod : ${list}"> | 51 | <tr th:each="prod : ${list}"> |
52 | <td th:text="${prod.getEmail()}">Email</td> | 52 | <td th:text="${prod.getEmail()}">Email</td> |
53 | <td th:text="${prod.getRole()}">Role</td> | 53 | <td th:text="${prod.getRole()}">Role</td> |
54 | - <td th:text="${prod.customer_id}">ID</td> | 54 | + <td th:text="${prod.getCustomerId()}">ID</td> |
55 | </tr> | 55 | </tr> |
56 | </table> | 56 | </table> |
57 | </div> | 57 | </div> |
PFE06/src/main/resources/templates/home.html
@@ -27,10 +27,10 @@ | @@ -27,10 +27,10 @@ | ||
27 | <div th:remove="tag" th:case="'ADMIN'"> | 27 | <div th:remove="tag" th:case="'ADMIN'"> |
28 | <a class="nav-item nav-link" th:href="@{/registration}">Enregistrer des utilisateurs</a> | 28 | <a class="nav-item nav-link" th:href="@{/registration}">Enregistrer des utilisateurs</a> |
29 | <a class="nav-item nav-link" th:href="@{/all}">Liste des utilisateurs</a> | 29 | <a class="nav-item nav-link" th:href="@{/all}">Liste des utilisateurs</a> |
30 | - <a class="nav-item nav-link" th:href="@{/session}">Paramétrer une mise à jour</a> | 30 | + <a class="nav-item nav-link" th:href="@{/update}">Paramétrer une mise à jour</a> |
31 | </div> | 31 | </div> |
32 | <div th:remove="tag" th:case="'USER'"> | 32 | <div th:remove="tag" th:case="'USER'"> |
33 | - <a class="nav-item nav-link" th:href="@{/session}">Paramétrer une mise à jour</a> | 33 | + <a class="nav-item nav-link" th:href="@{/update}">Paramétrer une mise à jour</a> |
34 | </div> | 34 | </div> |
35 | </div> | 35 | </div> |
36 | </div> | 36 | </div> |
@@ -80,7 +80,7 @@ | @@ -80,7 +80,7 @@ | ||
80 | </div> | 80 | </div> |
81 | </div> | 81 | </div> |
82 | <div class="col-sm-6"> | 82 | <div class="col-sm-6"> |
83 | - <a th:href="@{/session}" style="text-decoration: none; color: #000;"> | 83 | + <a th:href="@{/update}" style="text-decoration: none; color: #000;"> |
84 | <div class="card border-info" style="margin:20px;"> | 84 | <div class="card border-info" style="margin:20px;"> |
85 | <div class="card-body"> | 85 | <div class="card-body"> |
86 | <h5 class="card-title">Paramétrer une mise à jour</h5> | 86 | <h5 class="card-title">Paramétrer une mise à jour</h5> |
PFE06/src/main/resources/templates/login.html
@@ -28,11 +28,11 @@ | @@ -28,11 +28,11 @@ | ||
28 | 28 | ||
29 | <form id="Login" th:action="@{/login}" method="POST"> | 29 | <form id="Login" th:action="@{/login}" method="POST"> |
30 | 30 | ||
31 | - <div class="form-group"> | 31 | + <div class="form-team"> |
32 | <input type="email" class="form-control" id="inputEmail" placeholder="Email" name="email"> | 32 | <input type="email" class="form-control" id="inputEmail" placeholder="Email" name="email"> |
33 | </div> | 33 | </div> |
34 | 34 | ||
35 | - <div class="form-group"> | 35 | + <div class="form-team"> |
36 | <input type="password" class="form-control" id="inputPassword" placeholder="Mot de passe" name="password"> | 36 | <input type="password" class="form-control" id="inputPassword" placeholder="Mot de passe" name="password"> |
37 | </div> | 37 | </div> |
38 | 38 |
PFE06/src/main/resources/templates/registration.html
@@ -22,10 +22,10 @@ | @@ -22,10 +22,10 @@ | ||
22 | <div th:remove="tag" th:case="'ADMIN'"> | 22 | <div th:remove="tag" th:case="'ADMIN'"> |
23 | <a class="nav-item nav-link active" th:href="@{/registration}">Enregistrer des utilisateurs</a> | 23 | <a class="nav-item nav-link active" th:href="@{/registration}">Enregistrer des utilisateurs</a> |
24 | <a class="nav-item nav-link" th:href="@{/all}">Liste des utilisateurs</a> | 24 | <a class="nav-item nav-link" th:href="@{/all}">Liste des utilisateurs</a> |
25 | - <a class="nav-item nav-link" th:href="@{/session}">Paramétrer une mise à jour</a> | 25 | + <a class="nav-item nav-link" th:href="@{/update}">Paramétrer une mise à jour</a> |
26 | </div> | 26 | </div> |
27 | <div th:remove="tag" th:case="'USER'"> | 27 | <div th:remove="tag" th:case="'USER'"> |
28 | - <a class="nav-item nav-link" th:href="@{/session}">Paramétrer une mise à jour</a> | 28 | + <a class="nav-item nav-link" th:href="@{/update}">Paramétrer une mise à jour</a> |
29 | </div> | 29 | </div> |
30 | </div> | 30 | </div> |
31 | </div> | 31 | </div> |
@@ -58,10 +58,10 @@ | @@ -58,10 +58,10 @@ | ||
58 | </div> | 58 | </div> |
59 | 59 | ||
60 | <form id="Login" th:action="@{/registration}" method="POST"> | 60 | <form id="Login" th:action="@{/registration}" method="POST"> |
61 | - <div class="form-group"> | 61 | + <div class="form-team"> |
62 | <input type="email" class="form-control" id="username" placeholder="Entrer l'email" name="email"> | 62 | <input type="email" class="form-control" id="username" placeholder="Entrer l'email" name="email"> |
63 | </div> | 63 | </div> |
64 | - <div class="form-group"> | 64 | + <div class="form-team"> |
65 | <input type="password" class="form-control" id="password" placeholder="Entrer le mot de passe" name="password"> | 65 | <input type="password" class="form-control" id="password" placeholder="Entrer le mot de passe" name="password"> |
66 | </div> | 66 | </div> |
67 | <div class="form3"> | 67 | <div class="form3"> |
PFE06/src/main/resources/templates/session.html renamed to PFE06/src/main/resources/templates/update.html
@@ -10,7 +10,7 @@ | @@ -10,7 +10,7 @@ | ||
10 | <link rel="stylesheet" href="https://cdn.datatables.net/select/1.2.7/css/select.dataTables.min.css"> | 10 | <link rel="stylesheet" href="https://cdn.datatables.net/select/1.2.7/css/select.dataTables.min.css"> |
11 | <link rem="stylesheet" href="https://cdn.datatables.net/responsive/2.2.3/css/responsive.dataTables.min.css"> | 11 | <link rem="stylesheet" href="https://cdn.datatables.net/responsive/2.2.3/css/responsive.dataTables.min.css"> |
12 | <link rel="stylesheet" th:href="@{/css/upload.css}"> | 12 | <link rel="stylesheet" th:href="@{/css/upload.css}"> |
13 | - <title>Session</title> | 13 | + <title>Update</title> |
14 | </head> | 14 | </head> |
15 | 15 | ||
16 | <body> | 16 | <body> |
@@ -27,10 +27,10 @@ | @@ -27,10 +27,10 @@ | ||
27 | <div th:remove="tag" th:case="'ADMIN'"> | 27 | <div th:remove="tag" th:case="'ADMIN'"> |
28 | <a class="nav-item nav-link" th:href="@{/registration}">Enregistrer des utilisateurs</a> | 28 | <a class="nav-item nav-link" th:href="@{/registration}">Enregistrer des utilisateurs</a> |
29 | <a class="nav-item nav-link" th:href="@{/all}">Liste des utilisateurs</a> | 29 | <a class="nav-item nav-link" th:href="@{/all}">Liste des utilisateurs</a> |
30 | - <a class="nav-item nav-link active" th:href="@{/session}">Paramétrer une mise à jour</a> | 30 | + <a class="nav-item nav-link active" th:href="@{/update}">Paramétrer une mise à jour</a> |
31 | </div> | 31 | </div> |
32 | <div th:remove="tag" th:case="'USER'"> | 32 | <div th:remove="tag" th:case="'USER'"> |
33 | - <a class="nav-item nav-link" th:href="@{/session}">Paramétrer une mise à jour</a> | 33 | + <a class="nav-item nav-link" th:href="@{/update}">Paramétrer une mise à jour</a> |
34 | </div> | 34 | </div> |
35 | </div> | 35 | </div> |
36 | </div> | 36 | </div> |
@@ -47,8 +47,8 @@ | @@ -47,8 +47,8 @@ | ||
47 | 47 | ||
48 | <div th:remove="tag" th:if="${customerRole} == 'ADMIN'"> | 48 | <div th:remove="tag" th:if="${customerRole} == 'ADMIN'"> |
49 | <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;">Changer la configuration réseau</h1> | 49 | <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;">Changer la configuration réseau</h1> |
50 | - <div class="input-group mb-3"> | ||
51 | - <div class="input-group-prepend"> | 50 | + <div class="input-team mb-3"> |
51 | + <div class="input-team-prepend"> | ||
52 | <button id="config_send" class="btn btn-outline-secondary" type="button">Envoyer</button> | 52 | <button id="config_send" class="btn btn-outline-secondary" type="button">Envoyer</button> |
53 | </div> | 53 | </div> |
54 | <div class="custom-file"> | 54 | <div class="custom-file"> |
@@ -57,7 +57,7 @@ | @@ -57,7 +57,7 @@ | ||
57 | </div> | 57 | </div> |
58 | </div> | 58 | </div> |
59 | 59 | ||
60 | - <div class="form-group"> | 60 | + <div class="form-team"> |
61 | <label for="comment">Exemple :</label> | 61 | <label for="comment">Exemple :</label> |
62 | <textarea readonly class="form-control" rows="5" id="comment"> | 62 | <textarea readonly class="form-control" rows="5" id="comment"> |
63 | nodes: | 63 | nodes: |
@@ -75,10 +75,10 @@ nodes: | @@ -75,10 +75,10 @@ nodes: | ||
75 | </div> | 75 | </div> |
76 | 76 | ||
77 | <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;">Relancer une mise à jour</h1> | 77 | <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;">Relancer une mise à jour</h1> |
78 | - <div class="form-group"> | 78 | + <div class="form-team"> |
79 | <select multiple id="maj_name" class="form-control"> | 79 | <select multiple id="maj_name" class="form-control"> |
80 | <option value="--">--</option> | 80 | <option value="--">--</option> |
81 | - <option th:each="maj : ${customerMaj}" th:value="${maj.getMaj()}" th:utext="${maj.getMaj()}"/> | 81 | + <option th:each="update : ${customerMaj}" th:value="${update.getUpdate()}" th:utext="${update.getUpdate()}"/> |
82 | </select> | 82 | </select> |
83 | <button id="start_maj" type="submit" class="btn btn-primary" style="margin-top:20px;">Lancer la mise à jour</button> | 83 | <button id="start_maj" type="submit" class="btn btn-primary" style="margin-top:20px;">Lancer la mise à jour</button> |
84 | </div> | 84 | </div> |
@@ -100,10 +100,10 @@ nodes: | @@ -100,10 +100,10 @@ nodes: | ||
100 | </tr> | 100 | </tr> |
101 | </tbody> | 101 | </tbody> |
102 | </table> | 102 | </table> |
103 | - <div class="form-group"> | ||
104 | - <input type="text" class="form-control" id="majName" placeholder="Nom de la maj" name="maj" style="margin-top:20px;"> | 103 | + <div class="form-team"> |
104 | + <input type="text" class="form-control" id="majName" placeholder="Nom de la update" name="update" style="margin-top:20px;"> | ||
105 | </div> | 105 | </div> |
106 | - <div class="form-group"> | 106 | + <div class="form-team"> |
107 | <input type="date" class="form-control" id="majDate" placeholder="Date de la mise à jour" name="date"> | 107 | <input type="date" class="form-control" id="majDate" placeholder="Date de la mise à jour" name="date"> |
108 | </div> | 108 | </div> |
109 | <select multiple class="form-control" style="margin-bottom:20px;" id="file_choice"> | 109 | <select multiple class="form-control" style="margin-bottom:20px;" id="file_choice"> |
@@ -140,6 +140,6 @@ nodes: | @@ -140,6 +140,6 @@ nodes: | ||
140 | <script src="https://cdn.datatables.net/select/1.2.7/js/dataTables.select.min.js" charset="utf-8"></script> | 140 | <script src="https://cdn.datatables.net/select/1.2.7/js/dataTables.select.min.js" charset="utf-8"></script> |
141 | <script src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js" charset="utf-8"></script> | 141 | <script src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js" charset="utf-8"></script> |
142 | <script src="https://cdn.datatables.net/responsive/2.2.3/js/dataTables.responsive.min.js" charset="utf-8"></script> | 142 | <script src="https://cdn.datatables.net/responsive/2.2.3/js/dataTables.responsive.min.js" charset="utf-8"></script> |
143 | -<script th:src="@{/js/session.js}"></script> | 143 | +<script th:src="@{/js/update.js}"></script> |
144 | </body> | 144 | </body> |
145 | </html> | 145 | </html> |
PFE06/src/main/resources/templates/upload.html
@@ -27,10 +27,10 @@ | @@ -27,10 +27,10 @@ | ||
27 | <div th:remove="tag" th:case="'ADMIN'"> | 27 | <div th:remove="tag" th:case="'ADMIN'"> |
28 | <a class="nav-item nav-link" th:href="@{/registration}">Enregistrer des utilisateurs</a> | 28 | <a class="nav-item nav-link" th:href="@{/registration}">Enregistrer des utilisateurs</a> |
29 | <a class="nav-item nav-link" th:href="@{/all}">Liste des utilisateurs</a> | 29 | <a class="nav-item nav-link" th:href="@{/all}">Liste des utilisateurs</a> |
30 | - <a class="nav-item nav-link" th:href="@{/session}">Paramétrer une mise à jour</a> | 30 | + <a class="nav-item nav-link" th:href="@{/update}">Paramétrer une mise à jour</a> |
31 | </div> | 31 | </div> |
32 | <div th:remove="tag" th:case="'USER'"> | 32 | <div th:remove="tag" th:case="'USER'"> |
33 | - <a class="nav-item nav-link" th:href="@{/session}">Paramétrer une mise à jour</a> | 33 | + <a class="nav-item nav-link" th:href="@{/update}">Paramétrer une mise à jour</a> |
34 | </div> | 34 | </div> |
35 | </div> | 35 | </div> |
36 | </div> | 36 | </div> |