public class XmlGenerator extends Object
Action
s and Datasource
) from a given list of
XmlGenerator.Entity
s. The generated XML will contain a basic master-detail navigation which can be used as a starting
point to implement CRUD functionality. Anyhow, no Java-sourcecode ( ActionProvider
s or DataProvider
s
) will be generated. This can be done for example by using custom freemarker templating.
Example usage:
XmlGenerator generator = new XmlGenerator(); generator.setDatePattern("yyyy-MM-dd"); Entity entity = new Entity(Person.class, new String[] { "name", "firstName", "street", "birthDate" }); generator.generate("target/generated", "My generated person app", "messages-persons", entity);See also
generate(String, String, String, Entity...)
Modifier and Type | Class and Description |
---|---|
static class |
XmlGenerator.Entity
Represents a domain object of a certain type with a number of properties
|
Constructor and Description |
---|
XmlGenerator() |
XmlGenerator(boolean addPermissions)
Creates a new XmlGenerator
|
Modifier and Type | Method and Description |
---|---|
void |
generate(String outPath,
String name,
String dictionaryName,
XmlGenerator.Entity... entities)
Generates the source XML for the given
XmlGenerator.Entity s. |
Event |
generateActions(Permissions permissions,
XmlGenerator.Entity entity) |
Event |
generateActions(Permissions permissions,
XmlGenerator.Entity entity,
OutputStream out) |
Datasources |
generateDatasources(XmlGenerator.Entity entity,
OutputStream out) |
Datasources |
generateDatasources(XmlGenerator.Entity entity,
OutputStream out,
String... properties) |
Pages |
generatePages(XmlGenerator.Entity entity,
Linkpanel navigation,
OutputStream out) |
ApplicationRootConfig |
generateRootConfig(String name) |
String |
getDatePattern() |
Datasource |
getSingleItemDatasource(XmlGenerator.Entity entity,
OutputStream out,
String... properties) |
void |
setDatePattern(String datePattern) |
void |
writeDictionary(OutputStream out) |
void |
writeToOutputStream(Object object,
OutputStream out) |
public XmlGenerator(boolean addPermissions) throws JAXBException, TransformerConfigurationException
addPermissions
- if Permissions
should be generated and used when referencing Action
sJAXBException
- if creating a MarshallService
failsTransformerConfigurationException
- if an error occurs while configuring the TransformerFactory
public XmlGenerator() throws JAXBException, TransformerConfigurationException
public void generate(String outPath, String name, String dictionaryName, XmlGenerator.Entity... entities) throws Exception
XmlGenerator.Entity
s. The following files will be created for each
XmlGenerator.Entity
, assuming the Person.class
as the entities type:
ApplicationRootConfig
outPath
- the target folder for the files to be generatedname
- the name for the ApplicationRootConfig
-file to be createddictionaryName
- the name for the dictionary file to be created (<dictionaryName>.properties)entities
- the list of XmlGenerator.Entity
s to generate the source XML forException
- if something goes really wrong ;-)public Pages generatePages(XmlGenerator.Entity entity, Linkpanel navigation, OutputStream out) throws Exception
Exception
public Event generateActions(Permissions permissions, XmlGenerator.Entity entity, OutputStream out) throws Exception
Exception
public Event generateActions(Permissions permissions, XmlGenerator.Entity entity) throws Exception
Exception
public Datasources generateDatasources(XmlGenerator.Entity entity, OutputStream out) throws Exception
Exception
public Datasources generateDatasources(XmlGenerator.Entity entity, OutputStream out, String... properties) throws Exception
Exception
public void writeToOutputStream(Object object, OutputStream out) throws ParserConfigurationException, JAXBException, TransformerException
public Datasource getSingleItemDatasource(XmlGenerator.Entity entity, OutputStream out, String... properties) throws Exception
Exception
public void writeDictionary(OutputStream out) throws IOException
IOException
public ApplicationRootConfig generateRootConfig(String name)
public String getDatePattern()
public void setDatePattern(String datePattern)
Copyright © 2011–2019 aiticon GmbH. All rights reserved.