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 static unipay.util.SecurityUtils.PASS;
import api.UnoComponent;
import api.unicore.VirtualFields;
import api.unicore.component_manual.Merchant;
import api.util.BooleanFormat;
import api.util.DateFormat;
import api.util.IntegerFormat;
import api.util.StringFormat;
import com.fortify.annotations.FortifyNotPassword;
import iapp.services.ServerObject;
import iapp.util.audit.AuditHelper;
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.validator.CustomValidator;
/**
* @author CodeGen [Alexey Zub]
* @company UnitedThinkers
* @since 2012/04/02
*/
@JsonSerialize(include=NON_NULL)
@XmlType(propOrder={"id", "code", "name", "createDate", "isActive", PASS, "timeZone", "notes", "merchantType", "portfolioCode", "deactivateDate", "multipleAccounts", "multipleTaxIds", "multipleDescriptors", "multipleDepositAccounts", "multipleRecurringFees", "feeProcessorCode", "directoryCode", "countryCode", "tagList", "resellerCode", "remitterCode"})
@JsonPropertyOrder({"id", "code", "name", "createDate", "isActive", PASS, "timeZone", "notes", "merchantType", "portfolioCode", "deactivateDate", "multipleAccounts", "multipleTaxIds", "multipleDescriptors", "multipleDepositAccounts", "multipleRecurringFees", "feeProcessorCode", "directoryCode", "countryCode", "tagList", "resellerCode", "remitterCode"})
@XmlAccessorType(XmlAccessType.NONE)
@XmlSeeAlso(Merchant.class)
@CustomValidator
public abstract class AbstractMerchant extends UnoComponent<unicore.model.MerchantObject> {
@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(PASS)
@StringFormat
@DefaultValue(STRING_NULL_CODE)
@FortifyNotPassword
protected String password;
@FormParam("timeZone")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String timeZone;
@FormParam("notes")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String notes;
@FormParam("merchantType")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String merchantType;
@FormParam("portfolioCode")
@IntegerFormat
@DefaultValue(INTEGER_NULL_CODE)
protected Integer portfolioCode;
@FormParam("deactivateDate")
@DateFormat
@DefaultValue(DATE_NULL_CODE)
protected Date deactivateDate;
@FormParam("multipleAccounts")
@BooleanFormat
@DefaultValue(BOOLEAN_NULL_CODE)
protected Boolean multipleAccounts;
@FormParam("multipleTaxIds")
@BooleanFormat
@DefaultValue(BOOLEAN_NULL_CODE)
protected Boolean multipleTaxIds;
@FormParam("multipleDescriptors")
@BooleanFormat
@DefaultValue(BOOLEAN_NULL_CODE)
protected Boolean multipleDescriptors;
@FormParam("multipleDepositAccounts")
@BooleanFormat
@DefaultValue(BOOLEAN_NULL_CODE)
protected Boolean multipleDepositAccounts;
@FormParam("multipleRecurringFees")
@BooleanFormat
@DefaultValue(BOOLEAN_NULL_CODE)
protected Boolean multipleRecurringFees;
@FormParam("feeProcessorCode")
@IntegerFormat
@DefaultValue(INTEGER_NULL_CODE)
protected Integer feeProcessorCode;
@FormParam("directoryCode")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String directoryCode;
@FormParam("countryCode")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String countryCode;
@FormParam("tagList")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String tagList;
@FormParam("resellerCode")
@IntegerFormat
@DefaultValue(INTEGER_NULL_CODE)
protected Integer resellerCode;
@FormParam("remitterCode")
@IntegerFormat
@DefaultValue(INTEGER_NULL_CODE)
protected Integer remitterCode;
public AbstractMerchant(){
super();
applyDefaults();
}
public AbstractMerchant(unicore.model.MerchantObject object){
super(object);
}
private void applyDefaults() {
if (!isProxyObject()) {
id = INTEGER_NULL;
code = STRING_NULL;
name = STRING_NULL;
createDate = DATE_NULL;
password = STRING_NULL;
timeZone = STRING_NULL;
notes = STRING_NULL;
merchantType = STRING_NULL;
portfolioCode = INTEGER_NULL;
deactivateDate = DATE_NULL;
multipleAccounts = BOOLEAN_NULL;
multipleTaxIds = BOOLEAN_NULL;
multipleDescriptors = BOOLEAN_NULL;
multipleDepositAccounts = BOOLEAN_NULL;
multipleRecurringFees = BOOLEAN_NULL;
feeProcessorCode = INTEGER_NULL;
directoryCode = STRING_NULL;
countryCode = STRING_NULL;
tagList = STRING_NULL;
resellerCode = INTEGER_NULL;
remitterCode = INTEGER_NULL;
}
isActive = 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("merchant: {");
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("password: ");
sb.append(password);
sb.append(',').append(' ');
sb.append("timeZone: ");
sb.append(timeZone);
sb.append(',').append(' ');
sb.append("notes: ");
sb.append(notes);
sb.append(',').append(' ');
sb.append("merchantType: ");
sb.append(merchantType);
sb.append(',').append(' ');
sb.append("portfolioCode: ");
sb.append(portfolioCode);
sb.append(',').append(' ');
sb.append("deactivateDate: ");
sb.append(deactivateDate);
sb.append(',').append(' ');
sb.append("multipleAccounts: ");
sb.append(multipleAccounts);
sb.append(',').append(' ');
sb.append("multipleTaxIds: ");
sb.append(multipleTaxIds);
sb.append(',').append(' ');
sb.append("multipleDescriptors: ");
sb.append(multipleDescriptors);
sb.append(',').append(' ');
sb.append("multipleDepositAccounts: ");
sb.append(multipleDepositAccounts);
sb.append(',').append(' ');
sb.append("multipleRecurringFees: ");
sb.append(multipleRecurringFees);
sb.append(',').append(' ');
sb.append("feeProcessorCode: ");
sb.append(feeProcessorCode);
sb.append(',').append(' ');
sb.append("directoryCode: ");
sb.append(directoryCode);
sb.append(',').append(' ');
sb.append("countryCode: ");
sb.append(countryCode);
sb.append(',').append(' ');
sb.append("tagList: ");
sb.append(tagList);
sb.append(',').append(' ');
sb.append("resellerCode: ");
sb.append(resellerCode);
sb.append(',').append(' ');
sb.append("remitterCode: ");
sb.append(remitterCode);
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
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)
@Size(max = 60)
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;
}
@XmlAttribute(name="isActive")
@FormParam("isActive")
@BooleanFormat
public Boolean getIsActive(){
return isActive;
}
public void setIsActive(Boolean value){
this.isActive = value;
}
@XmlAttribute(name=PASS)
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam(PASS)
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@Size(min = 8)
@Pattern(regexp = unipay.validator.PatternName.PASSWORD)
public String getPassword(){
return password;
}
public void setPassword(String value){
this.password = value;
}
@XmlAttribute(name="timeZone")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("timeZone")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
public String getTimeZone(){
return timeZone;
}
public void setTimeZone(String value){
this.timeZone = value;
}
@XmlElement(name="notes")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("notes")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
public String getNotes(){
return notes;
}
public void setNotes(String value){
this.notes = value;
}
@XmlAttribute(name="merchantType")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("merchantType")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
public String getMerchantType(){
return merchantType;
}
public void setMerchantType(String value){
this.merchantType = 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="deactivateDate")
@FormParam("deactivateDate")
@DateFormat
@JsonDeserialize(using=api.util.DateDeserializer.class)
public Date getDeactivateDate(){
return deactivateDate;
}
public void setDeactivateDate(Date value){
this.deactivateDate = value;
}
@XmlAttribute(name="multipleAccounts")
@FormParam("multipleAccounts")
@BooleanFormat
@NotNull
public Boolean getMultipleAccounts(){
return multipleAccounts;
}
public void setMultipleAccounts(Boolean value){
this.multipleAccounts = value;
}
@XmlAttribute(name="multipleTaxIds")
@FormParam("multipleTaxIds")
@BooleanFormat
@NotNull
public Boolean getMultipleTaxIds(){
return multipleTaxIds;
}
public void setMultipleTaxIds(Boolean value){
this.multipleTaxIds = value;
}
@XmlAttribute(name="multipleDescriptors")
@FormParam("multipleDescriptors")
@BooleanFormat
@NotNull
public Boolean getMultipleDescriptors(){
return multipleDescriptors;
}
public void setMultipleDescriptors(Boolean value){
this.multipleDescriptors = value;
}
@XmlAttribute(name="multipleDepositAccounts")
@FormParam("multipleDepositAccounts")
@BooleanFormat
@NotNull
public Boolean getMultipleDepositAccounts(){
return multipleDepositAccounts;
}
public void setMultipleDepositAccounts(Boolean value){
this.multipleDepositAccounts = value;
}
@XmlAttribute(name="multipleRecurringFees")
@FormParam("multipleRecurringFees")
@BooleanFormat
@NotNull
public Boolean getMultipleRecurringFees(){
return multipleRecurringFees;
}
public void setMultipleRecurringFees(Boolean value){
this.multipleRecurringFees = value;
}
@XmlAttribute(name="feeProcessorCode")
@XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
@FormParam("feeProcessorCode")
@IntegerFormat
@JsonDeserialize(using=api.util.NumberDeserializer.class)
@Min(0)
public Integer getFeeProcessorCode(){
return feeProcessorCode;
}
public void setFeeProcessorCode(Integer value){
this.feeProcessorCode = value;
}
@XmlAttribute(name="directoryCode")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("directoryCode")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
public String getDirectoryCode(){
return directoryCode;
}
public void setDirectoryCode(String value){
this.directoryCode = value;
}
@XmlAttribute(name="countryCode")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("countryCode")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@NotNull
@Size(min = 2, max = 2)
public String getCountryCode(){
return countryCode;
}
public void setCountryCode(String value){
this.countryCode = 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="resellerCode")
@XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
@FormParam("resellerCode")
@IntegerFormat
@JsonDeserialize(using=api.util.NumberDeserializer.class)
@Min(0)
public Integer getResellerCode(){
return resellerCode;
}
public void setResellerCode(Integer value){
this.resellerCode = value;
}
@XmlAttribute(name="remitterCode")
@XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
@FormParam("remitterCode")
@IntegerFormat
@JsonDeserialize(using=api.util.NumberDeserializer.class)
public Integer getRemitterCode(){
return remitterCode;
}
public void setRemitterCode(Integer value){
this.remitterCode = value;
}
public void audit(AuditHelper helper, ServerObject object) {
unicore.model.MerchantObject s_object = (unicore.model.MerchantObject) object;
helper.audit("id", id, s_object.getCode());
helper.audit("code", code, s_object.getRefCode());
helper.audit("name", name, s_object.getName());
helper.audit("createDate", createDate, s_object.getCreateDate());
helper.audit("isActive", isActive, s_object.getIsActive());
helper.audit("timeZone", timeZone, s_object.getTimeZoneCode());
helper.audit("notes", notes, s_object.getNotes());
helper.audit("merchantType", merchantType, VirtualFields.MerchantType.get(s_object));
helper.audit("portfolioCode", portfolioCode, VirtualFields.PortfolioCode.get(s_object));
helper.audit("deactivateDate", deactivateDate, s_object.getDeactivateDate());
helper.audit("multipleAccounts", multipleAccounts, VirtualFields.MultipleAccounts.get(s_object));
helper.audit("multipleTaxIds", multipleTaxIds, VirtualFields.MultipleTaxIds.get(s_object));
helper.audit("multipleDescriptors", multipleDescriptors, VirtualFields.MultipleDescriptors.get(s_object));
helper.audit("multipleDepositAccounts", multipleDepositAccounts, VirtualFields.MultipleDepositAccounts.get(s_object));
helper.audit("multipleRecurringFees", multipleRecurringFees, VirtualFields.MultipleRecurringFees.get(s_object));
helper.audit("feeProcessorCode", feeProcessorCode, VirtualFields.FeeProcessorCode.get(s_object));
helper.audit("directoryCode", directoryCode, s_object.getDirectoryCode());
helper.audit("countryCode", countryCode, s_object.getCountryCode());
helper.audit("tagList", tagList, VirtualFields.TagList.get(s_object));
helper.audit("resellerCode", resellerCode, VirtualFields.ResellerCode.get(s_object));
helper.audit("remitterCode", remitterCode, VirtualFields.RemitterCode.get(s_object));
}
public static String objectTypeCode(){
return "merchant";
}
}