package api.unicore.component;
import static api.util.ComponentConstants.BOOLEAN_NULL;
import static api.util.ComponentConstants.BOOLEAN_NULL_CODE;
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.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.Reseller;
import api.util.BooleanFormat;
import api.util.DateFormat;
import api.util.IntegerFormat;
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 unicore.model.AuditActionClassifier;
import unicore.model.AuditLog;
import unicore.model.AuditLogDetail;
import unicore.model.ObjectClassifier;
import unipay.audit.AuditLogHandler;
import unipay.audit.Auditable;
import unipay.fields_manual.Fields;
import unipay.validator.EmailListValidator;
import unipay.validator.EnumValidator;
/**
* @author CodeGen [Alexander Fliagin]
* @company UnitedThinkers
* @since 2012/09/02
*/
@JsonSerialize(include=NON_NULL)
@XmlType(propOrder={"id", "code", "name", "createDate", "isActive", "notes", "remittanceEmailRecipientList", "resellerType", "terminalManagersList", "fundsDistributionType", "terminalSupportNumber", "merchantFeeMinAmount", "merchantFeeBasisType", "merchantFeePolicy", "isMultipleReturnsFileSupported", "batchProcessingPolicyType", "portfolioCode", "onboardingProfileId", "tagList", "dataExportPolicy", "commissionsRate", "commissionsStartDate", "commissionsEndDate", "isCommissionsActive"})
@JsonPropertyOrder({"id", "code", "name", "createDate", "isActive", "notes", "remittanceEmailRecipientList", "resellerType", "terminalManagersList", "fundsDistributionType", "terminalSupportNumber", "merchantFeeMinAmount", "merchantFeeBasisType", "merchantFeePolicy", "isMultipleReturnsFileSupported", "batchProcessingPolicyType", "portfolioCode", "onboardingProfileId", "tagList", "dataExportPolicy", "commissionsRate", "commissionsStartDate", "commissionsEndDate", "isCommissionsActive"})
@XmlAccessorType(XmlAccessType.NONE)
@XmlSeeAlso(Reseller.class)
public abstract class AbstractReseller extends UnoComponent<unicore.model.Reseller> implements Auditable<AuditLog, AuditLogDetail, AuditActionClassifier, ObjectClassifier> {
@FormParam("id")
@IntegerFormat
@DefaultValue(INTEGER_NULL_CODE)
protected Integer id;
@FormParam("code")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String code;
@FormParam("name")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String name;
@FormParam("createDate")
@DateFormat
@DefaultValue(DATE_NULL_CODE)
protected Date createDate;
@FormParam("isActive")
@BooleanFormat
protected Boolean isActive;
@FormParam("notes")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String notes;
@FormParam("remittanceEmailRecipientList")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String remittanceEmailRecipientList;
@FormParam("resellerType")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String resellerType;
@FormParam("terminalManagersList")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String terminalManagersList;
@FormParam("fundsDistributionType")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String fundsDistributionType;
@FormParam("terminalSupportNumber")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String terminalSupportNumber;
@FormParam("merchantFeeMinAmount")
@IntegerFormat
@DefaultValue(INTEGER_NULL_CODE)
protected Integer merchantFeeMinAmount;
@FormParam("merchantFeeBasisType")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String merchantFeeBasisType;
@FormParam("merchantFeePolicy")
@StringFormat
protected String merchantFeePolicy;
@FormParam("isMultipleReturnsFileSupported")
@BooleanFormat
@DefaultValue(BOOLEAN_NULL_CODE)
protected Boolean isMultipleReturnsFileSupported;
@FormParam("batchProcessingPolicyType")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String batchProcessingPolicyType;
@FormParam("portfolioCode")
@IntegerFormat
@DefaultValue(INTEGER_NULL_CODE)
protected Integer portfolioCode;
@FormParam("onboardingProfileId")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String onboardingProfileId;
@FormParam("tagList")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String tagList;
@FormParam("dataExportPolicy")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String dataExportPolicy;
@FormParam("commissionsRate")
@IntegerFormat
@DefaultValue(INTEGER_NULL_CODE)
protected Integer commissionsRate;
@FormParam("commissionsStartDate")
@DateFormat
@DefaultValue(DATE_NULL_CODE)
protected Date commissionsStartDate;
@FormParam("commissionsEndDate")
@DateFormat
@DefaultValue(DATE_NULL_CODE)
protected Date commissionsEndDate;
@FormParam("isCommissionsActive")
@BooleanFormat
protected Boolean isCommissionsActive;
public AbstractReseller(){
super();
applyDefaults();
}
public AbstractReseller(unicore.model.Reseller object){
super(object);
}
private void applyDefaults() {
if (!isProxyObject()) {
id = INTEGER_NULL;
code = STRING_NULL;
name = STRING_NULL;
createDate = DATE_NULL;
notes = STRING_NULL;
remittanceEmailRecipientList = STRING_NULL;
resellerType = STRING_NULL;
terminalManagersList = STRING_NULL;
fundsDistributionType = STRING_NULL;
terminalSupportNumber = STRING_NULL;
merchantFeeMinAmount = INTEGER_NULL;
merchantFeeBasisType = STRING_NULL;
isMultipleReturnsFileSupported = BOOLEAN_NULL;
batchProcessingPolicyType = STRING_NULL;
portfolioCode = INTEGER_NULL;
onboardingProfileId = STRING_NULL;
tagList = STRING_NULL;
dataExportPolicy = STRING_NULL;
commissionsRate = INTEGER_NULL;
commissionsStartDate = DATE_NULL;
commissionsEndDate = DATE_NULL;
}
isActive = Boolean.TRUE;
merchantFeePolicy = "000";
isCommissionsActive = true;
}
@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("reseller: {");
sb.append("id: ");
sb.append(id);
sb.append(',').append(' ');
sb.append("code: ");
sb.append(code);
sb.append(',').append(' ');
sb.append("name: ");
sb.append(name);
sb.append(',').append(' ');
sb.append("createDate: ");
sb.append(createDate);
sb.append(',').append(' ');
sb.append("isActive: ");
sb.append(isActive);
sb.append(',').append(' ');
sb.append("notes: ");
sb.append(notes);
sb.append(',').append(' ');
sb.append("remittanceEmailRecipientList: ");
sb.append(remittanceEmailRecipientList);
sb.append(',').append(' ');
sb.append("resellerType: ");
sb.append(resellerType);
sb.append(',').append(' ');
sb.append("terminalManagersList: ");
sb.append(terminalManagersList);
sb.append(',').append(' ');
sb.append("fundsDistributionType: ");
sb.append(fundsDistributionType);
sb.append(',').append(' ');
sb.append("terminalSupportNumber: ");
sb.append(terminalSupportNumber);
sb.append(',').append(' ');
sb.append("merchantFeeMinAmount: ");
sb.append(merchantFeeMinAmount);
sb.append(',').append(' ');
sb.append("merchantFeeBasisType: ");
sb.append(merchantFeeBasisType);
sb.append(',').append(' ');
sb.append("merchantFeePolicy: ");
sb.append(merchantFeePolicy);
sb.append(',').append(' ');
sb.append("isMultipleReturnsFileSupported: ");
sb.append(isMultipleReturnsFileSupported);
sb.append(',').append(' ');
sb.append("batchProcessingPolicyType: ");
sb.append(batchProcessingPolicyType);
sb.append(',').append(' ');
sb.append("portfolioCode: ");
sb.append(portfolioCode);
sb.append(',').append(' ');
sb.append("onboardingProfileId: ");
sb.append(onboardingProfileId);
sb.append(',').append(' ');
sb.append("tagList: ");
sb.append(tagList);
sb.append(',').append(' ');
sb.append("dataExportPolicy: ");
sb.append(dataExportPolicy);
sb.append(',').append(' ');
sb.append("commissionsRate: ");
sb.append(commissionsRate);
sb.append(',').append(' ');
sb.append("commissionsStartDate: ");
sb.append(commissionsStartDate);
sb.append(',').append(' ');
sb.append("commissionsEndDate: ");
sb.append(commissionsEndDate);
sb.append(',').append(' ');
sb.append("isCommissionsActive: ");
sb.append(isCommissionsActive);
sb.append('}');
return sb.toString();
}
@XmlAttribute(name="id")
@XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
@FormParam("id")
@IntegerFormat
@JsonDeserialize(using=api.util.NumberDeserializer.class)
@NotNull
@Min(0)
public Integer getId(){
return id;
}
public void setId(Integer 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)
public String getCode(){
return code;
}
public void setCode(String value){
this.code = value;
}
@XmlAttribute(name="name")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("name")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@NotNull
@Size(max = 100)
@Pattern(regexp = unipay.validator.PatternName.NAME_BUSINESS)
public String getName(){
return name;
}
public void setName(String value){
this.name = 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="isActive")
@FormParam("isActive")
@BooleanFormat
public Boolean getIsActive(){
return isActive;
}
public void setIsActive(Boolean value){
this.isActive = value;
}
@XmlElement(name="notes")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("notes")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@Size(max = 255)
@Pattern(regexp = unipay.validator.PatternName.TEXT)
public String getNotes(){
return notes;
}
public void setNotes(String value){
this.notes = value;
}
@XmlAttribute(name="remittanceEmailRecipientList")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("remittanceEmailRecipientList")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@EmailListValidator
public String getRemittanceEmailRecipientList(){
return remittanceEmailRecipientList;
}
public void setRemittanceEmailRecipientList(String value){
this.remittanceEmailRecipientList = value;
}
@XmlAttribute(name="resellerType")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("resellerType")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@NotNull
@EnumValidator(unicore.model.ResellerClassifier.class)
public String getResellerType(){
return resellerType;
}
public void setResellerType(String value){
this.resellerType = value;
}
@XmlAttribute(name="terminalManagersList")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("terminalManagersList")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
public String getTerminalManagersList(){
return terminalManagersList;
}
public void setTerminalManagersList(String value){
this.terminalManagersList = value;
}
@XmlAttribute(name="fundsDistributionType")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("fundsDistributionType")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@EnumValidator(unicore.model.FundsDistributionClassifier.class)
public String getFundsDistributionType(){
return fundsDistributionType;
}
public void setFundsDistributionType(String value){
this.fundsDistributionType = value;
}
@XmlAttribute(name="terminalSupportNumber")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("terminalSupportNumber")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@Size(min = 10, max = 20)
@Pattern(regexp = unipay.validator.PatternName.NUMERIC)
public String getTerminalSupportNumber(){
return terminalSupportNumber;
}
public void setTerminalSupportNumber(String value){
this.terminalSupportNumber = value;
}
@XmlAttribute(name="merchantFeeMinAmount")
@XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
@FormParam("merchantFeeMinAmount")
@IntegerFormat
@JsonDeserialize(using=api.util.NumberDeserializer.class)
@Min(0)
public Integer getMerchantFeeMinAmount(){
return merchantFeeMinAmount;
}
public void setMerchantFeeMinAmount(Integer value){
this.merchantFeeMinAmount = value;
}
@XmlAttribute(name="merchantFeeBasisType")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("merchantFeeBasisType")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@EnumValidator(unicore.model.MerchantFeeBasisClassifier.class)
public String getMerchantFeeBasisType(){
return merchantFeeBasisType;
}
public void setMerchantFeeBasisType(String value){
this.merchantFeeBasisType = value;
}
@XmlAttribute(name="merchantFeePolicy")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("merchantFeePolicy")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
public String getMerchantFeePolicy(){
return merchantFeePolicy;
}
public void setMerchantFeePolicy(String value){
this.merchantFeePolicy = value;
}
@XmlAttribute(name="isMultipleReturnsFileSupported")
@FormParam("isMultipleReturnsFileSupported")
@BooleanFormat
public Boolean getIsMultipleReturnsFileSupported(){
return isMultipleReturnsFileSupported;
}
public void setIsMultipleReturnsFileSupported(Boolean value){
this.isMultipleReturnsFileSupported = value;
}
@XmlAttribute(name="batchProcessingPolicyType")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("batchProcessingPolicyType")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@EnumValidator(unicore.model.BatchProcessingPolicyClassifier.class)
public String getBatchProcessingPolicyType(){
return batchProcessingPolicyType;
}
public void setBatchProcessingPolicyType(String value){
this.batchProcessingPolicyType = value;
}
@XmlAttribute(name="portfolioCode")
@XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
@FormParam("portfolioCode")
@IntegerFormat
@JsonDeserialize(using=api.util.NumberDeserializer.class)
@Min(0)
public Integer getPortfolioCode(){
return portfolioCode;
}
public void setPortfolioCode(Integer value){
this.portfolioCode = value;
}
@XmlAttribute(name="onboardingProfileId")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("onboardingProfileId")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@Size(max = 12)
public String getOnboardingProfileId(){
return onboardingProfileId;
}
public void setOnboardingProfileId(String value){
this.onboardingProfileId = value;
}
@XmlAttribute(name="tagList")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("tagList")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
public String getTagList(){
return tagList;
}
public void setTagList(String value){
this.tagList = value;
}
@XmlAttribute(name="dataExportPolicy")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("dataExportPolicy")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@Size(min = 10, max = 10)
public String getDataExportPolicy(){
return dataExportPolicy;
}
public void setDataExportPolicy(String value){
this.dataExportPolicy = value;
}
@XmlAttribute(name="commissionsRate")
@XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
@FormParam("commissionsRate")
@IntegerFormat
@JsonDeserialize(using=api.util.NumberDeserializer.class)
public Integer getCommissionsRate(){
return commissionsRate;
}
public void setCommissionsRate(Integer value){
this.commissionsRate = value;
}
@XmlAttribute(name="commissionsStartDate")
@FormParam("commissionsStartDate")
@DateFormat
@JsonDeserialize(using=api.util.DateDeserializer.class)
public Date getCommissionsStartDate(){
return commissionsStartDate;
}
public void setCommissionsStartDate(Date value){
this.commissionsStartDate = value;
}
@XmlAttribute(name="commissionsEndDate")
@FormParam("commissionsEndDate")
@DateFormat
@JsonDeserialize(using=api.util.DateDeserializer.class)
public Date getCommissionsEndDate(){
return commissionsEndDate;
}
public void setCommissionsEndDate(Date value){
this.commissionsEndDate = value;
}
@XmlAttribute(name="isCommissionsActive")
@FormParam("isCommissionsActive")
@BooleanFormat
public Boolean getIsCommissionsActive(){
return isCommissionsActive;
}
public void setIsCommissionsActive(Boolean value){
this.isCommissionsActive = value;
}
@Override
public void audit(AuditLogHandler<AuditLog, AuditLogDetail, AuditActionClassifier, ObjectClassifier> handler) {
Reseller old = (Reseller) getOriginalObject();
handler.audit("id", id, old.getId());
handler.audit("code", code, old.getCode());
handler.audit("name", name, old.getName());
handler.audit("createDate", createDate, old.getCreateDate());
handler.audit("isActive", isActive, old.getIsActive());
handler.audit("notes", notes, old.getNotes());
handler.audit("remittanceEmailRecipientList", remittanceEmailRecipientList, old.getRemittanceEmailRecipientList());
handler.audit("resellerType", STRING_NULL.equals(resellerType) ? null : unicore.model.ResellerClassifier.fromString(Fields.Management.Reseller.ResellerType, resellerType), STRING_NULL.equals(old.getResellerType()) ? null : unicore.model.ResellerClassifier.fromString(Fields.Management.Reseller.ResellerType, old.getResellerType()));
handler.audit("terminalManagersList", terminalManagersList, old.getTerminalManagersList());
handler.audit("fundsDistributionType", STRING_NULL.equals(fundsDistributionType) ? null : unicore.model.FundsDistributionClassifier.fromString(Fields.Management.Reseller.FundsDistributionType, fundsDistributionType), STRING_NULL.equals(old.getFundsDistributionType()) ? null : unicore.model.FundsDistributionClassifier.fromString(Fields.Management.Reseller.FundsDistributionType, old.getFundsDistributionType()));
handler.audit("terminalSupportNumber", terminalSupportNumber, old.getTerminalSupportNumber());
handler.audit("merchantFeeMinAmount", merchantFeeMinAmount, old.getMerchantFeeMinAmount());
handler.audit("merchantFeeBasisType", STRING_NULL.equals(merchantFeeBasisType) ? null : unicore.model.MerchantFeeBasisClassifier.fromString(Fields.Management.Reseller.MerchantFeeBasisType, merchantFeeBasisType), STRING_NULL.equals(old.getMerchantFeeBasisType()) ? null : unicore.model.MerchantFeeBasisClassifier.fromString(Fields.Management.Reseller.MerchantFeeBasisType, old.getMerchantFeeBasisType()));
handler.audit("merchantFeePolicy", merchantFeePolicy, old.getMerchantFeePolicy());
handler.audit("isMultipleReturnsFileSupported", isMultipleReturnsFileSupported, old.getIsMultipleReturnsFileSupported());
handler.audit("batchProcessingPolicyType", STRING_NULL.equals(batchProcessingPolicyType) ? null : unicore.model.BatchProcessingPolicyClassifier.fromString(Fields.Management.Reseller.BatchProcessingPolicyType, batchProcessingPolicyType), STRING_NULL.equals(old.getBatchProcessingPolicyType()) ? null : unicore.model.BatchProcessingPolicyClassifier.fromString(Fields.Management.Reseller.BatchProcessingPolicyType, old.getBatchProcessingPolicyType()));
handler.audit("portfolioCode", portfolioCode, old.getPortfolioCode());
handler.audit("onboardingProfileId", onboardingProfileId, old.getOnboardingProfileId());
handler.audit("tagList", tagList, old.getTagList());
handler.audit("dataExportPolicy", dataExportPolicy, old.getDataExportPolicy());
handler.audit("commissionsRate", commissionsRate, old.getCommissionsRate());
handler.audit("commissionsStartDate", commissionsStartDate, old.getCommissionsStartDate());
handler.audit("commissionsEndDate", commissionsEndDate, old.getCommissionsEndDate());
handler.audit("isCommissionsActive", isCommissionsActive, old.getIsCommissionsActive());
}
public static String objectTypeCode(){
return "reseller";
}
}