Changeset 5c142f7


Ignore:
Timestamp:
01/03/23 15:08:45 (23 months ago)
Author:
DarkoSasanski <darko.sasanski@…>
Branches:
main
Children:
d37f9ee
Parents:
594d4c4
Message:

Added exceptions, enumerations, sqlviews and made additional improvements on the models

Location:
FullyStocked/src/main/java/com/bazi/fullystocked/Models
Files:
8 added
1 edited
13 moved

Legend:

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

    r594d4c4 r5c142f7  
    1616    @ManyToOne
    1717    @JoinColumn(name="questionid")
    18     private questions question;
     18    private Questions question;
    1919    @Override
    2020    public boolean equals(Object o) {
  • FullyStocked/src/main/java/com/bazi/fullystocked/Models/Answers.java

    r594d4c4 r5c142f7  
    1313@NoArgsConstructor
    1414@Data
    15 public class answers {
     15public class Answers {
    1616    @EmbeddedId
    1717    private AnswerId answerId;
     
    2222    private String answertext;
    2323
    24     public answers(String answertext) {
     24    public Answers(String answertext) {
    2525        this.datecreated = LocalDateTime.now();
    2626        this.answertext = answertext;
  • FullyStocked/src/main/java/com/bazi/fullystocked/Models/Articles.java

    r594d4c4 r5c142f7  
    11package com.bazi.fullystocked.Models;
    22
    3 import jdk.jfr.Category;
    43import lombok.Data;
    54import lombok.NoArgsConstructor;
     
    1413@Entity
    1514@NoArgsConstructor
    16 public class articles {
     15public class Articles {
    1716    @Id
    1817    @GeneratedValue(strategy = GenerationType.IDENTITY)
     
    3534            inverseJoinColumns = @JoinColumn(name = "categoryid")
    3635    )
    37     private List<categories> categoryList=new ArrayList<>();
     36    private List<Categories> categoryList=new ArrayList<>();
    3837
    39     public articles(String description, String articlename, String imageurl, int maxquantityperlocation) {
     38    public Articles(String description, String articlename, int maxquantityperlocation) {
    4039        this.description = description;
    4140        this.articlename = articlename;
    42         this.imageurl = imageurl;
    4341        this.maxquantityperlocation = maxquantityperlocation;
    4442    }
  • FullyStocked/src/main/java/com/bazi/fullystocked/Models/Categories.java

    r594d4c4 r5c142f7  
    1313@Entity
    1414@NoArgsConstructor
    15 public class categories {
     15public class Categories {
    1616    @Id
    1717    @GeneratedValue(strategy = GenerationType.IDENTITY)
     
    2626    private String description;
    2727    @ManyToMany(mappedBy = "categoryList")
    28     private List<articles> articlesList=new ArrayList<>();
     28    private List<Articles> articlesList=new ArrayList<>();
    2929    @ManyToMany(mappedBy = "categoryList2")
    30     private List<suppliers> suppliersList=new ArrayList<>();
     30    private List<Suppliers> suppliersList=new ArrayList<>();
    3131
    3232
    33     public categories(String categoryname, String description) {
     33    public Categories(String categoryname, String description) {
    3434        this.categoryname = categoryname;
    3535        this.description = description;
  • FullyStocked/src/main/java/com/bazi/fullystocked/Models/InvoicedArticles.java

    r594d4c4 r5c142f7  
    66import javax.persistence.*;
    77import javax.validation.constraints.Min;
    8 import javax.validation.constraints.NotEmpty;
    98import javax.validation.constraints.NotNull;
    109
     
    1211@Entity
    1312@NoArgsConstructor
    14 public class invoicedarticles {
     13@Table(name="invoicedarticles")
     14public class InvoicedArticles {
    1515    @Id
    1616    @GeneratedValue(strategy = GenerationType.IDENTITY)
     
    2626    @ManyToOne
    2727    @JoinColumn(name = "invoiceid")
    28     private invoices invoice;
     28    private Invoices invoice;
    2929    @ManyToOne
    3030    @JoinColumn(name = "articleid")
    31     private articles article;
     31    private Articles article;
    3232
    33     public invoicedarticles(int price, int quantity, invoices invoice, articles article) {
     33    public InvoicedArticles(int price, int quantity, Invoices invoice, Articles article) {
    3434        this.price = price;
    3535        this.quantity = quantity;
  • FullyStocked/src/main/java/com/bazi/fullystocked/Models/Invoices.java

    r594d4c4 r5c142f7  
    1212@Entity
    1313@NoArgsConstructor
    14 public class invoices {
     14public class Invoices {
    1515    @Id
    1616    @GeneratedValue(strategy = GenerationType.IDENTITY)
    1717    private Integer invoiceid;
    18     @Column(nullable = false)
    19     @NotNull(message = "Invoice must have customer name")
    20     @NotEmpty(message = "Invoice must have customer name")
    2118    private String customername;
    22     @Column(nullable = false)
    23     @NotNull(message = "Invoice must have customer phone")
    24     @NotEmpty(message = "Invoice must have customer phone")
    2519    private String customerphone;
    26     @Column(nullable = false)
    27     @NotNull(message = "Invoice must have customer street")
    28     @NotEmpty(message = "Invoice must have customer street")
    2920    private String street;
    30     @Column(nullable = false)
    31     @NotNull(message = "Invoice must have customer street number")
    3221    private int streetnumber;
    33     @Column(nullable = false)
    34     @NotNull(message = "Invoice must have customer city")
    35     @NotEmpty(message = "Invoice must have customer city")
    3622    private String city;
    3723    @Column(nullable = false)
     
    4026    @ManyToOne
    4127    @JoinColumn(name = "workeruserid")
    42     private workers worker;
     28    private Workers worker;
    4329
    44     public invoices(String customername, String customerphone,
    45                     String street, int streetnumber, String city, workers worker) {
     30    public Invoices(Workers worker) {
     31
     32        this.datecreate = LocalDateTime.now();
     33        this.worker = worker;
     34    }
     35
     36    public Invoices(String customername, String customerphone, String street, int streetnumber, String city, Workers worker) {
    4637        this.customername = customername;
    4738        this.customerphone = customerphone;
     
    4940        this.streetnumber = streetnumber;
    5041        this.city = city;
    51         this.datecreate = LocalDateTime.now();
    5242        this.worker = worker;
    5343    }
  • FullyStocked/src/main/java/com/bazi/fullystocked/Models/Locations.java

    r594d4c4 r5c142f7  
    1111@Entity
    1212@NoArgsConstructor
    13 public class locations {
     13public class Locations {
    1414    @Id
    1515    @GeneratedValue(strategy = GenerationType.IDENTITY)
     
    3535    private String city;
    3636
    37     public locations(String locationname, String phone, String street, Integer streetnumber, String city) {
     37    public Locations(String locationname, String phone, String street, Integer streetnumber, String city) {
    3838        this.locationname = locationname;
    3939        this.phone = phone;
  • FullyStocked/src/main/java/com/bazi/fullystocked/Models/Managers.java

    r594d4c4 r5c142f7  
    1111@Data
    1212@NoArgsConstructor
    13 public class managers extends User{
    14     public managers(String firstname, String lastname, String username, String email, String password) {
     13public class Managers extends User{
     14    public Managers(String firstname, String lastname, String username, String email, String password) {
    1515        super(firstname, lastname, username, email, password);
    1616    }
  • FullyStocked/src/main/java/com/bazi/fullystocked/Models/OrderedArticles.java

    r594d4c4 r5c142f7  
    11package com.bazi.fullystocked.Models;
    22
     3import com.bazi.fullystocked.Models.Enumerations.ArticleStatus;
    34import lombok.Data;
    45import lombok.NoArgsConstructor;
    5 import lombok.RequiredArgsConstructor;
    66
    77import javax.persistence.*;
     
    1313@Entity
    1414@NoArgsConstructor
    15 public class orderedarticles {
     15@Table(name="orderedarticles")
     16public class OrderedArticles {
    1617    @Id
    1718    @GeneratedValue(strategy = GenerationType.IDENTITY)
     
    2425    private int quantity;
    2526    @Column(nullable = false)
    26     @NotNull(message = "Ordered Article must have status")
    27     @NotEmpty(message = "Ordered Article must have status")
    28     private String articlestatus;
     27    @Enumerated(EnumType.STRING)
     28    private ArticleStatus articlestatus;
    2929    @ManyToOne
    3030    @JoinColumn(name = "orderid")
    31     private orders order;
     31    private Orders order;
    3232    @ManyToOne
    3333    @JoinColumn(name = "locationid")
    34     private locations location;
     34    private Locations location;
    3535    @ManyToOne
    3636    @JoinColumn(name = "articleid")
    37     private articles article;
     37    private Articles article;
    3838
    39     public orderedarticles(int price, int quantity, String articlestatus, orders order, locations location, articles article) {
    40         this.price = price;
     39    public OrderedArticles(int quantity, Orders order, Locations location, Articles article) {
    4140        this.quantity = quantity;
    42         this.articlestatus = articlestatus;
     41        this.articlestatus = ArticleStatus.ORDERED;
    4342        this.order = order;
    4443        this.location = location;
  • FullyStocked/src/main/java/com/bazi/fullystocked/Models/Orders.java

    r594d4c4 r5c142f7  
    11package com.bazi.fullystocked.Models;
    22
     3import com.bazi.fullystocked.Models.Enumerations.OrderPriority;
     4import com.bazi.fullystocked.Models.Enumerations.OrderStatus;
    35import lombok.Data;
    46import lombok.NoArgsConstructor;
     
    1214@Entity
    1315@NoArgsConstructor
    14 public class orders {
     16public class Orders {
    1517    @Id
    1618    @GeneratedValue(strategy = GenerationType.IDENTITY)
    1719    private Integer orderid;
    1820    @Column(nullable = false)
    19     @NotNull(message = "Order must have status")
    20     @NotEmpty(message = "Order must have status")
    21     private String status;
     21    @Enumerated(EnumType.STRING)
     22    private OrderStatus status;
    2223    private String supplierremark;
    2324    private String managerremark;
     
    2728    private LocalDateTime dateapproved;
    2829    @Column(nullable = false)
    29     @NotNull(message = "Order must have priority")
    30     @NotEmpty(message = "Order must have priority")
    31     private String priority;
     30    @Enumerated(EnumType.STRING)
     31    private OrderPriority priority;
    3232    @ManyToOne
    3333    @JoinColumn(name = "manageruserid")
    34     private managers manager;
     34    private Managers manager;
    3535    @ManyToOne
    3636    @JoinColumn(name = "supplieruserid")
    37     private suppliers supplier;
     37    private Suppliers supplier;
    3838
    39     public orders(String status, String supplierremark, String managerremark,
    40                   LocalDateTime dateapproved, String priority, managers manager, suppliers supplier) {
    41         this.status = status;
    42         this.supplierremark = supplierremark;
    43         this.managerremark = managerremark;
     39    public Orders(OrderPriority priority, Managers manager, Suppliers supplier) {
     40        this.status = OrderStatus.CREATED;
    4441        this.datecreated = LocalDateTime.now();
    45         this.dateapproved = dateapproved;
    4642        this.priority = priority;
    4743        this.manager = manager;
  • FullyStocked/src/main/java/com/bazi/fullystocked/Models/Questions.java

    r594d4c4 r5c142f7  
    1414@Entity
    1515@NoArgsConstructor
    16 public class questions {
     16public class Questions {
    1717    @Id
    1818    @GeneratedValue(strategy = GenerationType.IDENTITY)
     
    2727    @ManyToOne
    2828    @JoinColumn(name = "workeruserid")
    29     private workers worker;
     29    private Workers worker;
    3030    @ManyToOne
    3131    @JoinColumn(name = "manageruserid")
    32     private managers manager;
     32    private Managers manager;
    3333    @ManyToMany(mappedBy = "questionsList")
    34     private List<storedarticles> storedarticlesList=new ArrayList<>();
     34    private List<StoredArticles> storedarticlesList=new ArrayList<>();
    3535
    3636
    37     public questions(String questiontext, workers worker, managers manager) {
     37    public Questions(String questiontext, Workers worker, Managers manager) {
    3838        this.questiontext = questiontext;
    3939        this.datecreated = LocalDateTime.now();
  • FullyStocked/src/main/java/com/bazi/fullystocked/Models/StoredArticles.java

    r594d4c4 r5c142f7  
    66import javax.persistence.*;
    77import javax.validation.constraints.Min;
    8 import javax.validation.constraints.NotEmpty;
    98import javax.validation.constraints.NotNull;
    109import java.util.ArrayList;
     
    1413@Entity
    1514@NoArgsConstructor
    16 public class storedarticles {
     15@Table(name="storedarticles")
     16public class StoredArticles {
    1717    @Id
    1818    @GeneratedValue(strategy = GenerationType.IDENTITY)
     
    2424    @ManyToOne
    2525    @JoinColumn(name = "locationid")
    26     private locations locations;
     26    private Locations locations;
    2727    @ManyToOne
    2828    @JoinColumn(name = "articleid")
    29     private articles article;
     29    private Articles article;
    3030    @ManyToMany
    3131    @JoinTable(name = "question_availability_for_storedarticle",
     
    3333            inverseJoinColumns = @JoinColumn(name = "questionid")
    3434    )
    35     private List<questions> questionsList=new ArrayList<>();
     35    private List<Questions> questionsList=new ArrayList<>();
    3636
    37     public storedarticles(int quantity, locations locations, articles article) {
     37    public StoredArticles(int quantity, Locations locations, Articles article) {
    3838        this.quantity = quantity;
    3939        this.locations = locations;
  • FullyStocked/src/main/java/com/bazi/fullystocked/Models/Suppliers.java

    r594d4c4 r5c142f7  
    1515@Data
    1616@NoArgsConstructor
    17 public class suppliers extends User{
     17public class Suppliers extends User{
    1818    @Column(nullable = false)
    1919    @NotNull(message = "Supplier must have supplierInfo")
     
    4040            inverseJoinColumns = @JoinColumn(name = "categoryid")
    4141    )
    42     private List<categories> categoryList2=new ArrayList<>();
     42    private List<Categories> categoryList2=new ArrayList<>();
    4343
    44     public suppliers(String firstname, String lastname, String username, String email, String password, String supplierinfo, String phone, String street, int sttreetnumber, String city) {
     44    public Suppliers(String firstname, String lastname, String username, String email, String password, String supplierinfo, String phone, String street, int sttreetnumber, String city) {
    4545        super(firstname, lastname, username, email, password);
    4646        this.supplierinfo = supplierinfo;
  • FullyStocked/src/main/java/com/bazi/fullystocked/Models/Workers.java

    r594d4c4 r5c142f7  
    55import lombok.NoArgsConstructor;
    66
    7 import javax.persistence.Column;
    87import javax.persistence.Entity;
    98import javax.persistence.JoinColumn;
    109import javax.persistence.ManyToOne;
    11 import javax.validation.constraints.NotNull;
    1210
    1311@Entity
     
    1513@Data
    1614@NoArgsConstructor
    17 public class workers extends User{
     15public class Workers extends User{
    1816    @ManyToOne
    1917    @JoinColumn(name = "locationid")
    20     private locations location;
     18    private Locations location;
    2119
    22     public workers(String firstname, String lastname, String username, String email, String password, locations location) {
     20    public Workers(String firstname, String lastname, String username, String email, String password, Locations location) {
    2321        super(firstname, lastname, username, email, password);
    2422        this.location = location;
Note: See TracChangeset for help on using the changeset viewer.