#2075 - Refactor external mapping (i.e. named queries from ebean.xml etc) - extract api and separate module

This commit is contained in:
rob bygrave committed 2020-10-12 14:54:25 +13:00
1 parent f57db28f1c
commit 49b1bd54c3
52 files changed
+817 -259

No files matched your search

@@ -1,23 +0,0 @@
package io.ebeaninternal.xmapping.api;
import java.util.ArrayList;
import java.util.List;
public class XmapDto {
protected final String clazz;
protected final List<XmapRawSql> rawSql = new ArrayList<>();
public XmapDto(String clazz) {
this.clazz = clazz;
}
public String getClazz() {
return clazz;
}
public List<XmapRawSql> getRawSql() {
return rawSql;
}
}
@@ -1,19 +0,0 @@
package io.ebeaninternal.xmapping.api;
import java.util.ArrayList;
import java.util.List;
public class XmapEbean {
protected final List<XmapEntity> entity = new ArrayList<>();
protected final List<XmapDto> dto = new ArrayList<>();
public List<XmapEntity> getEntity() {
return entity;
}
public List<XmapDto> getDto() {
return dto;
}
}
@@ -1,27 +0,0 @@
package io.ebeaninternal.xmapping.api;
import java.util.ArrayList;
import java.util.List;
public class XmapEntity {
protected final String clazz;
protected final List<XmapNamedQuery> namedQuery = new ArrayList<>();
protected final List<XmapRawSql> rawSql = new ArrayList<>();
public XmapEntity(String clazz) {
this.clazz = clazz;
}
public String getClazz() {
return clazz;
}
public List<XmapNamedQuery> getNamedQuery() {
return namedQuery;
}
public List<XmapRawSql> getRawSql() {
return rawSql;
}
}
@@ -1,20 +0,0 @@
package io.ebeaninternal.xmapping.api;
public class XmapNamedQuery {
protected final String name;
protected final String query;
public XmapNamedQuery(String name, String query) {
this.name = name;
this.query = query;
}
public String getName() {
return name;
}
public String getQuery() {
return query;
}
}
@@ -1,42 +0,0 @@
package io.ebeaninternal.xmapping.api;
import java.util.LinkedHashMap;
import java.util.Map;
public class XmapRawSql {
protected final String name;
protected final String query;
protected final Map<String, String> columnMapping = new LinkedHashMap<>();
protected final Map<String, String> aliasMapping = new LinkedHashMap<>();
public XmapRawSql(String name, String query) {
this.name = name;
this.query = query;
}
public void addColumnMapping(String column, String property) {
columnMapping.put(column, property);
}
public void addAliasMapping(String alias, String property) {
aliasMapping.put(alias, property);
}
public String getName() {
return name;
}
public String getQuery() {
return query;
}
public Map<String, String> getColumnMapping() {
return columnMapping;
}
public Map<String, String> getAliasMapping() {
return aliasMapping;
}
}
@@ -1,15 +0,0 @@
package io.ebeaninternal.xmapping.api;
import java.util.List;
/**
* Read and return external mapping for named queries etc.
*/
public interface XmapService {
/**
* Read and return external named queries etc.
*/
List<XmapEbean> read(ClassLoader classLoader, List<String> mappingLocations);
}
@@ -1,66 +0,0 @@
package io.ebeaninternal.xmlmapping;
import io.avaje.classpath.scanner.ClassPathScanner;
import io.avaje.classpath.scanner.ClassPathScannerFactory;
import io.avaje.classpath.scanner.Resource;
import io.ebeaninternal.xmapping.api.XmapEbean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
import java.util.ServiceLoader;
/**
* Reads the Xml deployment information.
*/
class InternalConfigXmlRead {
private static final Logger log = LoggerFactory.getLogger(InternalConfigXmlRead.class);
private final ToXmapEbean to = new ToXmapEbean();
private final ClassLoader classLoader;
private final List<String> mappingLocations;
InternalConfigXmlRead(ClassLoader classLoader, List<String> mappingLocations) {
this.classLoader = classLoader;
this.mappingLocations = mappingLocations;
// if (config.getClassLoadConfig().isJavaxJAXBPresent()) {
// init();
// }
}
List<XmapEbean> read() {
List<XmapEbean> list = new ArrayList<>();
list.addAll(to.toBeans(XmlMappingReader.readByResourceName(classLoader, "ebean.xml")));
list.addAll(to.toBeans(XmlMappingReader.readByResourceList(xmlMappingResources())));
return list;
}
private List<Resource> xmlMappingResources() {
List<ClassPathScanner> scanners = scanners();
List<Resource> resourceList = new ArrayList<>();
long st = System.currentTimeMillis();
if (mappingLocations != null && !mappingLocations.isEmpty()) {
for (ClassPathScanner finder : scanners) {
for (String mappingLocation : mappingLocations) {
resourceList.addAll(finder.scanForResources(mappingLocation, resourceName -> resourceName.endsWith(".xml")));
}
}
}
long searchTime = System.currentTimeMillis() - st;
log.debug("Classpath search mappings[{}] searchTime[{}]", resourceList.size(), searchTime);
return resourceList;
}
/**
* Return the list of ClassPathScanner services using DatabaseConfig service loader.
*/
private List<ClassPathScanner> scanners() {
List<ClassPathScanner> scanners = new ArrayList<>();
for (ClassPathScannerFactory factory : ServiceLoader.load(ClassPathScannerFactory.class, classLoader)) {
scanners.add(factory.createScanner(classLoader));
}
return scanners;
}
}
@@ -1,14 +0,0 @@
package io.ebeaninternal.xmlmapping;
import io.ebeaninternal.xmapping.api.XmapEbean;
import io.ebeaninternal.xmapping.api.XmapService;
import java.util.List;
public class JaxbXmapService implements XmapService {
@Override
public List<XmapEbean> read(ClassLoader classLoader, List<String> mappingLocations) {
return new InternalConfigXmlRead(classLoader, mappingLocations).read();
}
}
@@ -1,85 +0,0 @@
package io.ebeaninternal.xmlmapping;
import io.ebeaninternal.xmapping.api.XmapDto;
import io.ebeaninternal.xmapping.api.XmapEbean;
import io.ebeaninternal.xmapping.api.XmapEntity;
import io.ebeaninternal.xmapping.api.XmapNamedQuery;
import io.ebeaninternal.xmapping.api.XmapRawSql;
import io.ebeaninternal.xmlmapping.model.XmAliasMapping;
import io.ebeaninternal.xmlmapping.model.XmColumnMapping;
import io.ebeaninternal.xmlmapping.model.XmDto;
import io.ebeaninternal.xmlmapping.model.XmEbean;
import io.ebeaninternal.xmlmapping.model.XmEntity;
import io.ebeaninternal.xmlmapping.model.XmNamedQuery;
import io.ebeaninternal.xmlmapping.model.XmRawSql;
import java.util.List;
import static java.util.stream.Collectors.toList;
public class ToXmapEbean {
public List<XmapEbean> toBeans(List<XmEbean> xmBeans) {
return xmBeans.stream()
.map(this::toBean)
.collect(toList());
}
private XmapEbean toBean(XmEbean bean) {
XmapEbean xmap = new XmapEbean();
xmap.getDto().addAll(toDto(bean.getDto()));
xmap.getEntity().addAll(toEntity(bean.getEntity()));
return xmap;
}
private List<XmapEntity> toEntity(List<XmEntity> xmEntity) {
return xmEntity.stream()
.map(this::toEntity)
.collect(toList());
}
private XmapEntity toEntity(XmEntity xmEntity) {
XmapEntity entity = new XmapEntity(xmEntity.getClazz());
for (XmNamedQuery named : xmEntity.getNamedQuery()) {
entity.getNamedQuery().add(toNamed(named));
}
for (XmRawSql xmRawSql : xmEntity.getRawSql()) {
entity.getRawSql().add(toRaw(xmRawSql));
}
return entity;
}
private XmapNamedQuery toNamed(XmNamedQuery named) {
return new XmapNamedQuery(named.getName(), named.getQuery().getValue());
}
private List<XmapDto> toDto(List<XmDto> dto) {
return dto.stream()
.map(this::toDto)
.collect(toList());
}
private XmapDto toDto(XmDto xmapDto) {
XmapDto dto = new XmapDto(xmapDto.getClazz());
dto.getRawSql().addAll(toRaw(xmapDto.getRawSql()));
return dto;
}
private List<XmapRawSql> toRaw(List<XmRawSql> rawSql) {
return rawSql.stream()
.map(this::toRaw)
.collect(toList());
}
private XmapRawSql toRaw(XmRawSql xmRawSql) {
XmapRawSql rawSql = new XmapRawSql(xmRawSql.getName(), xmRawSql.getQuery().getValue());
for (XmColumnMapping xmCol : xmRawSql.getColumnMapping()) {
rawSql.addColumnMapping(xmCol.getColumn(), xmCol.getProperty());
}
for (XmAliasMapping xmAlias : xmRawSql.getAliasMapping()) {
rawSql.addAliasMapping(xmAlias.getAlias(), xmAlias.getProperty());
}
return rawSql;
}
}
@@ -1,71 +0,0 @@
package io.ebeaninternal.xmlmapping;
import io.avaje.classpath.scanner.Resource;
import io.ebeaninternal.util.UrlHelper;
import io.ebeaninternal.xmlmapping.model.XmEbean;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
public class XmlMappingReader {
/**
* Read and return a Migration from an xml document.
*/
public static XmEbean read(InputStream is) {
try {
JAXBContext jaxbContext = JAXBContext.newInstance(XmEbean.class);
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
return (XmEbean) unmarshaller.unmarshal(is);
} catch (JAXBException e) {
throw new RuntimeException(e);
}
}
/**
* Read the deployment XML for the given resource name.
*/
public static List<XmEbean> readByResourceName(ClassLoader classLoader, String resourceName) {
try {
Enumeration<URL> resources = classLoader.getResources(resourceName);
List<XmEbean> mappings = new ArrayList<>();
while (resources.hasMoreElements()) {
URL url = resources.nextElement();
try (InputStream is = UrlHelper.openNoCache(url)) {
mappings.add(XmlMappingReader.read(is));
}
}
return mappings;
} catch (IOException e) {
throw new RuntimeException("Error reading ebean xml mapping", e);
}
}
/**
* Read the deployment XML for the given resources.
*/
public static List<XmEbean> readByResourceList(List<Resource> resourceList) {
try {
List<XmEbean> mappings = new ArrayList<>();
for (Resource xmlMappingRes : resourceList) {
try (InputStream is = new FileInputStream(xmlMappingRes.getLocationOnDisk())) {
mappings.add(XmlMappingReader.read(is));
}
}
return mappings;
} catch (IOException e) {
throw new RuntimeException("Error reading ebean xml mapping", e);
}
}
}
@@ -1,78 +0,0 @@
package io.ebeaninternal.xmlmapping.model;
import javax.xml.bind.annotation.XmlRegistry;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the io.ebeaninternal.xmlmapping.model package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*/
@XmlRegistry
public class ObjectFactory {
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: io.ebeaninternal.xmlmapping.model
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link XmRawSql }
*/
public XmRawSql createRawSql() {
return new XmRawSql();
}
/**
* Create an instance of {@link XmAliasMapping }
*/
public XmAliasMapping createAliasMapping() {
return new XmAliasMapping();
}
/**
* Create an instance of {@link XmColumnMapping }
*/
public XmColumnMapping createColumnMapping() {
return new XmColumnMapping();
}
/**
* Create an instance of {@link XmQuery }
*/
public XmQuery createQuery() {
return new XmQuery();
}
/**
* Create an instance of {@link XmEbean }
*/
public XmEbean createEbean() {
return new XmEbean();
}
/**
* Create an instance of {@link XmEntity }
*/
public XmEntity createEntity() {
return new XmEntity();
}
/**
* Create an instance of {@link XmNamedQuery }
*/
public XmNamedQuery createNamedQuery() {
return new XmNamedQuery();
}
}
@@ -1,76 +0,0 @@
package io.ebeaninternal.xmlmapping.model;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
* <p>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="alias" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;attribute name="property" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
@XmlRootElement(name = "alias-mapping")
public class XmAliasMapping {
@XmlAttribute(name = "alias", required = true)
protected String alias;
@XmlAttribute(name = "property", required = true)
protected String property;
/**
* Gets the value of the alias property.
*
* @return possible object is
* {@link String }
*/
public String getAlias() {
return alias;
}
/**
* Sets the value of the alias property.
*
* @param value allowed object is
* {@link String }
*/
public void setAlias(String value) {
this.alias = value;
}
/**
* Gets the value of the property property.
*
* @return possible object is
* {@link String }
*/
public String getProperty() {
return property;
}
/**
* Sets the value of the property property.
*
* @param value allowed object is
* {@link String }
*/
public void setProperty(String value) {
this.property = value;
}
}
@@ -1,76 +0,0 @@
package io.ebeaninternal.xmlmapping.model;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
* <p>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="column" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;attribute name="property" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
@XmlRootElement(name = "column-mapping")
public class XmColumnMapping {
@XmlAttribute(name = "column", required = true)
protected String column;
@XmlAttribute(name = "property", required = true)
protected String property;
/**
* Gets the value of the column property.
*
* @return possible object is
* {@link String }
*/
public String getColumn() {
return column;
}
/**
* Sets the value of the column property.
*
* @param value allowed object is
* {@link String }
*/
public void setColumn(String value) {
this.column = value;
}
/**
* Gets the value of the property property.
*
* @return possible object is
* {@link String }
*/
public String getProperty() {
return property;
}
/**
* Sets the value of the property property.
*
* @param value allowed object is
* {@link String }
*/
public void setProperty(String value) {
this.property = value;
}
}
@@ -1,121 +0,0 @@
package io.ebeaninternal.xmlmapping.model;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import java.util.ArrayList;
import java.util.List;
/**
* <p>Java class for anonymous complex type.
* <p>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element ref="{http://ebean-orm.github.io/xml/ns/ebean}named-query" maxOccurs="unbounded"/>
* &lt;element ref="{http://ebean-orm.github.io/xml/ns/ebean}raw-sql" maxOccurs="unbounded"/>
* &lt;/sequence>
* &lt;attribute name="class" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"namedQuery",
"rawSql"
})
@XmlRootElement(name = "dto")
public class XmDto {
@XmlElement(name = "named-query", required = true)
protected List<XmNamedQuery> namedQuery;
@XmlElement(name = "raw-sql", required = true)
protected List<XmRawSql> rawSql;
@XmlAttribute(name = "class", required = true)
protected String clazz;
/**
* Gets the value of the namedQuery property.
* <p>
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the namedQuery property.
* <p>
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getNamedQuery().add(newItem);
* </pre>
* <p>
* <p>
* <p>
* Objects of the following type(s) are allowed in the list
* {@link XmNamedQuery }
*/
public List<XmNamedQuery> getNamedQuery() {
if (namedQuery == null) {
namedQuery = new ArrayList<>();
}
return this.namedQuery;
}
/**
* Gets the value of the rawSql property.
* <p>
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the rawSql property.
* <p>
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getRawSql().add(newItem);
* </pre>
* <p>
* <p>
* <p>
* Objects of the following type(s) are allowed in the list
* {@link XmRawSql }
*/
public List<XmRawSql> getRawSql() {
if (rawSql == null) {
rawSql = new ArrayList<>();
}
return this.rawSql;
}
/**
* Gets the value of the clazz property.
*
* @return possible object is
* {@link String }
*/
public String getClazz() {
return clazz;
}
/**
* Sets the value of the clazz property.
*
* @param value allowed object is
* {@link String }
*/
public void setClazz(String value) {
this.clazz = value;
}
}
@@ -1,80 +0,0 @@
package io.ebeaninternal.xmlmapping.model;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import java.util.ArrayList;
import java.util.List;
/**
* <p>Java class for anonymous complex type.
* <p>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element ref="{http://ebean-orm.github.io/xml/ns/ebean}entity" maxOccurs="unbounded"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"entity",
"dto"
})
@XmlRootElement(name = "ebean")
public class XmEbean {
@XmlElement(required = false)
protected List<XmEntity> entity;
@XmlElement(required = false)
protected List<XmDto> dto;
/**
* Gets the value of the entity property.
* <p>
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the entity property.
* <p>
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getEntity().add(newItem);
* </pre>
* <p>
* <p>
* <p>
* Objects of the following type(s) are allowed in the list
* {@link XmEntity }
*/
public List<XmEntity> getEntity() {
if (entity == null) {
entity = new ArrayList<>();
}
return this.entity;
}
/**
* Returns the List of XmDto beans.
*/
public List<XmDto> getDto() {
if (dto == null) {
dto = new ArrayList<>();
}
return this.dto;
}
}
@@ -1,121 +0,0 @@
package io.ebeaninternal.xmlmapping.model;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import java.util.ArrayList;
import java.util.List;
/**
* <p>Java class for anonymous complex type.
* <p>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element ref="{http://ebean-orm.github.io/xml/ns/ebean}named-query" maxOccurs="unbounded"/>
* &lt;element ref="{http://ebean-orm.github.io/xml/ns/ebean}raw-sql" maxOccurs="unbounded"/>
* &lt;/sequence>
* &lt;attribute name="class" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"namedQuery",
"rawSql"
})
@XmlRootElement(name = "entity")
public class XmEntity {
@XmlElement(name = "named-query", required = true)
protected List<XmNamedQuery> namedQuery;
@XmlElement(name = "raw-sql", required = true)
protected List<XmRawSql> rawSql;
@XmlAttribute(name = "class", required = true)
protected String clazz;
/**
* Gets the value of the namedQuery property.
* <p>
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the namedQuery property.
* <p>
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getNamedQuery().add(newItem);
* </pre>
* <p>
* <p>
* <p>
* Objects of the following type(s) are allowed in the list
* {@link XmNamedQuery }
*/
public List<XmNamedQuery> getNamedQuery() {
if (namedQuery == null) {
namedQuery = new ArrayList<>();
}
return this.namedQuery;
}
/**
* Gets the value of the rawSql property.
* <p>
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the rawSql property.
* <p>
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getRawSql().add(newItem);
* </pre>
* <p>
* <p>
* <p>
* Objects of the following type(s) are allowed in the list
* {@link XmRawSql }
*/
public List<XmRawSql> getRawSql() {
if (rawSql == null) {
rawSql = new ArrayList<>();
}
return this.rawSql;
}
/**
* Gets the value of the clazz property.
*
* @return possible object is
* {@link String }
*/
public String getClazz() {
return clazz;
}
/**
* Sets the value of the clazz property.
*
* @param value allowed object is
* {@link String }
*/
public void setClazz(String value) {
this.clazz = value;
}
}
@@ -1,81 +0,0 @@
package io.ebeaninternal.xmlmapping.model;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
* <p>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element ref="{http://ebean-orm.github.io/xml/ns/ebean}query"/>
* &lt;/sequence>
* &lt;attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"query"
})
@XmlRootElement(name = "named-query")
public class XmNamedQuery {
@XmlElement(required = true)
protected XmQuery query;
@XmlAttribute(name = "name", required = true)
protected String name;
/**
* Gets the value of the query property.
*
* @return possible object is
* {@link XmQuery }
*/
public XmQuery getQuery() {
return query;
}
/**
* Sets the value of the query property.
*
* @param value allowed object is
* {@link XmQuery }
*/
public void setQuery(XmQuery value) {
this.query = value;
}
/**
* Gets the value of the name property.
*
* @return possible object is
* {@link String }
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value allowed object is
* {@link String }
*/
public void setName(String value) {
this.name = value;
}
}
@@ -1,54 +0,0 @@
package io.ebeaninternal.xmlmapping.model;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
/**
* <p>Java class for anonymous complex type.
* <p>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* &lt;complexType>
* &lt;simpleContent>
* &lt;extension base="&lt;http://www.w3.org/2001/XMLSchema>string">
* &lt;/extension>
* &lt;/simpleContent>
* &lt;/complexType>
* </pre>
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"value"
})
@XmlRootElement(name = "query")
public class XmQuery {
@XmlValue
protected String value;
/**
* Gets the value of the value property.
*
* @return possible object is
* {@link String }
*/
public String getValue() {
return value;
}
/**
* Sets the value of the value property.
*
* @param value allowed object is
* {@link String }
*/
public void setValue(String value) {
this.value = value;
}
}
@@ -1,145 +0,0 @@
package io.ebeaninternal.xmlmapping.model;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import java.util.ArrayList;
import java.util.List;
/**
* <p>Java class for anonymous complex type.
* <p>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element ref="{http://ebean-orm.github.io/xml/ns/ebean}alias-mapping" maxOccurs="unbounded" minOccurs="0"/>
* &lt;element ref="{http://ebean-orm.github.io/xml/ns/ebean}column-mapping" maxOccurs="unbounded" minOccurs="0"/>
* &lt;element ref="{http://ebean-orm.github.io/xml/ns/ebean}query"/>
* &lt;/sequence>
* &lt;attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"aliasMapping",
"columnMapping",
"query"
})
@XmlRootElement(name = "raw-sql")
public class XmRawSql {
@XmlElement(name = "alias-mapping")
protected List<XmAliasMapping> aliasMapping;
@XmlElement(name = "column-mapping")
protected List<XmColumnMapping> columnMapping;
@XmlElement(required = true)
protected XmQuery query;
@XmlAttribute(name = "name", required = true)
protected String name;
/**
* Gets the value of the aliasMapping property.
* <p>
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the aliasMapping property.
* <p>
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getAliasMapping().add(newItem);
* </pre>
* <p>
* <p>
* <p>
* Objects of the following type(s) are allowed in the list
* {@link XmAliasMapping }
*/
public List<XmAliasMapping> getAliasMapping() {
if (aliasMapping == null) {
aliasMapping = new ArrayList<>();
}
return this.aliasMapping;
}
/**
* Gets the value of the columnMapping property.
* <p>
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the columnMapping property.
* <p>
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getColumnMapping().add(newItem);
* </pre>
* <p>
* <p>
* <p>
* Objects of the following type(s) are allowed in the list
* {@link XmColumnMapping }
*/
public List<XmColumnMapping> getColumnMapping() {
if (columnMapping == null) {
columnMapping = new ArrayList<>();
}
return this.columnMapping;
}
/**
* Gets the value of the query property.
*
* @return possible object is
* {@link XmQuery }
*/
public XmQuery getQuery() {
return query;
}
/**
* Sets the value of the query property.
*
* @param value allowed object is
* {@link XmQuery }
*/
public void setQuery(XmQuery value) {
this.query = value;
}
/**
* Gets the value of the name property.
*
* @return possible object is
* {@link String }
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value allowed object is
* {@link String }
*/
public void setName(String value) {
this.name = value;
}
}
@@ -1,2 +0,0 @@
@javax.xml.bind.annotation.XmlSchema(namespace = "http://ebean-orm.github.io/xml/ns/ebean", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package io.ebeaninternal.xmlmapping.model;
@@ -1 +0,0 @@
io.ebeaninternal.xmlmapping.JaxbXmapService
@@ -1,80 +0,0 @@
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://ebean-orm.github.io/xml/ns/ebean"
targetNamespace="http://ebean-orm.github.io/xml/ns/ebean" elementFormDefault="qualified">
<!-- Root level type : extra-ddl -->
<xsd:element name="ebean">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="entity" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element ref="dto" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="entity">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="named-query" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element ref="raw-sql" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="class" type="xsd:string" use="required"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="dto">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="named-query" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element ref="raw-sql" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="class" type="xsd:string" use="required"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="named-query">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="query" minOccurs="1" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="raw-sql">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="alias-mapping" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element ref="column-mapping" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element ref="query" minOccurs="1" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="alias-mapping">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" use="required"/>
<xsd:attribute name="property" type="xsd:string" use="required"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="column-mapping">
<xsd:complexType>
<xsd:attribute name="column" type="xsd:string" use="required"/>
<xsd:attribute name="property" type="xsd:string" use="required"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="query">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<!--<xsd:attribute name="class" type="xsd:string" use="required"/>-->
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
</xsd:schema>