package fr.insee.rmes.api.operations.documentations;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang3.StringUtils;

import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;

import fr.insee.rmes.api.utils.Lang;
import fr.insee.rmes.api.utils.StringWithLang;

public class Document {
	private List<StringWithLang> label =  new ArrayList<StringWithLang>();
	private String dateMiseAJour;
	private String langue;
	private String url;
	
	
	@JacksonXmlProperty(localName="label")
	@JacksonXmlElementWrapper(useWrapping = false)
	public List<StringWithLang> getLabel() {
		return label;
	}
	
	public void setLabelLg1(String labelLg1) {
		label.add(new StringWithLang(labelLg1, Lang.FR));
	}
	
	public void setLabelLg2(String labelLg2) {
		if (StringUtils.isNotEmpty(labelLg2)) {
				label.add(new StringWithLang(labelLg2, Lang.EN));
		}
	}
	
	public String getDateMiseAJour() {
		return dateMiseAJour;
	}
	public void setDateMiseAJour(String dateMiseAJour) {
		this.dateMiseAJour = dateMiseAJour;
	}
	public String getLangue() {
		return langue;
	}
	public void setLangue(String langue) {
		this.langue = langue;
	}
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	
}

@@ -99,16 +99,55 @@
 .List;%0A%0A
+import javax.ws.rs.core.Configurable;%0A%0A
 import o
@@ -424,16 +424,59 @@
 ithLang;
+%0Aimport fr.insee.rmes.config.Configuration;
 %0A%0Apublic
@@ -1342,24 +1342,182 @@
  getUrl() %7B%0A
+%09%09if (url != null && url.contains(Configuration.FILE_STORAGE)) %7B%0A%09%09%09String%5B%5D temp = url.split(Configuration.FILE_STORAGE);%0A%09%09%09return temp%5Btemp.length-1%5D;%0A%09%09%7D%0A
 %09%09return url

Remove context in rmes files