001/* Copyright (C) 2014 konik.io
002 *
003 * This file is part of the Konik library.
004 *
005 * The Konik library is free software: you can redistribute it and/or modify
006 * it under the terms of the GNU Affero General Public License as
007 * published by the Free Software Foundation, either version 3 of the
008 * License, or (at your option) any later version.
009 *
010 * The Konik library is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
013 * GNU Affero General Public License for more details.
014 *
015 * You should have received a copy of the GNU Affero General Public License
016 * along with the Konik library. If not, see <http://www.gnu.org/licenses/>.
017 */
018package io.konik.zugferd.entity.trade.item;
019
020import io.konik.validator.annotation.Comfort;
021import io.konik.zugferd.entity.PositionDocument;
022import io.konik.zugferd.entity.Product;
023
024import javax.validation.Valid;
025import javax.xml.bind.annotation.XmlAccessType;
026import javax.xml.bind.annotation.XmlAccessorType;
027import javax.xml.bind.annotation.XmlElement;
028import javax.xml.bind.annotation.XmlType;
029import java.io.Serializable;
030
031/**
032 * = The Trade Item.
033 * 
034 */
035@XmlAccessorType(XmlAccessType.FIELD)
036@XmlType(name = "SupplyChainTradeLineItemType", propOrder = { "position", "agreement", "delivery", "settlement",
037      "product" })
038public class Item implements Serializable {
039
040   @XmlElement(name = "AssociatedDocumentLineDocument")
041   private PositionDocument position;
042
043   @XmlElement(name = "SpecifiedSupplyChainTradeAgreement")
044   private SpecifiedAgreement agreement;
045
046   @XmlElement(name = "SpecifiedSupplyChainTradeDelivery")
047   private SpecifiedDelivery delivery;
048
049   @XmlElement(name = "SpecifiedSupplyChainTradeSettlement")
050   private SpecifiedSettlement settlement;
051
052   @XmlElement(name = "SpecifiedTradeProduct")
053   private Product product;
054
055   /**
056    * Gets the item Line number.
057    *
058    * @return the position
059    */
060   @Comfort
061   @Valid
062   //@NotNull(groups = Comfort.class)
063   public PositionDocument getPosition() {
064      return position;
065   }
066
067   /**
068    * Sets the new item Line number.
069    *
070    * @param newPosition the new Line number.
071    * @return the trade item
072    */
073   public Item setPosition(PositionDocument newPosition) {
074      this.position = newPosition;
075      return this;
076   }
077
078   /**
079    * Gets the item level agreement.
080    *
081    * @return the item level agreement
082    */
083   @Valid
084   public SpecifiedAgreement getAgreement() {
085      return agreement;
086   }
087
088   /**
089    * Sets the item level agreement.
090    *
091    * @param newItemAgreement the new the item level agreement.
092    * @return the trade item
093    */
094   public Item setAgreement(SpecifiedAgreement newItemAgreement) {
095      this.agreement = newItemAgreement;
096      return this;
097   }
098
099   /**
100    * Gets item level delivery.
101    *
102    * @return the item level delivery
103    */
104   @Valid
105   public SpecifiedDelivery getDelivery() {
106      return delivery;
107   }
108
109   /**
110    * Sets item level delivery.
111    *
112    * @param newItemDelivery the new item level delivery
113    * @return the trade item
114    */
115   public Item setDelivery(SpecifiedDelivery newItemDelivery) {
116      this.delivery = newItemDelivery;
117      return this;
118   }
119
120   /**
121    * Gets the item level settlement.
122    *
123    * @return the item level settlement
124    */
125   @Valid
126   public SpecifiedSettlement getSettlement() {
127      return settlement;
128   }
129
130   /**
131    * Sets the item level settlement.
132    *
133    * @param newItemSettlement the new item level settlement
134    * @return the trade item
135    */
136   public Item setSettlement(SpecifiedSettlement newItemSettlement) {
137      this.settlement = newItemSettlement;
138      return this;
139   }
140
141   /**
142    * Gets the trade product.
143    *
144    * @return the product
145    */
146   @Valid
147   public Product getProduct() {
148      return product;
149   }
150
151   /**
152    * Sets the trade product.
153    *
154    * @param newProduct the product
155    * @return the trade item
156    */
157   public Item setProduct(Product newProduct) {
158      this.product = newProduct;
159      return this;
160   }
161}