001/*
002 * Copyright (C) 2014 konik.io
003 *
004 * This file is part of Konik library.
005 *
006 * Konik library is free software: you can redistribute it and/or modify
007 * it under the terms of the GNU Affero General Public License as published by
008 * the Free Software Foundation, either version 3 of the License, or
009 * (at your option) any later version.
010 *
011 * Konik library is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014 * GNU Affero General Public License for more details.
015 *
016 * You should have received a copy of the GNU Affero General Public License
017 * along with Konik library.  If not, see <http://www.gnu.org/licenses/>.
018 */
019package io.konik.zugferd.entity;
020
021import io.konik.zugferd.profile.Profile;
022
023import javax.validation.Valid;
024import javax.xml.bind.annotation.XmlAccessType;
025import javax.xml.bind.annotation.XmlAccessorType;
026import javax.xml.bind.annotation.XmlElement;
027import javax.xml.bind.annotation.XmlType;
028
029/**
030 * = The Exchanged Document Context
031 * 
032 * Grouping of the properties of the message.
033 */
034@XmlAccessorType(XmlAccessType.FIELD)
035@XmlType(name = "ExchangedDocumentContextType", propOrder = { "test", "profile" })
036public class Context {
037
038   @XmlElement(name = "TestIndicator")
039   private boolean test;
040
041   @Valid
042   @XmlElement(name = "GuidelineSpecifiedDocumentContextParameter")
043   private Profile profile;
044
045   /**
046    * Instantiates a new context.
047    */
048   public Context() {
049   }
050
051   /**
052    * Instantiates a new context with a profile
053    * 
054    * @param profile the profile
055    */
056   public Context(Profile profile) {
057      this.profile = profile;
058   }
059
060   /**
061    * The test indicator flags the invoice such that it should not be processed in the target system.
062    * 
063    * The sales tax liability does not arise. This flag is used in particular in the introductory period of new business
064    * relationships.
065    * 
066    * Profile:: BASIC
067    * 
068    * 
069    * @return true if this invoice is for testing purpose only
070    */
071   public boolean isTest() {
072      return test;
073   }
074
075   /**
076    * The test indicator flags the invoice such that it should not be processed in the target system.
077    * 
078    * The sales tax liability does not arise. This flag is used in particular in the introductory period of new business
079    * relationships.
080    * 
081    * Profile:: BASIC
082    * 
083    * @param test the new indicates if this invoice is for testing purpose only
084    * @return 
085    */
086   public Context setTest(boolean test) {
087      this.test = test;
088      return this;
089   }
090
091   /**
092    * Gets the guideline or profile of the invoice
093    * 
094    * Profile:: BASIC
095    * 
096    * Example:: {@code urn:ferd:invoice:1.0:comfort}
097    * 
098    * @return the profile
099    */
100   public Profile getProfile() {
101      return this.profile;
102   }
103
104   /**
105    * Sets the guideline or profile of the invoice
106    * 
107    * Profile:: BASIC
108    * 
109    * Example:: {@code urn:ferd:invoice:1.0:comfort}
110    *
111    * @param profile the new profile
112    * @return the context
113    */
114   public Context setProfile(Profile profile) {
115      this.profile = profile;
116      return this;
117   }
118}