[NG][UPDATE]
- excludes xml annotations from import - adds exported data git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@5133 8810af33-2d31-482b-a856-94f89814c4dfccm-docs
parent
53a9d54ced
commit
1408198b19
|
|
@ -22,31 +22,19 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import org.hibernate.annotations.Type;
|
import org.hibernate.annotations.Type;
|
||||||
import org.hibernate.search.annotations.Field;
|
import org.hibernate.search.annotations.Field;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import static org.libreccm.l10n.L10NConstants.L10N_XML_NS;
|
|
||||||
|
|
||||||
import org.libreccm.l10n.jaxb.LocalizedStringValuesAdapter;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.persistence.Basic;
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.ElementCollection;
|
import javax.persistence.ElementCollection;
|
||||||
import javax.persistence.Embeddable;
|
import javax.persistence.Embeddable;
|
||||||
import javax.persistence.FetchType;
|
import javax.persistence.FetchType;
|
||||||
import javax.persistence.Lob;
|
import javax.persistence.Lob;
|
||||||
import javax.persistence.MapKeyColumn;
|
import javax.persistence.MapKeyColumn;
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import java.io.Serializable;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import java.util.Collections;
|
||||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
import java.util.HashMap;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A helper class for localisable string properties. This class is declared as
|
* A helper class for localisable string properties. This class is declared as
|
||||||
|
|
@ -58,7 +46,7 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||||
*/
|
*/
|
||||||
@Embeddable
|
@Embeddable
|
||||||
//@XmlRootElement(name = "localized-string", namespace = L10N_XML_NS)
|
//@XmlRootElement(name = "localized-string", namespace = L10N_XML_NS)
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
//@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public class LocalizedString implements Serializable {
|
public class LocalizedString implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 7378282657084330425L;
|
private static final long serialVersionUID = 7378282657084330425L;
|
||||||
|
|
@ -69,12 +57,11 @@ public class LocalizedString implements Serializable {
|
||||||
@ElementCollection(fetch = FetchType.EAGER)
|
@ElementCollection(fetch = FetchType.EAGER)
|
||||||
@MapKeyColumn(name = "LOCALE")
|
@MapKeyColumn(name = "LOCALE")
|
||||||
@Column(name = "LOCALIZED_VALUE")
|
@Column(name = "LOCALIZED_VALUE")
|
||||||
@Basic
|
|
||||||
@Lob
|
@Lob
|
||||||
@Type(type = "org.hibernate.type.TextType")
|
@Type(type = "org.hibernate.type.TextType")
|
||||||
@Field
|
@Field
|
||||||
@XmlElement(name = "values", namespace = L10N_XML_NS)
|
//@XmlElement(name = "values", namespace = L10N_XML_NS)
|
||||||
@XmlJavaTypeAdapter(LocalizedStringValuesAdapter.class)
|
//@XmlJavaTypeAdapter(LocalizedStringValuesAdapter.class)
|
||||||
private Map<Locale, String> values;
|
private Map<Locale, String> values;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||||
import com.fasterxml.jackson.dataformat.xml.JacksonXmlModule;
|
import com.fasterxml.jackson.dataformat.xml.JacksonXmlModule;
|
||||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||||
|
import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
|
@ -76,11 +77,11 @@ public abstract class AbstractMarshaller<P extends Portable> {
|
||||||
JacksonXmlModule module = new JacksonXmlModule();
|
JacksonXmlModule module = new JacksonXmlModule();
|
||||||
module.setDefaultUseWrapper(false);
|
module.setDefaultUseWrapper(false);
|
||||||
xmlMapper = new XmlMapper(module);
|
xmlMapper = new XmlMapper(module);
|
||||||
|
|
||||||
if (indentation) {
|
if (indentation) {
|
||||||
xmlMapper.enable(SerializationFeature.INDENT_OUTPUT);
|
xmlMapper.enable(SerializationFeature.INDENT_OUTPUT);
|
||||||
}
|
}
|
||||||
|
//xmlMapper.registerModule(new JaxbAnnotationModule());
|
||||||
|
xmlMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue