source: src/main/java/project/educatum/model/Class.java@ d3cf3a1

Last change on this file since d3cf3a1 was d3cf3a1, checked in by Marija Micevska <marija_micevska@…>, 2 years ago

Initial commit

  • Property mode set to 100644
File size: 1.5 KB
RevLine 
[d3cf3a1]1package project.educatum.model;
2
3import lombok.Data;
4import lombok.NoArgsConstructor;
5
6import javax.persistence.*;
7import java.time.LocalDateTime;
8
9@Data
10@Entity
11@Table(name = "casovi", schema = "project")
12@NoArgsConstructor
13public class Class {
14 @Id
15 @GeneratedValue(strategy = GenerationType.IDENTITY)
16 @Column(name = "id_cas", nullable = false)
17 private Integer id;
18
19 @Column(name = "vreme_pocetok")
20 private LocalDateTime beginningTime;
21
22 @Column(name = "tema", nullable = false, length = 100)
23 private String topic;
24
25 @ManyToOne
26 @JoinColumn(name = "id_nastavnik")
27 private Teacher idTeacher;
28
29 @ManyToOne
30 @JoinColumn(name = "id_predmet")
31 private Subject subjectID;
32
33 public Class(LocalDateTime beginningTime, String topic, Teacher idTeacher, Subject subjectID) {
34 this.beginningTime = beginningTime;
35 this.topic = topic;
36 this.idTeacher = idTeacher;
37 this.subjectID = subjectID;
38 }
39
40 @Override
41 public String toString() {
42 return topic + "\t" + beginningTime.getDayOfMonth() + "." + beginningTime.getMonthValue() + "."
43 + beginningTime.getYear() + " " + beginningTime.getHour() + ":" +
44 beginningTime.getMinute() + "\n";
45 }
46
47 public String beginningDate() {
48 return beginningTime.getDayOfMonth() + "." + beginningTime.getMonthValue() + "."
49 + beginningTime.getYear() + "\n";
50 }
51
52 public String beginningTime() {
53 return beginningTime.getHour() + ":" + beginningTime.getMinute() + "h\n";
54 }
55}
Note: See TracBrowser for help on using the repository browser.