Last change
on this file since 188ee53 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[6a3a178] | 1 | package finki.diplomska.tripplanner.models;
|
---|
| 2 |
|
---|
| 3 | import lombok.*;
|
---|
| 4 |
|
---|
| 5 | import javax.persistence.*;
|
---|
| 6 | import java.util.List;
|
---|
| 7 |
|
---|
| 8 | @Entity
|
---|
| 9 | @Data
|
---|
| 10 | @Table(name = "planners")
|
---|
| 11 | @NoArgsConstructor
|
---|
| 12 | @AllArgsConstructor
|
---|
| 13 | @Getter
|
---|
| 14 | @Setter
|
---|
| 15 | public class Planner {
|
---|
| 16 |
|
---|
| 17 | @Id
|
---|
| 18 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
| 19 | @Column(name = "id_planner")
|
---|
| 20 | private Long id;
|
---|
| 21 |
|
---|
| 22 | @Column(name = "planner_name")
|
---|
| 23 | private String name;
|
---|
| 24 |
|
---|
| 25 | @Column(name = "planner_description")
|
---|
| 26 | private String description;
|
---|
| 27 |
|
---|
| 28 | @ManyToMany
|
---|
| 29 | @JoinTable(
|
---|
| 30 | name = "planners_contain",
|
---|
| 31 | joinColumns = @JoinColumn(name = "id_planner"),
|
---|
| 32 | inverseJoinColumns = @JoinColumn(name = "id_location"))
|
---|
| 33 | private List<Location> locationList;
|
---|
| 34 |
|
---|
| 35 |
|
---|
| 36 | public Planner(String name, String description, List<Location> locationList){
|
---|
| 37 | this.name = name;
|
---|
| 38 | this.description = description;
|
---|
| 39 | this.locationList = locationList;
|
---|
| 40 | }
|
---|
| 41 |
|
---|
| 42 | public static synchronized Planner createNewPlanner(String plandesc, String planname, List<Location> locationList){
|
---|
| 43 | Planner planner = new Planner();
|
---|
| 44 | planner.description = plandesc;
|
---|
| 45 | planner.name = planname;
|
---|
| 46 | planner.locationList = locationList;
|
---|
| 47 | return planner;
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.