Changeset 594d4c4


Ignore:
Timestamp:
01/02/23 19:08:56 (2 years ago)
Author:
DarkoSasanski <darko.sasanski@…>
Branches:
main
Children:
5c142f7
Parents:
15f8330
Message:

Models improvments

Location:
FullyStocked/src/main/java/com/bazi/fullystocked/Models
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • FullyStocked/src/main/java/com/bazi/fullystocked/Models/AnswerId.java

    r15f8330 r594d4c4  
    44import lombok.Setter;
    55
    6 import javax.persistence.Embeddable;
     6import javax.persistence.*;
    77import java.io.Serializable;
     8import java.util.Objects;
     9
    810@Embeddable
    911@Getter
    1012@Setter
    1113public class AnswerId implements Serializable {
    12     private Long answerid;
    13     private Long questionid;
     14    @GeneratedValue(strategy = GenerationType.IDENTITY)
     15    private Integer answerid;
     16    @ManyToOne
     17    @JoinColumn(name="questionid")
     18    private questions question;
     19    @Override
     20    public boolean equals(Object o) {
     21        if (this == o) return true;
     22        if (o == null || getClass() != o.getClass()) return false;
     23        AnswerId answerId = (AnswerId) o;
     24        return answerid.equals(answerId.answerid) && question.equals(answerId.question);
     25    }
     26
     27    @Override
     28    public int hashCode() {
     29        return Objects.hash(answerid, question);
     30    }
    1431
    1532
  • FullyStocked/src/main/java/com/bazi/fullystocked/Models/User.java

    r15f8330 r594d4c4  
    1616    @Id
    1717    @GeneratedValue(strategy = GenerationType.IDENTITY)
    18     private Long userid;
     18    private Integer userid;
    1919    @Column(nullable = false)
    2020    @NotNull(message = "The user must have an first name")
     
    3636    @NotNull(message = "The user must have an password")
    3737    @NotEmpty(message = "The user must have an password")
    38     private String password;
     38    private String userpassword;
    3939
    4040    public User(String firstname, String lastname, String username, String email, String password) {
     
    4343        this.username = username;
    4444        this.email = email;
    45         this.password = password;
     45        this.userpassword = password;
    4646    }
    4747
  • FullyStocked/src/main/java/com/bazi/fullystocked/Models/answers.java

    r15f8330 r594d4c4  
    55import lombok.NoArgsConstructor;
    66
    7 import javax.persistence.Column;
    8 import javax.persistence.EmbeddedId;
    9 import javax.persistence.Entity;
     7import javax.persistence.*;
    108import javax.validation.constraints.NotEmpty;
    119import javax.validation.constraints.NotNull;
  • FullyStocked/src/main/java/com/bazi/fullystocked/Models/articles.java

    r15f8330 r594d4c4  
    1515@NoArgsConstructor
    1616public class articles {
    17         @Id
    18         @GeneratedValue(strategy = GenerationType.IDENTITY)
    19         private Long articleid;
    20         @Column(nullable = false)
    21         @NotNull(message = "Article must have description")
    22         @NotEmpty(message = "Article must have description")
    23         private String description;
     17    @Id
     18    @GeneratedValue(strategy = GenerationType.IDENTITY)
     19    private Integer articleid;
     20    @Column(nullable = false)
     21    @NotNull(message = "Article must have description")
     22    @NotEmpty(message = "Article must have description")
     23    private String description;
    2424    @Column(nullable = false)
    2525    @NotNull(message = "Article must have name")
     
    2929    @Column(nullable = false)
    3030    @NotNull(message = "Article must have max quantity")
    31     @NotEmpty(message = "Article must have max quantity")
    3231    private int maxquantityperlocation;
    3332    @ManyToMany
  • FullyStocked/src/main/java/com/bazi/fullystocked/Models/categories.java

    r15f8330 r594d4c4  
    1616    @Id
    1717    @GeneratedValue(strategy = GenerationType.IDENTITY)
    18     private Long categoryid;
     18    private Integer categoryid;
    1919    @Column(nullable = false)
    2020    @NotNull(message = "Category must have name")
  • FullyStocked/src/main/java/com/bazi/fullystocked/Models/invoicedarticles.java

    r15f8330 r594d4c4  
    1515    @Id
    1616    @GeneratedValue(strategy = GenerationType.IDENTITY)
    17     private Long iarticleid;
     17    private Integer iarticleid;
    1818    @Column(nullable = false)
    1919    @NotNull(message = "Invoiced Article must have price")
    20     @NotEmpty(message = "Invoiced Article must have price")
    2120    @Min(0)
    2221    private int price;
    2322    @Column(nullable = false)
    2423    @NotNull(message = "Invoiced Article must have quantity")
    25     @NotEmpty(message = "Invoiced Article must have quantity")
    2624    @Min(0)
    2725    private int quantity;
  • FullyStocked/src/main/java/com/bazi/fullystocked/Models/invoices.java

    r15f8330 r594d4c4  
    1515    @Id
    1616    @GeneratedValue(strategy = GenerationType.IDENTITY)
    17     private Long invoiceid;
     17    private Integer invoiceid;
    1818    @Column(nullable = false)
    1919    @NotNull(message = "Invoice must have customer name")
     
    3030    @Column(nullable = false)
    3131    @NotNull(message = "Invoice must have customer street number")
    32     @NotEmpty(message = "Invoice must have customer street number")
    3332    private int streetnumber;
    3433    @Column(nullable = false)
     
    3837    @Column(nullable = false)
    3938    @NotNull(message = "Invoice must have creation date")
    40     @NotEmpty(message = "Invoice must have creation date")
    4139    private LocalDateTime datecreate;
    4240    @ManyToOne
  • FullyStocked/src/main/java/com/bazi/fullystocked/Models/locations.java

    r15f8330 r594d4c4  
    1414    @Id
    1515    @GeneratedValue(strategy = GenerationType.IDENTITY)
    16     private Long locationid;
     16    private Integer locationid;
    1717    @Column(nullable = false)
    1818    @NotNull(message = "Location must have name")
     
    2929    @Column(nullable = false)
    3030    @NotNull(message = "Location must have street number")
    31     @NotEmpty(message = "Location must have street number")
    32     private String streetnumber;
     31    private Integer streetnumber;
    3332    @Column(nullable = false)
    3433    @NotNull(message = "Location must have city")
     
    3635    private String city;
    3736
    38     public locations(String locationname, String phone, String street, String streetnumber, String city) {
     37    public locations(String locationname, String phone, String street, Integer streetnumber, String city) {
    3938        this.locationname = locationname;
    4039        this.phone = phone;
  • FullyStocked/src/main/java/com/bazi/fullystocked/Models/orderedarticles.java

    r15f8330 r594d4c4  
    1616    @Id
    1717    @GeneratedValue(strategy = GenerationType.IDENTITY)
    18     private Long oarticleid;
    19     @Column(nullable = false)
    20     @NotNull(message = "Ordered Article must have price")
    21     @NotEmpty(message = "Ordered Article must have price")
     18    private Integer oarticleid;
    2219    @Min(0)
    2320    private int price;
    2421    @Column(nullable = false)
    2522    @NotNull(message = "Ordered Article must have quantity")
    26     @NotEmpty(message = "Ordered Article must have quantity")
    2723    @Min(0)
    2824    private int quantity;
     
    3228    private String articlestatus;
    3329    @ManyToOne
    34     @JoinColumn(name = "orederid")
     30    @JoinColumn(name = "orderid")
    3531    private orders order;
    3632    @ManyToOne
  • FullyStocked/src/main/java/com/bazi/fullystocked/Models/orders.java

    r15f8330 r594d4c4  
    1515    @Id
    1616    @GeneratedValue(strategy = GenerationType.IDENTITY)
    17     private Long orederid;
     17    private Integer orderid;
    1818    @Column(nullable = false)
    1919    @NotNull(message = "Order must have status")
     
    2424    @Column(nullable = false)
    2525    @NotNull(message = "Order must have creation date")
    26     @NotEmpty(message = "Order must have creation date")
    2726    private LocalDateTime datecreated;
    2827    private LocalDateTime dateapproved;
  • FullyStocked/src/main/java/com/bazi/fullystocked/Models/questions.java

    r15f8330 r594d4c4  
    1717    @Id
    1818    @GeneratedValue(strategy = GenerationType.IDENTITY)
    19     private Long questionid;
     19    private Integer questionid;
    2020    @Column(nullable = false)
    2121    @NotNull(message = "Question must have content")
     
    2424    @Column(nullable = false)
    2525    @NotNull(message = "Question must have creation date")
    26     @NotEmpty(message = "Question must have creation date")
    2726    private LocalDateTime datecreated;
    2827    @ManyToOne
  • FullyStocked/src/main/java/com/bazi/fullystocked/Models/storedarticles.java

    r15f8330 r594d4c4  
    1717    @Id
    1818    @GeneratedValue(strategy = GenerationType.IDENTITY)
    19     private Long sarticleid;
     19    private Integer sarticleid;
    2020    @Column(nullable = false)
    2121    @NotNull(message = "Stored Article must have quantity")
    22     @NotEmpty(message = "Stored Article must have quantity")
    2322    @Min(0)
    2423    private int quantity;
  • FullyStocked/src/main/java/com/bazi/fullystocked/Models/suppliers.java

    r15f8330 r594d4c4  
    3030    @Column(nullable = false)
    3131    @NotNull(message = "Supplier must have street number")
    32     @NotEmpty(message = "Supplier must have street number")
    33     private int sttreetnumber;
     32    private int streetnumber;
    3433    @Column(nullable = false)
    3534    @NotNull(message = "Supplier must have street city")
     
    4847        this.phone = phone;
    4948        this.street = street;
    50         this.sttreetnumber = sttreetnumber;
     49        this.streetnumber = sttreetnumber;
    5150        this.city = city;
    5251    }
Note: See TracChangeset for help on using the changeset viewer.