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

154 lines
3.5 KiB
Java
Raw Normal View History

2010-10-01 21:52:51 +02:00
package de.hsadmin.mods.pac;
import java.io.Serializable;
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;
2011-03-22 23:02:06 +01:00
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
2010-10-06 15:06:01 +02:00
import javax.persistence.Table;
2010-10-01 21:52:51 +02:00
2010-10-06 15:06:01 +02:00
@Entity(name = "Components")
@Table(name = "component")
2010-10-01 21:52:51 +02:00
@IdClass(ComponentId.class)
public class Component implements Serializable {
private static final long serialVersionUID = 970709621200712794L;
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)
private long basePacId;
@Id
@Column(name="basecomponent_id", insertable=false, updatable=false)
private long baseComponentId;
@ManyToOne
@JoinColumn(name="basepacket_id")
2010-10-01 21:52:51 +02:00
private BasePac basePac;
2011-03-22 23:02:06 +01:00
@ManyToOne
@JoinColumn(name="basecomponent_id")
2010-10-01 21:52:51 +02:00
private BaseComponent baseComponent;
2010-10-06 15:06:01 +02:00
@Column(name = "min_quantity", columnDefinition = "integer")
2010-10-01 21:52:51 +02:00
private int minimumQuantity;
2010-10-06 15:06:01 +02:00
@Column(name = "max_quantity", columnDefinition = "integer")
2010-10-01 21:52:51 +02:00
private int maximimumQuantity;
2010-10-06 15:06:01 +02:00
@Column(name = "default_quantity", columnDefinition = "integer")
2010-10-01 21:52:51 +02:00
private int defaultQuantity;
2010-10-06 15:06:01 +02:00
@Column(name = "increment_quantity", columnDefinition = "integer")
2010-10-01 21:52:51 +02:00
private int incrementQuantity;
2010-10-06 15:06:01 +02:00
@Column(name = "include_quantity", columnDefinition = "integer")
2010-10-01 21:52:51 +02:00
private int includedQuantity;
2010-10-06 15:06:01 +02:00
@Column(name = "admin_only", columnDefinition = "boolean")
2010-10-01 21:52:51 +02:00
private boolean adminOnly;
public Component() {
}
public Component(BasePac basePac, BaseComponent baseComp, int min, int max,
int def, int incr, int incl, boolean adminOnly) {
2011-03-22 23:02:06 +01:00
this.setBasePacId(basePac.id());
2010-10-01 21:52:51 +02:00
this.basePac = basePac;
2011-03-22 23:02:06 +01:00
this.setBaseComponentId(baseComp.id());
2010-10-01 21:52:51 +02:00
this.baseComponent = baseComp;
this.minimumQuantity = min;
this.maximimumQuantity = max;
this.defaultQuantity = def;
this.incrementQuantity = incr;
this.includedQuantity = incl;
this.adminOnly = adminOnly;
}
public BasePac getBasePac() {
return basePac;
}
public void setBasePac(BasePac basePac) {
2011-03-22 23:02:06 +01:00
this.setBasePacId(basePac.id());
2010-10-01 21:52:51 +02:00
this.basePac = basePac;
}
public BaseComponent getBaseComponent() {
return baseComponent;
}
public void setBaseComponent(BaseComponent baseComponent) {
2011-03-22 23:02:06 +01:00
this.setBaseComponentId(baseComponent.id());
2010-10-01 21:52:51 +02:00
this.baseComponent = baseComponent;
}
public int getMinimumQuantity() {
return minimumQuantity;
}
public void setMinimumQuantity(int minimumQuantity) {
this.minimumQuantity = minimumQuantity;
}
public int getMaximimumQuantity() {
return maximimumQuantity;
}
public void setMaximimumQuantity(int maximimumQuantity) {
this.maximimumQuantity = maximimumQuantity;
}
public int getDefaultQuantity() {
return defaultQuantity;
}
public void setDefaultQuantity(int defiautoQuantity) {
this.defaultQuantity = defiautoQuantity;
}
public int getIncrementQuantity() {
return incrementQuantity;
}
public void setIncrementQuantity(int incrementQuantity) {
this.incrementQuantity = incrementQuantity;
}
public int getIncludedQuantity() {
return includedQuantity;
}
public void setIncludedQuantity(int includedQuantity) {
this.includedQuantity = includedQuantity;
}
public boolean isAdminOnly() {
return adminOnly;
}
public void setAdminOnly(boolean adminOnly) {
this.adminOnly = adminOnly;
}
2011-03-22 23:02:06 +01:00
public void setBasePacId(long basePacId) {
this.basePacId = basePacId;
}
public long getBasePacId() {
return basePacId;
}
public void setBaseComponentId(long baseComponentId) {
this.baseComponentId = baseComponentId;
}
public long getBaseComponentId() {
return baseComponentId;
}
2010-10-01 21:52:51 +02:00
}