All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nz.co.senanque.pizzaorder.Pizza Maven / Gradle / Ivy

Go to download

This is a plugin to Madura Objects. It provides a rules/constraint engine to assist with validation, deriving new values from user inputs (eg total of invoices entered on this customer) an manipulating metadata (eg because the amount is above X we make some field readonly). Note that the Java that is using the monitored objects is quite unaware of the rules layer implemented here. That means you can change rules without having to go back to your Java code, and it also means you don't have to wonder if everything implemented the same rules. Anything using that Java object has the rules (unless you turn them all off).

There is a newer version: 3.3.5
Show newest version
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 
// See http://java.sun.com/xml/jaxb 
// Any modifications to this file will be lost upon recompilation of the source schema. 
// Generated on: 2016.03.24 at 09:48:53 PM NZDT 
//


package nz.co.senanque.pizzaorder;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import nz.co.senanque.validationengine.ValidationObject;
import nz.co.senanque.validationengine.annotations.ChoiceList;
import nz.co.senanque.validationengine.annotations.Description;
import nz.co.senanque.validationengine.annotations.Inactive;
import nz.co.senanque.validationengine.annotations.Label;
import nz.co.senanque.validationengine.annotations.Length;
import nz.co.senanque.validationengine.annotations.Range;
import org.jvnet.jaxb2_commons.lang.Equals;
import org.jvnet.jaxb2_commons.lang.EqualsStrategy;
import org.jvnet.jaxb2_commons.lang.HashCode;
import org.jvnet.jaxb2_commons.lang.HashCodeStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy;
import org.jvnet.jaxb2_commons.lang.ToString;
import org.jvnet.jaxb2_commons.lang.ToStringStrategy;
import org.jvnet.jaxb2_commons.locator.ObjectLocator;
import org.jvnet.jaxb2_commons.locator.util.LocatorUtils;
import org.w3._2001.xmlschema.Adapter2;


