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

com.lionbridge.content.sdk.models.RejectTranslationOutput Maven / Gradle / Ivy

There is a newer version: 2.2.0
Show newest version
package com.lionbridge.content.sdk.models;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import com.lionbridge.content.sdk.definitions.FileStatus;
import com.lionbridge.content.sdk.validations.RejectTranslationOutputConverter;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.StringWriter;

@JsonDeserialize(converter=RejectTranslationOutputConverter.class)
@JacksonXmlRootElement(localName="Files")
@XmlRootElement
public class RejectTranslationOutput {
	//
	//237655
	//test_project_quote_20160413095442_20160413095442_579694.zip
	//Rejected
	//
	//  en-us
	//
	//
	//  es-es
	//
	//
	//  5000
	//  Not good enough
	//
	//
	//  32524
	//  https://developer-sandbox.liondemand.com/api/projects/32524
	//  TestProject.20160413095442
	//  Cancelled
	//  146
	//  0.85
	//  USD
	//  2016-04-13T13:54:22Z
	//  2016-04-15T10:54:00Z
	//  2016-04-13T14:00:25Z
	//  en-us
	//  es-es
	//
	//
	@JacksonXmlProperty(localName="AssetID")
	private int assetId;
	@JacksonXmlProperty(localName="Status")
	private String fileStatusTemp;
	private FileStatus fileStatus;
	@JacksonXmlProperty(localName="Name")
	private String name;
	@JacksonXmlProperty(localName="SourceLanguage")
	private SourceLanguage sourceLanguage;
	@JacksonXmlProperty(localName="TargetLanguage")
	private TargetLanguage targetLanguage;
	@JacksonXmlProperty(localName="Rejection")
	private RejectFile rejection;
	@JacksonXmlProperty(localName="Project")
	private Project project;

	/**
	 * Ensure the file status enum value gets set from the input string
	 */
	public void runValidations() {
		if(null != fileStatusTemp) {
			fileStatusTemp = fileStatusTemp.replaceAll("\\s+","");

			setFileStatus(FileStatus.valueOf(fileStatusTemp));
		}
	}

	public String toXmlStringSimple() {
	    String xmlString = "";
	    try {
	        JAXBContext context = JAXBContext.newInstance(this.getClass());
	        Marshaller m = context.createMarshaller();

	        m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); // To format XML

	        StringWriter sw = new StringWriter();
	        m.marshal(this, sw);
	        xmlString = sw.toString();

	    } catch (JAXBException e) {
	        e.printStackTrace();
	    }

	    return xmlString;
	}

	public final int getAssetId() {
		return this.assetId;
	}
	public final void setAssetId(final int assetId) {
		this.assetId = assetId;
	}
	public final String getFileStatusTemp() {
		return this.fileStatusTemp;
	}
	public final void setFileStatusTemp(final String fileStatusTemp) {
		this.fileStatusTemp = fileStatusTemp;
	}
	public final FileStatus getFileStatus() {
		return this.fileStatus;
	}
	public final void setFileStatus(final FileStatus fileStatus) {
		this.fileStatus = fileStatus;
	}
	public final String getName() {
		return this.name;
	}
	public final void setName(final String name) {
		this.name = name;
	}
	public final SourceLanguage getSourceLanguage() {
		return this.sourceLanguage;
	}
	public final void setSourceLanguage(final SourceLanguage sourceLanguage) {
		this.sourceLanguage = sourceLanguage;
	}
	public final TargetLanguage getTargetLanguage() {
		return this.targetLanguage;
	}
	public final void setTargetLanguage(final TargetLanguage targetLanguage) {
		this.targetLanguage = targetLanguage;
	}
	public final RejectFile getRejection() {
		return this.rejection;
	}
	public final void setRejection(final RejectFile rejection) {
		this.rejection = rejection;
	}
	public final Project getProject() {
		return this.project;
	}
	public final void setProject(final Project project) {
		this.project = project;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy