Skip to content

Instantly share code, notes, and snippets.

@jeriley
Created January 7, 2015 19:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeriley/fb4ed465214585802572 to your computer and use it in GitHub Desktop.
Save jeriley/fb4ed465214585802572 to your computer and use it in GitHub Desktop.
V1 Meta to java classes
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE stylesheet
[
<!ENTITY mdash "&#8212;">
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<html>
<head>
<title><xsl:if test="/*/@token"><xsl:value-of select="/*/@token"/> - </xsl:if>VersionOne Meta : Apex Format</title>
<style type="text/css">
.at-head {
margin-top: 1em;
margin-bottom: 0.5em;
}
.at-body {
margin-left: 2em;
}
.at-abstract {
color: #888;
}
.at-name {
font-size: larger;
font-weight: bold;
}
.ad-name {
font-weight: bold;
}
.ad-readonly .ad-name {
font-weight: normal;
font-style: italic;
}
.ad-operation .ad-name {
font-weight: bold;
font-style: italic;
}
.ad-required {
color: red;
}
#legend {
position: fixed;
top: 20px;
right: 20px;
border: 1px solid #ccc;
padding: 5px;
}
#legend .title {
text-align: center;
font-size: larger;
font-weight: bold;
margin: 3px;
}
#legend ul {
margin: 3px;
padding: 0;
list-style: none inside none;
}
#legend li {
margin: 2px;
}
</style>
</head>
<body>
<xsl:apply-templates select="//AssetType[@abstract='False'][not(contains(name, 'Attribute'))][not(contains(name, 'Definition'))]">
<xsl:sort select="@name"/>
</xsl:apply-templates>
</body>
</html>
</xsl:template>
<xsl:template match="AssetType">
<div class='assettype'>
<div class='at-head'>
<a><xsl:attribute name="id"><xsl:value-of select="@name"/></xsl:attribute></a>
public class <xsl:value-of select="@name"/> {
</div>
<div class='at-body'>
public const AssetType = "<xsl:value-of select="@name"/>";
<xsl:apply-templates select="AttributeDefinition[@attributetype!='Relation'][@attributetype!='Opaque'][@attributetype!='AssetType']">
<xsl:sort select="concat(@isrequired='False', @name)"/>
</xsl:apply-templates>
</div>
}
</div>
</xsl:template>
<xsl:template match="AttributeDefinition">
<div>
public
<xsl:if test="@attributetype='Numeric'">integer </xsl:if>
<xsl:if test="@attributetype='LongInt'">integer </xsl:if>
<xsl:if test="@attributetype='Date'">datetime </xsl:if>
<xsl:if test="@attributetype='Text'">string </xsl:if>
<xsl:if test="@attributetype='LongText'">string </xsl:if>
<xsl:if test="@attributetype='Boolean'">bool </xsl:if>
<xsl:if test="@attributetype='State'">State </xsl:if>
<xsl:if test="@attributetype='Rank'">integer </xsl:if>
<xsl:if test="@attributetype='Blob'">Blob </xsl:if>
<!--<xsl:if test="@attributetype='Relation'">Set<?> </xsl:if>-->
<xsl:value-of select="@name"/>
<xsl:if test="@isreadonly='True'"> { get; }</xsl:if>
<xsl:if test="@isreadonly='False'">{ get; set; }</xsl:if>
</div>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment