Ignore:
Timestamp:
01/06/23 02:51:45 (23 months ago)
Author:
andrejtodorovski <82031894+andrejtodorovski@…>
Branches:
main
Children:
d4b888e
Parents:
1bd8d1e
Message:

Added full functionality for creating order

Location:
src/main/java/com/example/autopartz/model
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/example/autopartz/model/Car.java

    r1bd8d1e rf484b14  
    1818public class Car {
    1919    @Id
    20     Integer ID_car;
     20    @Column(name = "ID_car")
     21    Integer id;
    2122    Integer in_production_since;
    2223    Integer in_production_till;
     
    3233        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
    3334        Car car = (Car) o;
    34         return ID_car != null && Objects.equals(ID_car, car.ID_car);
     35        return id != null && Objects.equals(id, car.id);
    3536    }
    3637
  • src/main/java/com/example/autopartz/model/CarSample.java

    r1bd8d1e rf484b14  
    3131    Car car;
    3232
     33
     34    public CarSample(Integer vin,Integer year_of_production, Integer engine_power, Integer displacement, String fuel_type, Integer km_driven, Client client, Car car) {
     35        this.vin = vin;
     36        this.year_of_production = year_of_production;
     37        this.engine_power = engine_power;
     38        this.displacement = displacement;
     39        this.fuel_type = fuel_type;
     40        this.km_driven = km_driven;
     41        this.client = client;
     42        this.car = car;
     43    }
     44
    3345    @Override
    3446    public boolean equals(Object o) {
  • src/main/java/com/example/autopartz/model/Delivery.java

    r1bd8d1e rf484b14  
    1717public class Delivery {
    1818    @Id
     19    @GeneratedValue(strategy = GenerationType.IDENTITY)
    1920    Integer ID_delivery;
    2021    @Column(name = "delivery_status")
     
    2829    @OneToOne
    2930    Order order;
     31
     32    public Delivery(String status, String address, Deliveryman deliveryman, Order order) {
     33        this.status = status;
     34        this.address = address;
     35        this.deliveryman = deliveryman;
     36        this.order = order;
     37    }
    3038
    3139    @Override
  • src/main/java/com/example/autopartz/model/Repair.java

    r1bd8d1e rf484b14  
    1717public class Repair {
    1818    @Id
     19    @GeneratedValue(strategy = GenerationType.IDENTITY)
    1920    Integer ID_repair;
    2021    @OneToOne
     
    2728    @JoinColumn(name = "id_service_book")
    2829    ServiceBook serviceBook;
     30
     31    public Repair(Order order, RepairShop repairShop, ServiceBook serviceBook) {
     32        this.order = order;
     33        this.repairShop = repairShop;
     34        this.serviceBook = serviceBook;
     35    }
    2936
    3037    @Override
  • src/main/java/com/example/autopartz/model/ServiceBook.java

    r1bd8d1e rf484b14  
    1919public class ServiceBook {
    2020    @Id
    21     Integer ID_service_book;
     21    @Column(name = "ID_service_book")
     22    @GeneratedValue(strategy = GenerationType.IDENTITY)
     23    Integer id;
    2224    LocalDateTime sb_created_on;
    2325    @OneToOne
    2426    @JoinColumn(name = "vin")
    2527    CarSample carSample;
     28
     29    public ServiceBook(CarSample carSample) {
     30        this.sb_created_on = LocalDateTime.now();
     31        this.carSample = carSample;
     32    }
    2633
    2734    @Override
     
    3037        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
    3138        ServiceBook that = (ServiceBook) o;
    32         return ID_service_book != null && Objects.equals(ID_service_book, that.ID_service_book);
     39        return id != null && Objects.equals(id, that.id);
    3340    }
    3441
Note: See TracChangeset for help on using the changeset viewer.