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

org.mustangproject.IncludedNote Maven / Gradle / Ivy

Go to download

FOSS Java library to read, write and validate european electronic invoices and orders in the UN/CEFACT Cross Industry Invoice based formats Factur-X/ZUGFeRD, XRechnung and Order-X in your invoice PDFs.

There is a newer version: 2.15.2
Show newest version
package org.mustangproject;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;

/**
 * A grouping of business terms to indicate accounting-relevant free texts including a qualification of these.
 */
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class IncludedNote {
	private String content;

	private SubjectCode subjectCode;

	private static final String INCLUDE_START = "";
	private static final String INCLUDE_END = "";
	private static final String CONTENT_START = "";
	private static final String CONTENT_END = "";
	private static final String SUBJECT_CODE_START = "";
	private static final String SUBJECT_CODE_END = "";

	public IncludedNote(String content, SubjectCode subjectCode) {
		this.content = content;
		this.subjectCode = subjectCode;
	}

	/**
	 * bean constructor
	 */
	public IncludedNote() {

	}

	public static IncludedNote generalNote(String content) {
		return new IncludedNote(content, SubjectCode.AAI);
	}

	public static IncludedNote regulatoryNote(String content) {
		return new IncludedNote(content, SubjectCode.REG);
	}

	public static IncludedNote legalNote(String content) {
		return new IncludedNote(content, SubjectCode.ABL);
	}

	public static IncludedNote customsNote(String content) {
		return new IncludedNote(content, SubjectCode.CUS);
	}

	public static IncludedNote sellerNote(String content) {
		return new IncludedNote(content, SubjectCode.SUR);
	}

	public static IncludedNote taxNote(String content) {
		return new IncludedNote(content, SubjectCode.TXD);
	}

	public static IncludedNote introductionNote(String content) {
		return new IncludedNote(content, SubjectCode.ACY);
	}

	public static IncludedNote discountBonusNote(String content) {
		return new IncludedNote(content, SubjectCode.AAK);
	}

	public static IncludedNote unspecifiedNote(String content) {
		return new IncludedNote(content, null);
	}

	public String getContent() {
		return content;
	}

	public SubjectCode getSubjectCode() {
		return subjectCode;
	}


	public IncludedNote setSubjectCode(SubjectCode subjectCode) {
		this.subjectCode = subjectCode;
		return this;
	}

	public IncludedNote setContent(String content) {
		this.content = content;
		return this;
	}


	public String toCiiXml() {
		String result = INCLUDE_START + CONTENT_START +
			XMLTools.encodeXML(getContent()) + CONTENT_END;
		if (getSubjectCode() != null) {
			result += SUBJECT_CODE_START + getSubjectCode() + SUBJECT_CODE_END;
		}
		return result + INCLUDE_END;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy