hs.hsadmin/hsarback/src/de/hsadmin/mods/pac/PacComponent.java

159 lines
3.2 KiB
Java
Raw Normal View History

2010-10-01 21:52:51 +02:00
package de.hsadmin.mods.pac;
import java.util.Date;
2010-10-06 15:06:01 +02:00
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
2010-10-01 21:52:51 +02:00
import javax.persistence.IdClass;
2010-10-06 15:06:01 +02:00
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@Entity(name = "PacComponents")
@Table(name = "packet_component")
2010-10-01 21:52:51 +02:00
@IdClass(PacComponentId.class)
2011-03-22 23:02:06 +01:00
public class PacComponent {
2010-10-01 21:52:51 +02:00
2011-03-22 23:02:06 +01:00
@Id
@Column(name="packet_id", insertable=false, updatable=false, columnDefinition = "integer")
private long pacId;
2010-10-01 21:52:51 +02:00
2010-10-06 15:06:01 +02:00
@Id
2011-03-22 23:02:06 +01:00
@Column(name="basepacket_id", insertable=false, updatable=false, columnDefinition = "integer")
private long basePacId;
@Id
@Column(name="basecomponent_id", insertable=false, updatable=false, columnDefinition = "integer")
private long baseComponentId;
@ManyToOne
@JoinColumn(name = "packet_id")
2010-10-01 21:52:51 +02:00
private Pac pac;
2011-03-22 23:02:06 +01:00
@ManyToOne
@JoinColumn(name = "basecomponent_id")
2010-10-01 21:52:51 +02:00
private BaseComponent baseComponent;
2011-03-22 23:02:06 +01:00
@ManyToOne
@JoinColumn(name = "basepacket_id")
2010-10-01 21:52:51 +02:00
private BasePac basePac;
2010-10-06 15:06:01 +02:00
@Column(name = "quantity", columnDefinition = "integer")
2010-10-01 21:52:51 +02:00
private int quantity;
2010-10-06 15:06:01 +02:00
@Column(name = "created", columnDefinition = "date", nullable = true)
@Temporal(TemporalType.DATE)
2010-10-01 21:52:51 +02:00
private Date created;
2010-10-06 15:06:01 +02:00
@Column(name = "cancelled", columnDefinition = "date", nullable = true)
@Temporal(TemporalType.DATE)
2010-10-01 21:52:51 +02:00
private Date cancelled;
public PacComponent() {
}
public PacComponent(BasePac basePac, BaseComponent baseComp, Pac pac,
int quantity, Date created, Date cancelled) {
this.basePac = basePac;
2011-03-23 13:12:13 +01:00
if (basePac != null) {
this.basePacId = basePac.id();
}
2010-10-01 21:52:51 +02:00
this.pac = pac;
2011-03-23 13:12:13 +01:00
if (pac != null) {
this.pacId = pac.id();
}
2010-10-01 21:52:51 +02:00
this.baseComponent = baseComp;
2011-03-23 13:12:13 +01:00
if (baseComponent != null) {
this.baseComponentId = baseComp.id();
}
2010-10-01 21:52:51 +02:00
this.quantity = quantity;
this.created = created;
this.cancelled = cancelled;
}
public BasePac getBasePac() {
return basePac;
}
public void setbasePac(BasePac basePac) {
this.basePac = basePac;
2011-03-23 13:12:13 +01:00
if (basePac != null) {
this.basePacId = basePac.id();
}
2010-10-01 21:52:51 +02:00
}
public BaseComponent getBaseComponent() {
return baseComponent;
}
public void setBaseComponent(BaseComponent baseComponent) {
this.baseComponent = baseComponent;
2011-03-23 13:12:13 +01:00
if (baseComponent != null) {
this.baseComponentId = baseComponent.id();
}
2010-10-01 21:52:51 +02:00
}
public Pac getPac() {
return pac;
}
public void setPac(Pac pac) {
this.pac = pac;
2011-03-23 13:12:13 +01:00
if (pac != null) {
this.pacId = pac.id();
}
2010-10-01 21:52:51 +02:00
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
public Date getCancelled() {
return cancelled;
}
public void setCancelled(Date cancelled) {
this.cancelled = cancelled;
}
2011-03-22 23:02:06 +01:00
public void setPacId(long pacId) {
this.pacId = pacId;
}
public long getPacId() {
return pacId;
}
public void setBaseComponentId(long baseComponentId) {
this.baseComponentId = baseComponentId;
}
public long getBaseComponentId() {
return baseComponentId;
}
public void setBasePacId(long basePacId) {
this.basePacId = basePacId;
}
public long getBasePacId() {
return basePacId;
}
2010-10-01 21:52:51 +02:00
}