package api.unibill.component;
import static api.util.ComponentConstants.DATE_NULL;
import static api.util.ComponentConstants.DATE_NULL_CODE;
import static api.util.ComponentConstants.INTEGER_NULL;
import static api.util.ComponentConstants.INTEGER_NULL_CODE;
import static api.util.ComponentConstants.LONG_NULL;
import static api.util.ComponentConstants.LONG_NULL_CODE;
import static api.util.ComponentConstants.STRING_NULL;
import static api.util.ComponentConstants.STRING_NULL_CODE;
import static org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion.NON_NULL;
import api.UnoComponent;
import api.unicore.component_manual.Subscription;
import api.util.DateFormat;
import api.util.IntegerFormat;
import api.util.LongFormat;
import api.util.ReferenceFormat;
import api.util.StringFormat;
import java.util.Date;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.FormParam;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.codehaus.jackson.annotate.JsonPropertyOrder;
import org.codehaus.jackson.map.annotate.JsonDeserialize;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import unipay.fields_manual.Fields;
import unipay.validator.CustomValidator;
import unipay.validator.EnumValidator;
import unipay.validator.group.AdjustGroup;
import unipay.validator.group.CreateGroup;
import unipay.validator.group.ModifyGroup;
/**
* @author CodeGen [Anton Shershnov]
* @company UnitedThinkers
* @since 2018/09/11
*/
@JsonSerialize(include=NON_NULL)
@XmlType(propOrder={"id", "code", "accountId", "amount", "createDate", "customerId", "firstBillingDate", "lastBillingDate", "lastUpdateDate", "length", "nextBillingDate", "note", "paymentOptionId", "planId", "planName", "status", "type", "billingCycleType", "pendingAdjustmentType", "pendingAdjustmentEffectiveDate", "pendingAdjustmentNote", "pendingAdjustmentLength", "nextInvoicingDate", "firstInvoicingDate", "taxAmount"})
@JsonPropertyOrder({"id", "code", "accountId", "amount", "createDate", "customerId", "firstBillingDate", "lastBillingDate", "lastUpdateDate", "length", "nextBillingDate", "note", "paymentOptionId", "planId", "planName", "status", "type", "billingCycleType", "pendingAdjustmentType", "pendingAdjustmentEffectiveDate", "pendingAdjustmentNote", "pendingAdjustmentLength", "nextInvoicingDate", "firstInvoicingDate", "taxAmount"})
@XmlAccessorType(XmlAccessType.NONE)
@XmlSeeAlso(Subscription.class)
@CustomValidator
public abstract class AbstractSubscription extends UnoComponent<unibill.model.PaymentPlan> {
@FormParam("id")
@LongFormat
@DefaultValue(LONG_NULL_CODE)
protected Long id;
@FormParam("code")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String code;
@FormParam("accountId")
@IntegerFormat
@DefaultValue(INTEGER_NULL_CODE)
protected Integer accountId;
@FormParam("amount")
@IntegerFormat
@DefaultValue(INTEGER_NULL_CODE)
protected Integer amount;
@FormParam("createDate")
@DateFormat
@DefaultValue(DATE_NULL_CODE)
protected Date createDate;
@FormParam("customerId")
@LongFormat
@DefaultValue(LONG_NULL_CODE)
protected Long customerId;
@FormParam("firstBillingDate")
@DateFormat
@DefaultValue(DATE_NULL_CODE)
protected Date firstBillingDate;
@FormParam("lastBillingDate")
@DateFormat
@DefaultValue(DATE_NULL_CODE)
protected Date lastBillingDate;
@FormParam("lastUpdateDate")
@DateFormat
@DefaultValue(DATE_NULL_CODE)
protected Date lastUpdateDate;
@FormParam("length")
@IntegerFormat
@DefaultValue(INTEGER_NULL_CODE)
protected Integer length;
@FormParam("nextBillingDate")
@DateFormat
@DefaultValue(DATE_NULL_CODE)
protected Date nextBillingDate;
@FormParam("note")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String note;
protected Long paymentOptionId = new Long();
protected Long planId = new Long();
@FormParam("planName")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String planName;
@FormParam("status")
@StringFormat
protected String status;
@FormParam("type")
@StringFormat
protected String type;
@FormParam("billingCycleType")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String billingCycleType;
@FormParam("pendingAdjustmentType")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String pendingAdjustmentType;
@FormParam("pendingAdjustmentEffectiveDate")
@DateFormat
@DefaultValue(DATE_NULL_CODE)
protected Date pendingAdjustmentEffectiveDate;
@FormParam("pendingAdjustmentNote")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String pendingAdjustmentNote;
@FormParam("pendingAdjustmentLength")
@IntegerFormat
@DefaultValue(INTEGER_NULL_CODE)
protected Integer pendingAdjustmentLength;
@FormParam("nextInvoicingDate")
@DateFormat
@DefaultValue(DATE_NULL_CODE)
protected Date nextInvoicingDate;
@FormParam("firstInvoicingDate")
@DateFormat
@DefaultValue(DATE_NULL_CODE)
protected Date firstInvoicingDate;
@FormParam("taxAmount")
@IntegerFormat
@DefaultValue(INTEGER_NULL_CODE)
protected Integer taxAmount;
public AbstractSubscription(){
super();
applyDefaults();
}
public AbstractSubscription(unibill.model.PaymentPlan object){
super(object);
}
private void applyDefaults() {
if (!isProxyObject()) {
id = LONG_NULL;
code = STRING_NULL;
accountId = INTEGER_NULL;
amount = INTEGER_NULL;
createDate = DATE_NULL;
customerId = LONG_NULL;
firstBillingDate = DATE_NULL;
lastBillingDate = DATE_NULL;
lastUpdateDate = DATE_NULL;
length = INTEGER_NULL;
nextBillingDate = DATE_NULL;
note = STRING_NULL;
paymentOptionId = LONG_NULL;
planId = LONG_NULL;
planName = STRING_NULL;
billingCycleType = STRING_NULL;
pendingAdjustmentType = STRING_NULL;
pendingAdjustmentEffectiveDate = DATE_NULL;
pendingAdjustmentNote = STRING_NULL;
pendingAdjustmentLength = INTEGER_NULL;
nextInvoicingDate = DATE_NULL;
firstInvoicingDate = DATE_NULL;
taxAmount = INTEGER_NULL;
}
status = U;
type = P;
}
@Override
public void from() {
fromInternal();
super.from();
}
protected abstract void fromInternal();
@Override
public abstract void to();
@Override
public abstract void initializeNew();
@Override
public String toString(){
StringBuilder sb = new StringBuilder();
sb.append("subscription: {");
sb.append("id: ");
sb.append(id);
sb.append(',').append(' ');
sb.append("code: ");
sb.append(code);
sb.append(',').append(' ');
sb.append("accountId: ");
sb.append(accountId);
sb.append(',').append(' ');
sb.append("amount: ");
sb.append(amount);
sb.append(',').append(' ');
sb.append("createDate: ");
sb.append(createDate);
sb.append(',').append(' ');
sb.append("customerId: ");
sb.append(customerId);
sb.append(',').append(' ');
sb.append("firstBillingDate: ");
sb.append(firstBillingDate);
sb.append(',').append(' ');
sb.append("lastBillingDate: ");
sb.append(lastBillingDate);
sb.append(',').append(' ');
sb.append("lastUpdateDate: ");
sb.append(lastUpdateDate);
sb.append(',').append(' ');
sb.append("length: ");
sb.append(length);
sb.append(',').append(' ');
sb.append("nextBillingDate: ");
sb.append(nextBillingDate);
sb.append(',').append(' ');
sb.append("note: ");
sb.append(note);
sb.append(',').append(' ');
sb.append("paymentOptionId: ");
sb.append(paymentOptionId);
sb.append(',').append(' ');
sb.append("planId: ");
sb.append(planId);
sb.append(',').append(' ');
sb.append("planName: ");
sb.append(planName);
sb.append(',').append(' ');
sb.append("status: ");
sb.append(status);
sb.append(',').append(' ');
sb.append("type: ");
sb.append(type);
sb.append(',').append(' ');
sb.append("billingCycleType: ");
sb.append(billingCycleType);
sb.append(',').append(' ');
sb.append("pendingAdjustmentType: ");
sb.append(pendingAdjustmentType);
sb.append(',').append(' ');
sb.append("pendingAdjustmentEffectiveDate: ");
sb.append(pendingAdjustmentEffectiveDate);
sb.append(',').append(' ');
sb.append("pendingAdjustmentNote: ");
sb.append(pendingAdjustmentNote);
sb.append(',').append(' ');
sb.append("pendingAdjustmentLength: ");
sb.append(pendingAdjustmentLength);
sb.append(',').append(' ');
sb.append("nextInvoicingDate: ");
sb.append(nextInvoicingDate);
sb.append(',').append(' ');
sb.append("firstInvoicingDate: ");
sb.append(firstInvoicingDate);
sb.append(',').append(' ');
sb.append("taxAmount: ");
sb.append(taxAmount);
sb.append('}');
return sb.toString();
}
@XmlAttribute(name="id")
@XmlJavaTypeAdapter(value=api.util.LongAdapter.class, type=Long.class)
@FormParam("id")
@LongFormat
@JsonDeserialize(using=api.util.NumberDeserializer.class)
public Long getId(){
return id;
}
public void setId(Long value){
this.id = value;
}
@XmlAttribute(name="code")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("code")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@Size(max = 60)
@Pattern(regexp = unipay.validator.PatternName.CODE)
public String getCode(){
return code;
}
public void setCode(String value){
this.code = value;
}
@XmlAttribute(name="accountId")
@XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
@FormParam("accountId")
@IntegerFormat
@JsonDeserialize(using=api.util.NumberDeserializer.class)
public Integer getAccountId(){
return accountId;
}
public void setAccountId(Integer value){
this.accountId = value;
}
@XmlAttribute(name="amount")
@XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
@FormParam("amount")
@IntegerFormat
@JsonDeserialize(using=api.util.NumberDeserializer.class)
@Min(value = 0, groups = ModifyGroup.class)
public Integer getAmount(){
return amount;
}
public void setAmount(Integer value){
this.amount = value;
}
@XmlAttribute(name="createDate")
@XmlJavaTypeAdapter(api.util.DateTimeAdapter.class)
@FormParam("createDate")
@DateFormat
@JsonSerialize(using=api.util.DateTimeSerializer.class, include = NON_NULL)
@JsonDeserialize(using=api.util.DateDeserializer.class)
public Date getCreateDate(){
return createDate;
}
public void setCreateDate(Date value){
this.createDate = value;
}
@XmlAttribute(name="customerId")
@XmlJavaTypeAdapter(value=api.util.LongAdapter.class, type=Long.class)
@FormParam("customerId")
@LongFormat
@JsonDeserialize(using=api.util.NumberDeserializer.class)
public Long getCustomerId(){
return customerId;
}
public void setCustomerId(Long value){
this.customerId = value;
}
@XmlAttribute(name="firstBillingDate")
@FormParam("firstBillingDate")
@DateFormat
@JsonDeserialize(using=api.util.DateDeserializer.class)
@NotNull
public Date getFirstBillingDate(){
return firstBillingDate;
}
public void setFirstBillingDate(Date value){
this.firstBillingDate = value;
}
@XmlAttribute(name="lastBillingDate")
@FormParam("lastBillingDate")
@DateFormat
@JsonDeserialize(using=api.util.DateDeserializer.class)
public Date getLastBillingDate(){
return lastBillingDate;
}
public void setLastBillingDate(Date value){
this.lastBillingDate = value;
}
@XmlAttribute(name="lastUpdateDate")
@XmlJavaTypeAdapter(api.util.DateTimeAdapter.class)
@FormParam("lastUpdateDate")
@DateFormat
@JsonSerialize(using=api.util.DateTimeSerializer.class, include = NON_NULL)
@JsonDeserialize(using=api.util.DateDeserializer.class)
public Date getLastUpdateDate(){
return lastUpdateDate;
}
public void setLastUpdateDate(Date value){
this.lastUpdateDate = value;
}
@XmlAttribute(name="length")
@XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
@FormParam("length")
@IntegerFormat
@JsonDeserialize(using=api.util.NumberDeserializer.class)
public Integer getLength(){
return length;
}
public void setLength(Integer value){
this.length = value;
}
@XmlAttribute(name="nextBillingDate")
@FormParam("nextBillingDate")
@DateFormat
@JsonDeserialize(using=api.util.DateDeserializer.class)
public Date getNextBillingDate(){
return nextBillingDate;
}
public void setNextBillingDate(Date value){
this.nextBillingDate = value;
}
@XmlAttribute(name="note")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("note")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@Size(max = 255, groups = {CreateGroup.class,ModifyGroup.class})
@Pattern(regexp = unipay.validator.PatternName.TEXT, groups = {CreateGroup.class,ModifyGroup.class})
public String getNote(){
return note;
}
public void setNote(String value){
this.note = value;
}
@XmlAttribute(name="paymentOptionId")
@XmlJavaTypeAdapter(api.util.PaymentOptionIdAdapter.class)
@FormParam("paymentOptionId")
@LongFormat
@JsonDeserialize(using = api.util.PaymentOptionIdDeserializer.class)
@NotNull
public Long getPaymentOptionId(){
return paymentOptionId;
}
public void setPaymentOptionId(Long value){
this.paymentOptionId = value;
}
@XmlAttribute(name="planId")
@XmlJavaTypeAdapter(api.util.PlanIdAdapter.class)
@FormParam("planId")
@LongFormat
@JsonDeserialize(using = api.util.PlanIdDeserializer.class)
public Long getPlanId(){
return planId;
}
public void setPlanId(Long value){
this.planId = value;
}
@XmlAttribute(name="planName")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("planName")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@Size(max = 255)
public String getPlanName(){
return planName;
}
public void setPlanName(String value){
this.planName = value;
}
@XmlAttribute(name="status")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("status")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@EnumValidator(unibill.model.PaymentPlanStatus.class)
public String getStatus(){
return status;
}
public void setStatus(String value){
this.status = value;
}
@XmlAttribute(name="type")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("type")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@Size(max = 1)
@EnumValidator(unibill.model.PaymentPlanClassifier.class)
public String getType(){
return type;
}
public void setType(String value){
this.type = value;
}
@XmlAttribute(name="billingCycleType")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("billingCycleType")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@Size(max = 1)
@EnumValidator(unibill.model.BillingCycleClassifier.class)
public String getBillingCycleType(){
return billingCycleType;
}
public void setBillingCycleType(String value){
this.billingCycleType = value;
}
@XmlAttribute(name="pendingAdjustmentType")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("pendingAdjustmentType")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@Size(max = 1)
@EnumValidator(unibill.model.SubscriptionAdjustmentClassifier.class)
public String getPendingAdjustmentType(){
return pendingAdjustmentType;
}
public void setPendingAdjustmentType(String value){
this.pendingAdjustmentType = value;
}
@XmlAttribute(name="pendingAdjustmentEffectiveDate")
@FormParam("pendingAdjustmentEffectiveDate")
@DateFormat
@JsonDeserialize(using=api.util.DateDeserializer.class)
public Date getPendingAdjustmentEffectiveDate(){
return pendingAdjustmentEffectiveDate;
}
public void setPendingAdjustmentEffectiveDate(Date value){
this.pendingAdjustmentEffectiveDate = value;
}
@XmlAttribute(name="pendingAdjustmentNote")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("pendingAdjustmentNote")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@NotNull(groups = AdjustGroup.class)
@Size(max = 255, groups = AdjustGroup.class)
@Pattern(regexp = unipay.validator.PatternName.TEXT, groups = AdjustGroup.class)
public String getPendingAdjustmentNote(){
return pendingAdjustmentNote;
}
public void setPendingAdjustmentNote(String value){
this.pendingAdjustmentNote = value;
}
@XmlAttribute(name="pendingAdjustmentLength")
@XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
@FormParam("pendingAdjustmentLength")
@IntegerFormat
@JsonDeserialize(using=api.util.NumberDeserializer.class)
public Integer getPendingAdjustmentLength(){
return pendingAdjustmentLength;
}
public void setPendingAdjustmentLength(Integer value){
this.pendingAdjustmentLength = value;
}
@XmlAttribute(name="nextInvoicingDate")
@FormParam("nextInvoicingDate")
@DateFormat
@JsonDeserialize(using=api.util.DateDeserializer.class)
public Date getNextInvoicingDate(){
return nextInvoicingDate;
}
public void setNextInvoicingDate(Date value){
this.nextInvoicingDate = value;
}
@XmlAttribute(name="firstInvoicingDate")
@FormParam("firstInvoicingDate")
@DateFormat
@JsonDeserialize(using=api.util.DateDeserializer.class)
public Date getFirstInvoicingDate(){
return firstInvoicingDate;
}
public void setFirstInvoicingDate(Date value){
this.firstInvoicingDate = value;
}
@XmlAttribute(name="taxAmount")
@XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
@FormParam("taxAmount")
@IntegerFormat
@JsonDeserialize(using=api.util.NumberDeserializer.class)
@Min(0)
public Integer getTaxAmount(){
return taxAmount;
}
public void setTaxAmount(Integer value){
this.taxAmount = value;
}
}