package api.unicore.component;
import static api.util.ComponentConstants.INTEGER_NULL;
import static api.util.ComponentConstants.INTEGER_NULL_CODE;
import static org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion.NON_NULL;
import api.UnoComponent;
import api.unicore.component_manual.MerchantPhases;
import api.util.IntegerFormat;
import iapp.services.ServerObject;
import iapp.util.audit.AuditHelper;
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;
/**
* @author CodeGen [Taya Kuleshova]
* @company UnitedThinkers
* @since 2012/04/05
*/
@JsonSerialize(include=NON_NULL)
@XmlType(propOrder={"phase2Age", "phase3Age", "phase4Age"})
@JsonPropertyOrder({"phase2Age", "phase3Age", "phase4Age"})
@XmlAccessorType(XmlAccessType.NONE)
@XmlSeeAlso(MerchantPhases.class)
public abstract class AbstractMerchantPhases extends UnoComponent<unicore.model.Merchant> {
@FormParam("phase2Age")
@IntegerFormat
@DefaultValue(INTEGER_NULL_CODE)
protected Integer phase2Age;
@FormParam("phase3Age")
@IntegerFormat
@DefaultValue(INTEGER_NULL_CODE)
protected Integer phase3Age;
@FormParam("phase4Age")
@IntegerFormat
@DefaultValue(INTEGER_NULL_CODE)
protected Integer phase4Age;
public AbstractMerchantPhases(){
super();
applyDefaults();
}
public AbstractMerchantPhases(unicore.model.Merchant object){
super(object);
}
private void applyDefaults() {
if (!isProxyObject()) {
phase2Age = INTEGER_NULL;
phase3Age = INTEGER_NULL;
phase4Age = INTEGER_NULL;
}
}
@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("phases: {");
sb.append("phase2Age: ");
sb.append(phase2Age);
sb.append(',').append(' ');
sb.append("phase3Age: ");
sb.append(phase3Age);
sb.append(',').append(' ');
sb.append("phase4Age: ");
sb.append(phase4Age);
sb.append('}');
return sb.toString();
}
@XmlAttribute(name="phase2Age")
@XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
@FormParam("phase2Age")
@IntegerFormat
@JsonDeserialize(using=api.util.NumberDeserializer.class)
public Integer getPhase2Age(){
return phase2Age;
}
public void setPhase2Age(Integer value){
this.phase2Age = value;
}
@XmlAttribute(name="phase3Age")
@XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
@FormParam("phase3Age")
@IntegerFormat
@JsonDeserialize(using=api.util.NumberDeserializer.class)
public Integer getPhase3Age(){
return phase3Age;
}
public void setPhase3Age(Integer value){
this.phase3Age = value;
}
@XmlAttribute(name="phase4Age")
@XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
@FormParam("phase4Age")
@IntegerFormat
@JsonDeserialize(using=api.util.NumberDeserializer.class)
public Integer getPhase4Age(){
return phase4Age;
}
public void setPhase4Age(Integer value){
this.phase4Age = value;
}
public void audit(AuditHelper helper, ServerObject object) {
unicore.model.Merchant s_object = (unicore.model.Merchant) object;
helper.audit("phase2Age", phase2Age, s_object.getPhase2Age());
helper.audit("phase3Age", phase3Age, s_object.getPhase3Age());
helper.audit("phase4Age", phase4Age, s_object.getPhase4Age());
}
public static String objectTypeCode(){
return "phases";
}
}