hs.hsadmin/hsarback/src/de/hsadmin/mods/cust/CustomersTariff.java

180 lines
4.4 KiB
Java
Raw Normal View History

2010-10-01 19:52:51 +00:00
package de.hsadmin.mods.cust;
import static javax.persistence.FetchType.EAGER;
2010-10-04 17:44:49 +00:00
import java.io.Serializable;
2010-10-01 19:52:51 +00:00
import java.util.Date;
2012-07-27 08:41:10 +00:00
import javax.persistence.Column;
import javax.persistence.Entity;
2010-10-01 19:52:51 +00:00
import javax.persistence.EntityManager;
2012-07-27 08:41:10 +00:00
import javax.persistence.GeneratedValue;
2010-10-04 17:44:49 +00:00
import javax.persistence.GenerationType;
2012-07-27 08:41:10 +00:00
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
2010-10-01 19:52:51 +00:00
2010-10-04 17:44:49 +00:00
import de.hsadmin.core.model.AbstractEntity;
2010-10-01 19:52:51 +00:00
import de.hsadmin.mods.user.UnixUser;
2012-07-27 08:41:10 +00:00
@Entity(name = "CustomersTariffs")
@Table(name = "billdata")
2010-10-04 17:44:49 +00:00
public class CustomersTariff extends AbstractEntity implements Serializable {
2010-10-01 19:52:51 +00:00
private static final long serialVersionUID = -3628577459027111705L;
2012-07-27 08:41:10 +00:00
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "billdata_id", columnDefinition = "integer")
2010-10-04 17:44:49 +00:00
private long id;
2012-07-27 08:41:10 +00:00
@JoinColumn(name = "bp_id", columnDefinition = "integer")
@OneToOne(fetch = EAGER)
2010-10-04 17:44:49 +00:00
private Customer customer;
2012-07-27 08:41:10 +00:00
@Column(name = "tariff_domain_discount_since", columnDefinition = "date")
@Temporal(javax.persistence.TemporalType.DATE)
2010-10-04 17:44:49 +00:00
private Date domainDiscountSince;
2012-07-27 08:41:10 +00:00
@Column(name = "tariff_domain_discount_until", columnDefinition = "date")
@Temporal(javax.persistence.TemporalType.DATE)
2010-10-04 17:44:49 +00:00
private Date domainDiscountUntil;
2012-07-27 08:41:10 +00:00
@Column(name = "tariff_traffic_discount_since", columnDefinition = "date")
@Temporal(javax.persistence.TemporalType.DATE)
2010-10-04 17:44:49 +00:00
private Date trafficDiscountSince;
2012-07-27 08:41:10 +00:00
@Column(name = "tariff_traffic_discount_until", columnDefinition = "date")
@Temporal(javax.persistence.TemporalType.DATE)
2010-10-04 17:44:49 +00:00
private Date trafficDiscountUntil;
2012-07-27 08:41:10 +00:00
@Column(name = "tariff_quota_discount_since", columnDefinition = "date")
@Temporal(javax.persistence.TemporalType.DATE)
2010-10-04 17:44:49 +00:00
private Date quotaDiscountSince;
2012-07-27 08:41:10 +00:00
@Column(name = "tariff_quota_discount_until", columnDefinition = "date")
@Temporal(javax.persistence.TemporalType.DATE)
2010-10-04 17:44:49 +00:00
private Date quotaDiscountUntil;
2012-07-27 08:41:10 +00:00
@Column(name = "tariff_discount_since", columnDefinition = "date")
@Temporal(javax.persistence.TemporalType.DATE)
2010-10-04 17:44:49 +00:00
private Date discountSince;
2012-07-27 08:41:10 +00:00
@Column(name = "tariff_discount_until", columnDefinition = "date")
@Temporal(javax.persistence.TemporalType.DATE)
2010-10-04 17:44:49 +00:00
private Date discountUntil;
2010-10-01 19:52:51 +00:00
public CustomersTariff() {
}
public CustomersTariff(Customer cust) {
this.customer = cust;
}
public static String createQueryFromStringKey(String humanKey) {
return "customer.name = '" + humanKey + "'";
}
@Override
public String createStringKey() {
return getCustomer().getName();
}
@Override
public long id() {
return id;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public Customer getCustomer() {
return customer;
}
public void setCustomer(Customer customer) {
this.customer = customer;
}
public Date getDomainDiscountSince() {
return domainDiscountSince;
}
public void setDomainDiscountSince(Date domainDiscountSince) {
this.domainDiscountSince = domainDiscountSince;
}
public Date getDomainDiscountUntil() {
return domainDiscountUntil;
}
public void setDomainDiscountUntil(Date domainDiscountUntil) {
this.domainDiscountUntil = domainDiscountUntil;
}
public Date getTrafficDiscountSince() {
return trafficDiscountSince;
}
public void setTrafficDiscountSince(Date trafficDiscountSince) {
this.trafficDiscountSince = trafficDiscountSince;
}
public Date getTrafficDiscountUntil() {
return trafficDiscountUntil;
}
public void setTrafficDiscountUntil(Date trafficDiscountUntil) {
this.trafficDiscountUntil = trafficDiscountUntil;
}
public Date getQuotaDiscountSince() {
return quotaDiscountSince;
}
public void setQuotaDiscountSince(Date quotaDiscountSince) {
this.quotaDiscountSince = quotaDiscountSince;
}
public Date getQuotaDiscountUntil() {
return quotaDiscountUntil;
}
public void setQuotaDiscountUntil(Date quotaDiscountUntil) {
this.quotaDiscountUntil = quotaDiscountUntil;
}
public Date getDiscountSince() {
return discountSince;
}
public void setDiscountSince(Date discountSince) {
this.discountSince = discountSince;
}
public Date getDiscountUntil() {
return discountUntil;
}
public void setDiscountUntil(Date discountUntil) {
this.discountUntil = discountUntil;
}
@Override
public boolean isNew() {
return id == 0;
}
@Override
public UnixUser owningUser(EntityManager em) {
return customer.owningUser(em);
}
}