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.Customer;
import api.util.BooleanFormat;
import api.util.DateFormat;
import api.util.IntegerFormat;
import api.util.LongFormat;
import api.util.StringFormat;
import java.util.Date;
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.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.validator.CustomValidator;
/**
* @author CodeGen [Alexander Fliagin]
* @company UnitedThinkers
* @since 2018/05/04
*/
@JsonSerialize(include=NON_NULL)
@XmlType(propOrder={"id", "code", "accountId", "createDate", "firstName", "lastName", "organizationName", "email", "phone", "isActive", "balance", "street1", "street2", "city", "countryCode", "state", "zipCode"})
@JsonPropertyOrder({"id", "code", "accountId", "createDate", "firstName", "lastName", "organizationName", "email", "phone", "isActive", "balance", "street1", "street2", "city", "countryCode", "state", "zipCode"})
@XmlAccessorType(XmlAccessType.NONE)
@XmlSeeAlso(Customer.class)
@CustomValidator
public abstract class AbstractCustomer extends UnoComponent<unibill.model.Address> {
@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("createDate")
@DateFormat
@DefaultValue(DATE_NULL_CODE)
protected Date createDate;
@FormParam("firstName")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String firstName;
@FormParam("lastName")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String lastName;
@FormParam("organizationName")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String organizationName;
@FormParam("email")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String email;
@FormParam("phone")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String phone;
@FormParam("isActive")
@BooleanFormat
protected Boolean isActive;
@FormParam("balance")
@IntegerFormat
@DefaultValue(INTEGER_NULL_CODE)
protected Integer balance;
@FormParam("street1")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String street1;
@FormParam("street2")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String street2;
@FormParam("city")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String city;
@FormParam("countryCode")
@StringFormat
protected String countryCode;
@FormParam("state")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String state;
@FormParam("zipCode")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String zipCode;
public AbstractCustomer(){
super();
applyDefaults();
}
public AbstractCustomer(unibill.model.Address object){
super(object);
}
private void applyDefaults() {
if (!isProxyObject()) {
id = LONG_NULL;
code = STRING_NULL;
accountId = INTEGER_NULL;
createDate = DATE_NULL;
firstName = STRING_NULL;
lastName = STRING_NULL;
organizationName = STRING_NULL;
email = STRING_NULL;
phone = STRING_NULL;
balance = INTEGER_NULL;
street1 = STRING_NULL;
street2 = STRING_NULL;
city = STRING_NULL;
state = STRING_NULL;
zipCode = STRING_NULL;
}
isActive = true;
countryCode = "US";
}
@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("customer: {");
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("createDate: ");
sb.append(createDate);
sb.append(',').append(' ');
sb.append("firstName: ");
sb.append(firstName);
sb.append(',').append(' ');
sb.append("lastName: ");
sb.append(lastName);
sb.append(',').append(' ');
sb.append("organizationName: ");
sb.append(organizationName);
sb.append(',').append(' ');
sb.append("email: ");
sb.append(email);
sb.append(',').append(' ');
sb.append("phone: ");
sb.append(phone);
sb.append(',').append(' ');
sb.append("isActive: ");
sb.append(isActive);
sb.append(',').append(' ');
sb.append("balance: ");
sb.append(balance);
sb.append(',').append(' ');
sb.append("street1: ");
sb.append(street1);
sb.append(',').append(' ');
sb.append("street2: ");
sb.append(street2);
sb.append(',').append(' ');
sb.append("city: ");
sb.append(city);
sb.append(',').append(' ');
sb.append("countryCode: ");
sb.append(countryCode);
sb.append(',').append(' ');
sb.append("state: ");
sb.append(state);
sb.append(',').append(' ');
sb.append("zipCode: ");
sb.append(zipCode);
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)
@NotNull
public Integer getAccountId(){
return accountId;
}
public void setAccountId(Integer value){
this.accountId = 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="firstName")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("firstName")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@NotNull
@Size(min = 1, max = 125)
@Pattern(regexp = unipay.validator.PatternName.NAME)
public String getFirstName(){
return firstName;
}
public void setFirstName(String value){
this.firstName = value;
}
@XmlAttribute(name="lastName")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("lastName")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@NotNull
@Size(min = 1, max = 125)
@Pattern(regexp = unipay.validator.PatternName.NAME)
public String getLastName(){
return lastName;
}
public void setLastName(String value){
this.lastName = value;
}
@XmlAttribute(name="organizationName")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("organizationName")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@Size(max = 255)
@Pattern(regexp = unipay.validator.PatternName.NAME_BUSINESS)
public String getOrganizationName(){
return organizationName;
}
public void setOrganizationName(String value){
this.organizationName = value;
}
@XmlAttribute(name="email")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("email")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@Size(max = 100)
@Pattern(regexp = unipay.validator.PatternName.EMAIL)
public String getEmail(){
return email;
}
public void setEmail(String value){
this.email = value;
}
@XmlAttribute(name="phone")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("phone")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@NotNull
@Size(min = 10, max = 15)
@Pattern(regexp = unipay.validator.PatternName.NUMERIC)
public String getPhone(){
return phone;
}
public void setPhone(String value){
this.phone = value;
}
@XmlAttribute(name="isActive")
@FormParam("isActive")
@BooleanFormat
public Boolean getIsActive(){
return isActive;
}
public void setIsActive(Boolean value){
this.isActive = value;
}
@XmlAttribute(name="balance")
@XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
@FormParam("balance")
@IntegerFormat
@JsonDeserialize(using=api.util.NumberDeserializer.class)
public Integer getBalance(){
return balance;
}
public void setBalance(Integer value){
this.balance = value;
}
@XmlAttribute(name="street1")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("street1")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@Size(max = 128)
@Pattern(regexp = unipay.validator.PatternName.STREET)
public String getStreet1(){
return street1;
}
public void setStreet1(String value){
this.street1 = value;
}
@XmlAttribute(name="street2")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("street2")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@Size(max = 128)
@Pattern(regexp = unipay.validator.PatternName.STREET)
public String getStreet2(){
return street2;
}
public void setStreet2(String value){
this.street2 = value;
}
@XmlAttribute(name="city")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("city")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@Size(max = 50)
@Pattern(regexp = unipay.validator.PatternName.ALPHANUMERIC_EXTENDED)
public String getCity(){
return city;
}
public void setCity(String value){
this.city = value;
}
@XmlAttribute(name="countryCode")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("countryCode")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@Size(max = 2)
@Pattern(regexp = unipay.validator.PatternName.ALPHA)
public String getCountryCode(){
return countryCode;
}
public void setCountryCode(String value){
this.countryCode = value;
}
@XmlAttribute(name="state")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("state")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@Size(max = 3)
public String getState(){
return state;
}
public void setState(String value){
this.state = value;
}
@XmlAttribute(name="zipCode")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("zipCode")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@Size(max = 10)
public String getZipCode(){
return zipCode;
}
public void setZipCode(String value){
this.zipCode = value;
}
public abstract String getHolderName();
public abstract String getAddress();
}