/**
 * 

Java class for Pizza complex type. * *

The following schema fragment specifies the expected content contained within this class. * *

 * <complexType name="Pizza">
 *   <complexContent>
 *     <extension base="{http://www.senanque.co.nz/pizzaorder}OrderItem">
 *       <sequence>
 *         <element name="size">
 *           <simpleType>
 *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
 *               <maxLength value="20"/>
 *             </restriction>
 *           </simpleType>
 *         </element>
 *         <element name="base">
 *           <simpleType>
 *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
 *               <maxLength value="20"/>
 *             </restriction>
 *           </simpleType>
 *         </element>
 *         <element name="topping">
 *           <simpleType>
 *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
 *               <maxLength value="20"/>
 *             </restriction>
 *           </simpleType>
 *         </element>
 *         <element name="testing">
 *           <simpleType>
 *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
 *               <maxLength value="20"/>
 *             </restriction>
 *           </simpleType>
 *         </element>
 *         <element name="testDate" type="{http://www.w3.org/2001/XMLSchema}date"/>
 *         <element name="testDouble" type="{http://www.w3.org/2001/XMLSchema}double"/>
 *       </sequence>
 *     </extension>
 *   </complexContent>
 * </complexType>
 * 
* * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Pizza", propOrder = { "size", "base", "topping", "testing", "testDate", "testDouble" }) @Entity(name = "Pizza") @Table(name = "PIZZA") public class Pizza extends OrderItem implements Serializable, ValidationObject, Equals, HashCode, ToString { @XmlElement(required = true) protected String size; @XmlElement(required = true, defaultValue = "GlutenFree") protected String base; @XmlElement(required = true) protected String topping; @XmlElement(required = true) protected String testing; @XmlElement(required = true, type = String.class, defaultValue = "2001-01-15") @XmlJavaTypeAdapter(Adapter2 .class) @XmlSchemaType(name = "date") protected Date testDate; @XmlElement(defaultValue = "10000.50") protected double testDouble; @XmlTransient public final static String SIZE = "size"; @XmlTransient public final static String BASE = "base"; @XmlTransient public final static String TOPPING = "topping"; @XmlTransient public final static String TESTING = "testing"; @XmlTransient public final static String TESTDATE = "testDate"; @XmlTransient public final static String TESTDOUBLE = "testDouble"; /** * Gets the value of the size property. * * @return * possible object is * {@link String } * */ @Label(labelName = "Size") @ChoiceList(name = "Sizes") @Basic @Column(name = "SIZE_", length = 20) @Length(minLength = "0", maxLength = "20") public String getSize() { if (m_validationSession!= null) { m_validationSession.clean(this); } return size; } /** * Sets the value of the size property. * * @param value * allowed object is * {@link String } * */ public void setSize(String value) { getMetadata().removeUnknown("size"); if (m_validationSession!= null) { m_validationSession.set(this, "size", value, size); } this.size = value; if (m_validationSession!= null) { m_validationSession.invokeListeners(this, "size", value, size); } } /** * Gets the value of the base property. * * @return * possible object is * {@link String } * */ @Label(labelName = "Base") @ChoiceList(name = "Bases") @Description(name = "bases.long") @Basic @Column(name = "BASE", length = 20) @Length(minLength = "0", maxLength = "20") public String getBase() { if (m_validationSession!= null) { m_validationSession.clean(this); } return base; } /** * Sets the value of the base property. * * @param value * allowed object is * {@link String } * */ public void setBase(String value) { getMetadata().removeUnknown("base"); if (m_validationSession!= null) { m_validationSession.set(this, "base", value, base); } this.base = value; if (m_validationSession!= null) { m_validationSession.invokeListeners(this, "base", value, base); } } /** * Gets the value of the topping property. * * @return * possible object is * {@link String } * */ @Label(labelName = "Topping") @ChoiceList(name = "Toppings") @Basic @Column(name = "TOPPING", length = 20) @Length(minLength = "0", maxLength = "20") public String getTopping() { if (m_validationSession!= null) { m_validationSession.clean(this); } return topping; } /** * Sets the value of the topping property. * * @param value * allowed object is * {@link String } * */ public void setTopping(String value) { getMetadata().removeUnknown("topping"); if (m_validationSession!= null) { m_validationSession.set(this, "topping", value, topping); } this.topping = value; if (m_validationSession!= null) { m_validationSession.invokeListeners(this, "topping", value, topping); } } /** * Gets the value of the testing property. * * @return * possible object is * {@link String } * */ @Inactive @Basic @Column(name = "TESTING", length = 20) @Length(minLength = "0", maxLength = "20") public String getTesting() { if (m_validationSession!= null) { m_validationSession.clean(this); } return testing; } /** * Sets the value of the testing property. * * @param value * allowed object is * {@link String } * */ public void setTesting(String value) { getMetadata().removeUnknown("testing"); if (m_validationSession!= null) { m_validationSession.set(this, "testing", value, testing); } this.testing = value; if (m_validationSession!= null) { m_validationSession.invokeListeners(this, "testing", value, testing); } } /** * Gets the value of the testDate property. * * @return * possible object is * {@link String } * */ @Label(labelName = "testDate") @Basic @Column(name = "TESTDATE") @Temporal(TemporalType.DATE) public Date getTestDate() { if (m_validationSession!= null) { m_validationSession.clean(this); } return testDate; } /** * Sets the value of the testDate property. * * @param value * allowed object is * {@link String } * */ public void setTestDate(Date value) { getMetadata().removeUnknown("testDate"); if (m_validationSession!= null) { m_validationSession.set(this, "testDate", value, testDate); } this.testDate = value; if (m_validationSession!= null) { m_validationSession.invokeListeners(this, "testDate", value, testDate); } } /** * Gets the value of the testDouble property. * */ @Label(labelName = "testDouble") @Range(maxInclusive = "11000") @Basic @Column(name = "TESTDOUBLE", precision = 20, scale = 10) public double getTestDouble() { if (m_validationSession!= null) { m_validationSession.clean(this); } return testDouble; } /** * Sets the value of the testDouble property. * */ public void setTestDouble(double value) { getMetadata().removeUnknown("testDouble"); if (m_validationSession!= null) { m_validationSession.set(this, "testDouble", value, testDouble); } this.testDouble = value; if (m_validationSession!= null) { m_validationSession.invokeListeners(this, "testDouble", value, testDouble); } } public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) { if (!(object instanceof Pizza)) { return false; } if (this == object) { return true; } if (!super.equals(thisLocator, thatLocator, object, strategy)) { return false; } final Pizza that = ((Pizza) object); { String lhsSize; lhsSize = this.getSize(); String rhsSize; rhsSize = that.getSize(); if (!strategy.equals(LocatorUtils.property(thisLocator, "size", lhsSize), LocatorUtils.property(thatLocator, "size", rhsSize), lhsSize, rhsSize)) { return false; } } { String lhsBase; lhsBase = this.getBase(); String rhsBase; rhsBase = that.getBase(); if (!strategy.equals(LocatorUtils.property(thisLocator, "base", lhsBase), LocatorUtils.property(thatLocator, "base", rhsBase), lhsBase, rhsBase)) { return false; } } { String lhsTopping; lhsTopping = this.getTopping(); String rhsTopping; rhsTopping = that.getTopping(); if (!strategy.equals(LocatorUtils.property(thisLocator, "topping", lhsTopping), LocatorUtils.property(thatLocator, "topping", rhsTopping), lhsTopping, rhsTopping)) { return false; } } { String lhsTesting; lhsTesting = this.getTesting(); String rhsTesting; rhsTesting = that.getTesting(); if (!strategy.equals(LocatorUtils.property(thisLocator, "testing", lhsTesting), LocatorUtils.property(thatLocator, "testing", rhsTesting), lhsTesting, rhsTesting)) { return false; } } { Date lhsTestDate; lhsTestDate = this.getTestDate(); Date rhsTestDate; rhsTestDate = that.getTestDate(); if (!strategy.equals(LocatorUtils.property(thisLocator, "testDate", lhsTestDate), LocatorUtils.property(thatLocator, "testDate", rhsTestDate), lhsTestDate, rhsTestDate)) { return false; } } { double lhsTestDouble; lhsTestDouble = (true?this.getTestDouble(): 0.0D); double rhsTestDouble; rhsTestDouble = (true?that.getTestDouble(): 0.0D); if (!strategy.equals(LocatorUtils.property(thisLocator, "testDouble", lhsTestDouble), LocatorUtils.property(thatLocator, "testDouble", rhsTestDouble), lhsTestDouble, rhsTestDouble)) { return false; } } return true; } public boolean equals(Object object) { final EqualsStrategy strategy = JAXBEqualsStrategy.INSTANCE; return equals(null, null, object, strategy); } public String toString() { final ToStringStrategy strategy = JAXBToStringStrategy.INSTANCE; final StringBuilder buffer = new StringBuilder(); append(null, buffer, strategy); return buffer.toString(); } public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) { strategy.appendStart(locator, this, buffer); appendFields(locator, buffer, strategy); strategy.appendEnd(locator, this, buffer); return buffer; } public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) { super.appendFields(locator, buffer, strategy); { String theSize; theSize = this.getSize(); strategy.appendField(locator, this, "size", buffer, theSize); } { String theBase; theBase = this.getBase(); strategy.appendField(locator, this, "base", buffer, theBase); } { String theTopping; theTopping = this.getTopping(); strategy.appendField(locator, this, "topping", buffer, theTopping); } { String theTesting; theTesting = this.getTesting(); strategy.appendField(locator, this, "testing", buffer, theTesting); } { Date theTestDate; theTestDate = this.getTestDate(); strategy.appendField(locator, this, "testDate", buffer, theTestDate); } { double theTestDouble; theTestDouble = (true?this.getTestDouble(): 0.0D); strategy.appendField(locator, this, "testDouble", buffer, theTestDouble); } return buffer; } public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) { int currentHashCode = super.hashCode(locator, strategy); { String theSize; theSize = this.getSize(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "size", theSize), currentHashCode, theSize); } { String theBase; theBase = this.getBase(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "base", theBase), currentHashCode, theBase); } { String theTopping; theTopping = this.getTopping(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "topping", theTopping), currentHashCode, theTopping); } { String theTesting; theTesting = this.getTesting(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "testing", theTesting), currentHashCode, theTesting); } { Date theTestDate; theTestDate = this.getTestDate(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "testDate", theTestDate), currentHashCode, theTestDate); } { double theTestDouble; theTestDouble = (true?this.getTestDouble(): 0.0D); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "testDouble", theTestDouble), currentHashCode, theTestDouble); } return currentHashCode; } public int hashCode() { final HashCodeStrategy strategy = JAXBHashCodeStrategy.INSTANCE; return this.hashCode(null, strategy); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy