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; 019 020import java.util.ArrayList; 021import java.util.List; 022 023import javax.xml.bind.annotation.XmlAccessType; 024import javax.xml.bind.annotation.XmlAccessorType; 025import javax.xml.bind.annotation.XmlElement; 026import javax.xml.bind.annotation.XmlType; 027 028 029/** 030 * = The Item Line Document 031 * 032 * For Item position and notes 033 */ 034@XmlAccessorType(XmlAccessType.FIELD) 035@XmlType(name = "DocumentLineDocumentType", propOrder = { "position", "notes" }) 036public class DocumentLine { 037 038 @XmlElement(name = "LineID") 039 private int position; 040 041 @XmlElement(name = "IncludedNote") 042 private List<Note> notes; 043 044 /** 045 * Instantiates a new document line. 046 */ 047 public DocumentLine() { 048 } 049 050 /** 051 * Instantiates a new document line. 052 * 053 * @param position the position number 054 */ 055 public DocumentLine(int position) { 056 super(); 057 this.position = position; 058 } 059 060 /** 061 * Instantiates a new document line. 062 * 063 * @param position the position 064 * @param notes the notes 065 */ 066 public DocumentLine(int position, List<Note> notes) { 067 this(position); 068 this.notes = notes; 069 } 070 071 /** 072 * Gets the line position. 073 * 074 * Profile:: COMFORT 075 * 076 * @return the position number 077 */ 078 public int getPosition() { 079 return position; 080 } 081 082 /** 083 * Sets the line position 084 * 085 * Profile:: COMFORT. 086 * 087 * @param position the position 088 * @return the document line 089 */ 090 public DocumentLine setPosition(int position) { 091 this.position = position; 092 return this; 093 } 094 095 /** 096 * Gets the included note. 097 * 098 * Profile:: 099 * - Note.content COMFORT 100 * - Note.subjectCode EXTENDED 101 * 102 * @return the included note 103 */ 104 public List<Note> getNotes() { 105 if (notes == null) { 106 notes = new ArrayList<Note>(); 107 } 108 return this.notes; 109 } 110 111 /** 112 * Adds the note. 113 * 114 * Profile:: 115 * - Note.content COMFORT 116 * - Note.subjectCode EXTENDED 117 * 118 * @param note the note 119 * @return the document line document 120 */ 121 public DocumentLine addNote(Note note) { 122 getNotes().add(note); 123 return this; 124 } 125 126}