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;
|
|
|
|
|
|
|
|
import javax.persistence.EntityManager;
|
2010-10-04 17:44:49 +00:00
|
|
|
import javax.persistence.GenerationType;
|
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;
|
|
|
|
|
|
|
|
@javax.persistence.Entity(name = "CustomersTariffs")
|
|
|
|
@javax.persistence.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;
|
|
|
|
|
2010-10-04 17:44:49 +00:00
|
|
|
@javax.persistence.Id
|
|
|
|
@javax.persistence.GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
|
|
@javax.persistence.Column(name = "billdata_id", columnDefinition = "integer")
|
|
|
|
private long id;
|
|
|
|
|
|
|
|
@javax.persistence.JoinColumn(name = "bp_id", columnDefinition = "integer")
|
|
|
|
@javax.persistence.OneToOne(fetch = EAGER)
|
|
|
|
private Customer customer;
|
|
|
|
|
|
|
|
@javax.persistence.Column(name = "tariff_domain_discount_since", columnDefinition = "date")
|
|
|
|
@javax.persistence.Temporal(javax.persistence.TemporalType.DATE)
|
|
|
|
private Date domainDiscountSince;
|
|
|
|
|
|
|
|
@javax.persistence.Column(name = "tariff_domain_discount_until", columnDefinition = "date")
|
|
|
|
@javax.persistence.Temporal(javax.persistence.TemporalType.DATE)
|
|
|
|
private Date domainDiscountUntil;
|
|
|
|
|
|
|
|
@javax.persistence.Column(name = "tariff_traffic_discount_since", columnDefinition = "date")
|
|
|
|
@javax.persistence.Temporal(javax.persistence.TemporalType.DATE)
|
|
|
|
private Date trafficDiscountSince;
|
|
|
|
|
|
|
|
@javax.persistence.Column(name = "tariff_traffic_discount_until", columnDefinition = "date")
|
|
|
|
@javax.persistence.Temporal(javax.persistence.TemporalType.DATE)
|
|
|
|
private Date trafficDiscountUntil;
|
|
|
|
|
|
|
|
@javax.persistence.Column(name = "tariff_quota_discount_since", columnDefinition = "date")
|
|
|
|
@javax.persistence.Temporal(javax.persistence.TemporalType.DATE)
|
|
|
|
private Date quotaDiscountSince;
|
|
|
|
|
|
|
|
@javax.persistence.Column(name = "tariff_quota_discount_until", columnDefinition = "date")
|
|
|
|
@javax.persistence.Temporal(javax.persistence.TemporalType.DATE)
|
|
|
|
private Date quotaDiscountUntil;
|
|
|
|
|
|
|
|
@javax.persistence.Column(name = "tariff_discount_since", columnDefinition = "date")
|
|
|
|
@javax.persistence.Temporal(javax.persistence.TemporalType.DATE)
|
|
|
|
private Date discountSince;
|
|
|
|
|
|
|
|
@javax.persistence.Column(name = "tariff_discount_until", columnDefinition = "date")
|
|
|
|
@javax.persistence.Temporal(javax.persistence.TemporalType.DATE)
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|