Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE] Run with faster validator, probably not right #46

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ugh

<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
Expand All @@ -16,15 +17,9 @@
</properties>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>8.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/com/redhat/coolstore/model/InventoryEntity.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@

package com.redhat.coolstore.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.persistence.UniqueConstraint;
import javax.xml.bind.annotation.XmlRootElement;

@Entity
Expand Down
191 changes: 97 additions & 94 deletions src/main/java/com/redhat/coolstore/model/Order.java
Original file line number Diff line number Diff line change
@@ -1,136 +1,139 @@

package com.redhat.coolstore.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.OneToMany;
import jakarta.persistence.SequenceGenerator;
import jakarta.persistence.Table;

@Entity
@Table(name = "ORDERS")
public class Order implements Serializable {

private static final long serialVersionUID = -1L;
private static final long serialVersionUID = -1L;

@Id
@GeneratedValue
private long orderId;
@Id
@SequenceGenerator(name = "order_seq", sequenceName = "order_seq")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "order_seq")
private long orderId;

private String customerName;
private String customerName;

private String customerEmail;
private String customerEmail;

private double orderValue;
private double orderValue;

private double retailPrice;
private double retailPrice;

private double discount;
private double discount;

private double shippingFee;
private double shippingFee;

private double shippingDiscount;
private double shippingDiscount;

@Column(name="TOTAL_PRICE")
@Column(name="TOTAL_PRICE")


@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true)
@JoinColumn(name="ORDER_ID")
private List<OrderItem> itemList = new ArrayList<>();
@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true)
@JoinColumn(name="ORDER_ID")
private List<OrderItem> itemList = new ArrayList<>();

public Order() {}
public Order() {}

public long getOrderId() {
return orderId;
}
public long getOrderId() {
return orderId;
}

public void setOrderId(long orderId) {
this.orderId = orderId;
}
public void setOrderId(long orderId) {
this.orderId = orderId;
}

public String getCustomerName() {
return customerName;
}
public String getCustomerName() {
return customerName;
}

public void setCustomerName(String customerName) {
this.customerName = customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}

public String getCustomerEmail() {
return customerEmail;
}
public String getCustomerEmail() {
return customerEmail;
}

public void setCustomerEmail(String customerEmail) {
this.customerEmail = customerEmail;
}
public void setCustomerEmail(String customerEmail) {
this.customerEmail = customerEmail;
}

public double getOrderValue() {
return orderValue;
}
public double getOrderValue() {
return orderValue;
}

public void setOrderValue(double orderValue) {
this.orderValue = orderValue;
}
public void setOrderValue(double orderValue) {
this.orderValue = orderValue;
}

public double getRetailPrice() {
return retailPrice;
}
public double getRetailPrice() {
return retailPrice;
}

public void setRetailPrice(double retailPrice) {
this.retailPrice = retailPrice;
}
public void setRetailPrice(double retailPrice) {
this.retailPrice = retailPrice;
}

public double getDiscount() {
return discount;
}
public double getDiscount() {
return discount;
}

public void setDiscount(double discount) {
this.discount = discount;
}
public void setDiscount(double discount) {
this.discount = discount;
}

public double getShippingFee() {
return shippingFee;
}
public double getShippingFee() {
return shippingFee;
}

public void setShippingFee(double shippingFee) {
this.shippingFee = shippingFee;
}
public void setShippingFee(double shippingFee) {
this.shippingFee = shippingFee;
}

public double getShippingDiscount() {
return shippingDiscount;
}
public double getShippingDiscount() {
return shippingDiscount;
}

public void setShippingDiscount(double shippingDiscount) {
this.shippingDiscount = shippingDiscount;
}
public void setShippingDiscount(double shippingDiscount) {
this.shippingDiscount = shippingDiscount;
}

public void setItemList(List<OrderItem> itemList) {
this.itemList = itemList;
}
public void setItemList(List<OrderItem> itemList) {
this.itemList = itemList;
}

public List<OrderItem> getItemList() {
return itemList;
}
public List<OrderItem> getItemList() {
return itemList;
}

@Override
public String toString() {
return "Order [orderId=" + orderId
+ ", customerName=" + customerName
+ ", customerEmail=" + customerEmail
+ ", orderValue=" + orderValue
+ ", retailPrice=" + retailPrice
+ ", discount=" + discount
+ ", shippingFee=" + shippingFee
+ ", shippingDiscount=" + shippingDiscount
+ ", itemList=" + itemList
+ "]";
}
@Override
public String toString() {
return "Order [orderId=" + orderId
+ ", customerName=" + customerName
+ ", customerEmail=" + customerEmail
+ ", orderValue=" + orderValue
+ ", retailPrice=" + retailPrice
+ ", discount=" + discount
+ ", shippingFee=" + shippingFee
+ ", shippingDiscount=" + shippingDiscount
+ ", itemList=" + itemList
+ "]";
}

}
}
55 changes: 30 additions & 25 deletions src/main/java/com/redhat/coolstore/model/OrderItem.java
Original file line number Diff line number Diff line change
@@ -1,48 +1,53 @@


package com.redhat.coolstore.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name = "ORDER_ITEMS")
public class OrderItem implements Serializable {
private static final long serialVersionUID = 64565445665456666L;
private static final long serialVersionUID = 64565445665456666L;

@Id
@Column(name="ID")
@GeneratedValue
private long id;
@Id
@Column(name="ID")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "order_item_seq")
@SequenceGenerator(name = "order_item_seq", sequenceName = "order_item_seq")
private long id;

private int quantity;
private int quantity;

private String productId;
private String productId;

public OrderItem() {}
public OrderItem() {}

public String getProductId() {
return productId;
}
public String getProductId() {
return productId;
}

public void setProductId(String productId) {
this.productId = productId;
}
public void setProductId(String productId) {
this.productId = productId;
}

public int getQuantity() {
return quantity;
}
public int getQuantity() {
return quantity;
}

public void setQuantity(int quantity) {
this.quantity = quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}

@Override
public String toString() {
return "OrderItem [productId=" + productId + ", quantity=" + quantity + "]";
}
@Override
public String toString() {
return "OrderItem [productId=" + productId + ", quantity=" + quantity + "]";
}

}
}
3 changes: 2 additions & 1 deletion src/main/java/com/redhat/coolstore/model/ShoppingCart.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@

package com.redhat.coolstore.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.enterprise.context.Dependent;
import jakarta.enterprise.context.Dependent;

@Dependent
public class ShoppingCart implements Serializable {
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/redhat/coolstore/persistence/Resources.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@

package com.redhat.coolstore.persistence;

import javax.enterprise.context.Dependent;
import javax.enterprise.inject.Produces;
import jakarta.enterprise.context.Dependent;
import jakarta.enterprise.inject.Produces;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

Expand Down
Loading