[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-94f89814c4df
ccm-docs
tosmers 2017-11-23 15:46:59 +00:00
parent 53a9d54ced
commit 1408198b19
2 changed files with 13 additions and 25 deletions

View File

@ -22,31 +22,19 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import org.hibernate.annotations.Type;
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.ElementCollection;
import javax.persistence.Embeddable;
import javax.persistence.FetchType;
import javax.persistence.Lob;
import javax.persistence.MapKeyColumn;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.io.Serializable;
import java.util.Collections;
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
@ -58,7 +46,7 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
*/
@Embeddable
//@XmlRootElement(name = "localized-string", namespace = L10N_XML_NS)
@XmlAccessorType(XmlAccessType.FIELD)
//@XmlAccessorType(XmlAccessType.FIELD)
public class LocalizedString implements Serializable {
private static final long serialVersionUID = 7378282657084330425L;
@ -69,12 +57,11 @@ public class LocalizedString implements Serializable {
@ElementCollection(fetch = FetchType.EAGER)
@MapKeyColumn(name = "LOCALE")
@Column(name = "LOCALIZED_VALUE")
@Basic
@Lob
@Type(type = "org.hibernate.type.TextType")
@Field
@XmlElement(name = "values", namespace = L10N_XML_NS)
@XmlJavaTypeAdapter(LocalizedStringValuesAdapter.class)
//@XmlElement(name = "values", namespace = L10N_XML_NS)
//@XmlJavaTypeAdapter(LocalizedStringValuesAdapter.class)
private Map<Locale, String> values;
/**

View File

@ -23,6 +23,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.dataformat.xml.JacksonXmlModule;
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.Logger;
@ -76,11 +77,11 @@ public abstract class AbstractMarshaller<P extends Portable> {
JacksonXmlModule module = new JacksonXmlModule();
module.setDefaultUseWrapper(false);
xmlMapper = new XmlMapper(module);
if (indentation) {
xmlMapper.enable(SerializationFeature.INDENT_OUTPUT);
}
//xmlMapper.registerModule(new JaxbAnnotationModule());
xmlMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
break;
default: