meta plugin
This commit is contained in:
parent
df24344b8d
commit
fe1bdc63fd
4 changed files with 1914 additions and 1698 deletions
|
|
@ -112,13 +112,11 @@
|
|||
<configuration>
|
||||
<transformationSets>
|
||||
<transformationSet>
|
||||
<dir>src/data/meta</dir>
|
||||
<dir>src/main/resources/meta</dir>
|
||||
<excludes>
|
||||
<exclude>src/data/meta/meta.server.html</exclude>
|
||||
<exclude>src/data/meta/meta.server.json</exclude>
|
||||
<exclude>src/data/meta/meta.server.xslt</exclude>
|
||||
<exclude>meta.server.xslt</exclude>
|
||||
</excludes>
|
||||
<stylesheet>src/data/meta/meta.server.xslt</stylesheet>
|
||||
<stylesheet>src/main/resources/meta/meta.server.xslt</stylesheet>
|
||||
<fileMappers>
|
||||
<fileMapper
|
||||
implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,218 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:output version="1.0" method="text" indent="no" encoding="UTF-8"/>
|
||||
|
||||
<xsl:template match="/">
|
||||
<xsl:apply-templates select="*"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="meta">
|
||||
{
|
||||
"version": "<xsl:value-of select="@version"/>",
|
||||
<xsl:apply-templates select="*"/>
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="enums">
|
||||
"enums": {
|
||||
<xsl:apply-templates select="*" mode="enums"/>
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="objects">
|
||||
,"objects": {
|
||||
<xsl:apply-templates select="*" mode="objects"/>
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="views">
|
||||
,"views": {
|
||||
<xsl:apply-templates select="*" mode="views"/>
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="types">
|
||||
,"types": [
|
||||
<xsl:apply-templates select="*" mode="types"/>
|
||||
]
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="type" mode="types">
|
||||
<xsl:if test="position() > 1">,</xsl:if>
|
||||
{
|
||||
<xsl:for-each select="@*">
|
||||
"<xsl:value-of select="name()"/>": "<xsl:value-of select="."/>"
|
||||
<xsl:if test="position() != last()">,</xsl:if>
|
||||
</xsl:for-each>
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="*" mode="enums">
|
||||
<xsl:if test="position() > 1">,</xsl:if>
|
||||
"<xsl:value-of select="name(.)"/>": {
|
||||
<xsl:for-each select="@*">
|
||||
"<xsl:value-of select="name()"/>": "<xsl:value-of select="."/>",
|
||||
</xsl:for-each>
|
||||
"fields": [<xsl:apply-templates select="field"/>]
|
||||
,"values": [<xsl:apply-templates select="value"/>]
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="*" mode="objects">
|
||||
<xsl:if test="position() > 1">,</xsl:if>
|
||||
"<xsl:value-of select="name(.)"/>": {
|
||||
<xsl:for-each select="@*">
|
||||
"<xsl:value-of select="name()"/>": "<xsl:value-of select="."/>",
|
||||
</xsl:for-each>
|
||||
"fields": [<xsl:apply-templates select="field"/>]
|
||||
<xsl:apply-templates select="query|subscription|subscriptionHistory" mode="objects"/>
|
||||
<xsl:if test="actions">,"actions":[<xsl:apply-templates select="actions" mode="objects"/>]</xsl:if>
|
||||
<xsl:if test="views">,"views":{<xsl:apply-templates select="views" mode="objects"/>}</xsl:if>
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="query" mode="objects">
|
||||
,"query": {
|
||||
"enabled": <xsl:value-of select="@enabled"/>,
|
||||
"destination": "<xsl:value-of select="@destination"/>"
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="subscription" mode="objects">
|
||||
,"subscription": {
|
||||
"enabled": <xsl:value-of select="@enabled"/>,
|
||||
"destination": "<xsl:value-of select="@destination"/>"
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="subscriptionHistory" mode="objects">
|
||||
,"subscriptionHistory": {
|
||||
"enabled": <xsl:value-of select="@enabled"/>,
|
||||
"destination": "<xsl:value-of select="@destination"/>"
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
|
||||
|
||||
<xsl:template match="actions" mode="objects">
|
||||
<xsl:if test="position() > 1">,</xsl:if>
|
||||
{
|
||||
<xsl:for-each select="@*">
|
||||
"<xsl:value-of select="name()"/>": "<xsl:value-of select="."/>",
|
||||
</xsl:for-each>
|
||||
"fields": [<xsl:apply-templates select="field"/>]
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="views" mode="objects">
|
||||
<xsl:if test="position() > 1">,</xsl:if>
|
||||
"<xsl:value-of select="@code"/>": {
|
||||
"name": "<xsl:value-of select="@name"/>",
|
||||
"fields": [<xsl:apply-templates select="field"/>]
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="*" mode="views">
|
||||
<xsl:if test="position() > 1">,</xsl:if>
|
||||
"<xsl:value-of select="name(.)"/>": {
|
||||
<xsl:for-each select="@*">
|
||||
"<xsl:value-of select="name()"/>": "<xsl:value-of select="."/>",
|
||||
</xsl:for-each>
|
||||
<xsl:if test="source">"sources": [<xsl:apply-templates select="source" mode="views"/>]</xsl:if>
|
||||
<xsl:if test="set">,"fields":[<xsl:apply-templates select="set" mode="views"/>]</xsl:if>
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="source" mode="views">
|
||||
<xsl:if test="position() > 1">,</xsl:if>
|
||||
"<xsl:value-of select="@code"/>"
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="set" mode="views">
|
||||
<xsl:if test="position() > 1">,</xsl:if>
|
||||
<xsl:choose>
|
||||
<xsl:when test="count(field)=1">
|
||||
<xsl:apply-templates select="field"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
{<xsl:for-each select="field[position() = 1]">
|
||||
<xsl:for-each select="@*[name()!='source']">
|
||||
<xsl:if test="position() > 1">,</xsl:if>
|
||||
"<xsl:value-of select="name()"/>":
|
||||
<xsl:variable name="attrName"><xsl:value-of select="name()"/></xsl:variable>
|
||||
{
|
||||
<xsl:for-each select="parent::*/parent::*/field/@*[name()=$attrName]">
|
||||
<xsl:apply-templates select="." mode="withSource"/>
|
||||
<xsl:if test="position() != last()">,</xsl:if>
|
||||
</xsl:for-each>
|
||||
}
|
||||
</xsl:for-each>
|
||||
</xsl:for-each>
|
||||
}
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="field">
|
||||
<xsl:if test="position() > 1">,</xsl:if>
|
||||
{
|
||||
<xsl:for-each select="@*">
|
||||
<xsl:choose>
|
||||
<xsl:when test="name()='type'">"<xsl:value-of select="name()"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='length'">"<xsl:value-of select="name()"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='searchable'">"<xsl:value-of select="name()"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='sortable'">"<xsl:value-of select="name()"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='visible'">"<xsl:value-of select="name()"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='ignore'">"<xsl:value-of select="name()"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='required'">"<xsl:value-of select="name()"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='cacheable'">"<xsl:value-of select="name()"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:otherwise>"<xsl:value-of select="name()"/>": "<xsl:value-of select="."/>"</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="position() != last()">,</xsl:if>
|
||||
</xsl:for-each>
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="value">
|
||||
<xsl:if test="position() > 1">,</xsl:if>
|
||||
{
|
||||
<xsl:for-each select="@*">
|
||||
<xsl:choose>
|
||||
<xsl:when test="name()='id'">"<xsl:value-of select="name()"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='code'">"<xsl:value-of select="name()"/>": "<xsl:value-of select="."/>"</xsl:when>
|
||||
<xsl:when test="name()='name'">"<xsl:value-of select="name()"/>": "<xsl:value-of select="."/>"</xsl:when>
|
||||
<xsl:otherwise>"<xsl:value-of select="name()"/>": "<xsl:value-of select="."/>"</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="position() != last()">,</xsl:if>
|
||||
</xsl:for-each>
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="@*" mode="withSource">
|
||||
<xsl:choose>
|
||||
<xsl:when test="name()='type'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='length'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='searchable'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='sortable'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='visible'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='required'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='cacheable'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:otherwise>"<xsl:value-of select="parent::*/@source"/>": "<xsl:value-of select="."/>"</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue