com.lionbridge.content.sdk.models.TargetLanguage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of liox-content-sdk-java Show documentation
Show all versions of liox-content-sdk-java Show documentation
Client for Lionbridge Ondemand API
package com.lionbridge.content.sdk.models;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.lionbridge.content.sdk.definitions.TranslatedFileStatus;
import com.lionbridge.content.sdk.validations.TargetLanguageConverter;
import java.net.URI;
import java.net.URISyntaxException;
import static java.lang.String.format;
@JsonDeserialize(converter=TargetLanguageConverter.class)
public class TargetLanguage extends LBLanguage {
@JacksonXmlProperty(localName="Count")
private int count;
@JacksonXmlProperty(localName="Status")
private String fileStatusTemp;
private TranslatedFileStatus fileStatus;
@JacksonXmlProperty(localName="ProjectURL")
private String projectUrlString;
private URI projectUrl;
@JacksonXmlProperty(localName="DownloadURL")
private String downloadUrlString;
@JacksonXmlProperty(localName="URL")
private String urlString;
@JacksonXmlProperty(localName = "AcceptedBy")
private String acceptedBy;
@JacksonXmlProperty(localName = "AcceptedDate")
private String acceptedDate;
@JacksonXmlProperty(localName = "AcceptedMethod")
private String acceptedMethod;
public TargetLanguage() {}
public TargetLanguage(String languageCode) {
this.setLanguageCode(languageCode);
}
public void runValidations() {
if(null != fileStatusTemp) {
fileStatusTemp = fileStatusTemp.replaceAll("\\s+","");
setFileStatus(TranslatedFileStatus.valueOf(fileStatusTemp));
}
try {
if(this.projectUrlString != null && !this.projectUrlString.isEmpty()) {
this.setProjectUrl(new URI(this.projectUrlString));
}
} catch (URISyntaxException e) {
// Leave projectUrl blank. TODO: Is this proper? If I throw the error, my converter will fail.
}
}
public String toXmlString() {
return format("%s ", this.getLanguageCode());
}
public URI getProjectUrl() {
return projectUrl;
}
public void setProjectUrl(final URI projectUrl) {
this.projectUrl = projectUrl;
}
public TranslatedFileStatus getFileStatus() {
return fileStatus;
}
public void setFileStatus(final TranslatedFileStatus fileStatus) {
this.fileStatus = fileStatus;
}
public String getFileStatusTemp() {
return fileStatusTemp;
}
public void setFileStatusTemp(final String fileStatusTemp) {
this.fileStatusTemp = fileStatusTemp;
}
public int getCount() {
return count;
}
public void setCount(final int count) {
this.count = count;
}
public String getProjectUrlString() {
return projectUrlString;
}
public void setProjectUrlString(final String projectUrlString) {
this.projectUrlString = projectUrlString;
}
public String getDownloadUrlString() {
return downloadUrlString;
}
public void setDownloadUrlString(final String downloadUrlString) {
this.downloadUrlString = downloadUrlString;
}
public final String getUrlString() {
return this.urlString;
}
public final void setUrlString(final String urlString) {
this.urlString = urlString;
}
public String getAcceptedBy() {
return acceptedBy;
}
public void setAcceptedBy(String acceptedBy) {
this.acceptedBy = acceptedBy;
}
public String getAcceptedDate() {
return acceptedDate;
}
public void setAcceptedDate(String acceptedDate) {
this.acceptedDate = acceptedDate;
}
public String getAcceptedMethod() {
return acceptedMethod;
}
public void setAcceptedMethod(String acceptedMethod) {
this.acceptedMethod = acceptedMethod;
}
}