package api.unicore.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.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.ResellerScheduledAdjustment;
import api.util.DateFormat;
import api.util.IntegerFormat;
import api.util.StringFormat;
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.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.EnumValidator;
/**
* @author CodeGen [Artem Bogorodychenko]
* @company UnitedThinkers
* @since 2023/02/06
*/
@JsonSerialize(include=NON_NULL)
@XmlType(propOrder={"adjustmentCode", "createDate", "effectiveDate", "processedDate", "status", "type", "description", "length", "amount"})
@JsonPropertyOrder({"adjustmentCode", "createDate", "effectiveDate", "processedDate", "status", "type", "description", "length", "amount"})
@XmlAccessorType(XmlAccessType.NONE)
@XmlSeeAlso(ResellerScheduledAdjustment.class)
public abstract class AbstractResellerScheduledAdjustment extends UnoComponent<unicore.model.ResellerScheduledAdjustment> {
@FormParam("adjustmentCode")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String adjustmentCode;
@FormParam("createDate")
@DateFormat
@DefaultValue(DATE_NULL_CODE)
protected Date createDate;
@FormParam("effectiveDate")
@DateFormat
@DefaultValue(DATE_NULL_CODE)
protected Date effectiveDate;
@FormParam("processedDate")
@DateFormat
@DefaultValue(DATE_NULL_CODE)
protected Date processedDate;
@FormParam("status")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String status;
@FormParam("type")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String type;
@FormParam("description")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String description;
@FormParam("length")
@IntegerFormat
protected Integer length;
@FormParam("amount")
@IntegerFormat
@DefaultValue(INTEGER_NULL_CODE)
protected Integer amount;
public AbstractResellerScheduledAdjustment(){
super();
applyDefaults();
}
public AbstractResellerScheduledAdjustment(unicore.model.ResellerScheduledAdjustment object){
super(object);
}
private void applyDefaults() {
if (!isProxyObject()) {
adjustmentCode = STRING_NULL;
createDate = DATE_NULL;
effectiveDate = DATE_NULL;
processedDate = DATE_NULL;
status = STRING_NULL;
type = STRING_NULL;
description = STRING_NULL;
amount = INTEGER_NULL;
}
length = -1;
}
@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("resellerScheduledAdjustment: {");
sb.append("adjustmentCode: ");
sb.append(adjustmentCode);
sb.append(',').append(' ');
sb.append("createDate: ");
sb.append(createDate);
sb.append(',').append(' ');
sb.append("effectiveDate: ");
sb.append(effectiveDate);
sb.append(',').append(' ');
sb.append("processedDate: ");
sb.append(processedDate);
sb.append(',').append(' ');
sb.append("status: ");
sb.append(status);
sb.append(',').append(' ');
sb.append("type: ");
sb.append(type);
sb.append(',').append(' ');
sb.append("description: ");
sb.append(description);
sb.append(',').append(' ');
sb.append("length: ");
sb.append(length);
sb.append(',').append(' ');
sb.append("amount: ");
sb.append(amount);
sb.append('}');
return sb.toString();
}
@XmlAttribute(name="adjustmentCode")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("adjustmentCode")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@Size(max = 60)
@Pattern(regexp = unipay.validator.PatternName.ALPHANUMERIC)
public String getAdjustmentCode(){
return adjustmentCode;
}
public void setAdjustmentCode(String value){
this.adjustmentCode = value;
}
@XmlAttribute(name="createDate")
@FormParam("createDate")
@DateFormat
@JsonDeserialize(using=api.util.DateDeserializer.class)
public Date getCreateDate(){
return createDate;
}
@XmlAttribute(name="effectiveDate")
@FormParam("effectiveDate")
@DateFormat
@JsonDeserialize(using=api.util.DateDeserializer.class)
public Date getEffectiveDate(){
return effectiveDate;
}
public void setEffectiveDate(Date value){
this.effectiveDate = value;
}
@XmlAttribute(name="processedDate")
@FormParam("processedDate")
@DateFormat
@JsonDeserialize(using=api.util.DateDeserializer.class)
public Date getProcessedDate(){
return processedDate;
}
@XmlAttribute(name="status")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("status")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@EnumValidator(unicore.model.MerchantGroupScheduledAdjustmentStatusClassifier.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)
@NotNull
@EnumValidator(unicore.model.ResellerScheduledAdjustmentTypeClassifier.class)
public String getType(){
return type;
}
public void setType(String value){
this.type = value;
}
@XmlAttribute(name="description")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("description")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@Size(max = 65)
@Pattern(regexp = unipay.validator.PatternName.TEXT)
public String getDescription(){
return description;
}
public void setDescription(String value){
this.description = 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="amount")
@XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
@FormParam("amount")
@IntegerFormat
@JsonDeserialize(using=api.util.NumberDeserializer.class)
@NotNull
@Min(1)
public Integer getAmount(){
return amount;
}
public void setAmount(Integer value){
this.amount = value;
}
public void audit(AuditHelper helper, ServerObject object) {
unicore.model.ResellerScheduledAdjustment s_object = (unicore.model.ResellerScheduledAdjustment) object;
helper.audit("adjustmentCode", adjustmentCode, s_object.getAdjustmentCode());
helper.audit("createDate", createDate, s_object.getCreateDate());
helper.audit("effectiveDate", effectiveDate, s_object.getEffectiveDate());
helper.audit("processedDate", processedDate, s_object.getProcessedDate());
helper.audit("status", STRING_NULL.equals(status) ? null : unicore.model.MerchantGroupScheduledAdjustmentStatusClassifier.fromString(Fields.Management.ResellerScheduledAdjustment.Status, status), s_object.getStatusCl() == null ? null : s_object.getStatusCl().getValue());
helper.audit("type", STRING_NULL.equals(type) ? null : unicore.model.ResellerScheduledAdjustmentTypeClassifier.fromString(Fields.Management.ResellerScheduledAdjustment.Type, type), s_object.getAdjustmentCl() == null ? null : s_object.getAdjustmentCl().getValue());
helper.audit("description", description, s_object.getDescription());
helper.audit("length", length, s_object.getLength());
helper.audit("amount", amount, s_object.getAmount());
}
}