add views for transform

This commit is contained in:
etreschenkov 2025-05-05 17:43:50 +03:00
parent 366a45d115
commit 8f5ae16889
2 changed files with 299 additions and 39 deletions

View file

@ -10772,6 +10772,253 @@
,"views": { ,"views": {
"AccountUnion": {
"sources": [
"bankAccount"
,
"account"
,
"clearingAccount"
],"fields":[
{
"code": ""
}
,
{
"code": ""
}
,
{
"code": ""
}
,
{
"code": ""
}
,
{
"code": ""
}
,
{
"code": ""
}
,
{
"code": ""
}
]
}
,
"executionCurrencyView": {
"sources": [
"executionCurrency"
],"fields":[
{
"code": "exchangeExecutionId"
}
,
{
"code": "side"
}
,
{
"code": "market"
,"name": "Код класса валютного инструмента","shortname": "Код класса","link": "market","linkKeyCode": "code","linkCode": "code"
}
,
{
"code": "tradingDate"
}
,
{
"code": "settlementDate"
}
,
{
"code": "securitySymbol"
}
,
{
"code": "price"
}
,
{
"code": "settlementAmount"
,"name": "Сумма сделки в рублях","shortname": "Сумма сделки"
}
,
{
"code": "lots"
,"shortname": "Объем в лотах"
}
,
{
"code": "quantity"
,"name": "Объем сделки в единицах валюты","shortname": "Объем сделки"
}
,
{
"code": "exchangeExecutionTime"
,"shortname": "Время сделки"
}
,
{
"code": "partyTradingClearingRegistryId"
}
,
{
"code": "comment"
,"visible": true,"ignore": false
}
,
{
"code": "clientCode"
,"visible": true,"ignore": false
}
,
{
"code": "settlementCode"
,"name": "Код расчетов при размещении","shortname": "Код режима расчетов","visible": true,"ignore": false
}
,
{
"code": "companyId"
,"name": "Код участника клиринга","shortname": "Код УК","link": "company","linkCode": "clearingCode"
}
,
{
"code": "companyId"
,"name": "Название участника клиринга","shortname": "Название УК"
}
,
{
"code": "counterPartyId"
,"name": "Код УК контрагента","shortname": "Код УК контрагента","visible": true,"link": "company","linkCode": "clearingCode"
}
,
{
"code": "counterPartyId"
,"name": "Название УК контрагента","shortname": "Название УК контрагента","visible": true
}
,
{
"code": "market"
,"name": "Наименование класса валютного инструмента","shortname": "Наименование класса"
}
,
{
"code": "currencyCode"
,"name": "Код валюты расчетов","shortname": "Валюта расчетов","visible": true
}
,
{
"code": "market"
,"name": "Код секции в Клиринговой системе","shortname": "Код секции в КС","link": "market","linkKeyCode": "code","linkCode": "section"
}
,
{
"code": "linkedExchangeExecutionId"
,"visible": true,"ignore": false
}
,
{
"code": "id"
}
,
{
"code": "createdAt"
}
,
{
"code": "updatedAt"
}
]
}
} }
,"types": [ ,"types": [

View file

@ -5,14 +5,14 @@
<xsl:template match="/"> <xsl:template match="/">
<xsl:apply-templates select="*"/> <xsl:apply-templates select="*"/>
</xsl:template> </xsl:template>
<xsl:template match="meta"> <xsl:template match="meta">
{ {
"version": "<xsl:value-of select="@version"/>", "version": "<xsl:value-of select="@version"/>",
<xsl:apply-templates select="*"/> <xsl:apply-templates select="*"/>
} }
</xsl:template> </xsl:template>
<xsl:template match="enums"> <xsl:template match="enums">
"enums": { "enums": {
<xsl:apply-templates select="*" mode="enums"/> <xsl:apply-templates select="*" mode="enums"/>
@ -26,24 +26,24 @@
} }
</xsl:template> </xsl:template>
<xsl:template match="views"> <xsl:template match="views">
,"views": { ,"views": {
<!--xsl:apply-templates select="*" mode="views"/--> <xsl:apply-templates select="*" mode="views"/>
} }
</xsl:template> </xsl:template>
<xsl:template match="reports"></xsl:template> <xsl:template match="reports"></xsl:template>
<xsl:template match="types"> <xsl:template match="types">
,"types": [ ,"types": [
<xsl:apply-templates select="*" mode="types"/> <xsl:apply-templates select="*" mode="types"/>
] ]
</xsl:template> </xsl:template>
<xsl:template match="*" mode="types"> <xsl:template match="*" mode="types">
<xsl:if test="position() > 1">,</xsl:if> <xsl:if test="position() > 1">,</xsl:if>
{ {
@ -54,8 +54,8 @@
</xsl:for-each> </xsl:for-each>
} }
</xsl:template> </xsl:template>
<xsl:template match="*" mode="enums"> <xsl:template match="*" mode="enums">
<xsl:if test="position() > 1">,</xsl:if> <xsl:if test="position() > 1">,</xsl:if>
"<xsl:value-of select="name(.)"/>": { "<xsl:value-of select="name(.)"/>": {
@ -65,7 +65,7 @@
"fields": [<xsl:apply-templates select="*" mode="field"/>] "fields": [<xsl:apply-templates select="*" mode="field"/>]
} }
</xsl:template> </xsl:template>
<xsl:template match="*" mode="objects"> <xsl:template match="*" mode="objects">
<xsl:if test="position() > 1">,</xsl:if> <xsl:if test="position() > 1">,</xsl:if>
@ -84,8 +84,8 @@
<xsl:template match="subscription" mode="objects"></xsl:template> <xsl:template match="subscription" mode="objects"></xsl:template>
<xsl:template match="subscriptionHistory" mode="objects"></xsl:template> <xsl:template match="subscriptionHistory" mode="objects"></xsl:template>
<xsl:template match="views" mode="objects"></xsl:template> <xsl:template match="views" mode="objects"></xsl:template>
<xsl:template match="actions" mode="objects"> <xsl:template match="actions" mode="objects">
<xsl:for-each select="*"> <xsl:for-each select="*">
<xsl:if test="position() > 1">,</xsl:if> <xsl:if test="position() > 1">,</xsl:if>
@ -97,10 +97,10 @@
} }
</xsl:for-each> </xsl:for-each>
</xsl:template> </xsl:template>
<xsl:template match="*" mode="views"> <xsl:template match="*" mode="views">
<xsl:if test="position() > 1">,</xsl:if> <xsl:if test="position() > 1">,</xsl:if>
"<xsl:value-of select="name(.)"/>": { "<xsl:value-of select="name(.)"/>": {
@ -118,32 +118,45 @@
"<xsl:value-of select="@code"/>" "<xsl:value-of select="@code"/>"
</xsl:template> </xsl:template>
<xsl:template match="set" mode="views"> <xsl:template match="set" mode="views">
<xsl:if test="position() > 1">,</xsl:if> <xsl:if test="position() > 1">,</xsl:if>
<xsl:choose> <xsl:variable name="nodeName"><xsl:value-of select="name()"/></xsl:variable>
<xsl:when test="count(field)=1"> <!-- <xsl:choose>
<xsl:apply-templates select="field"/> <xsl:when test="count(node())=1">
</xsl:when> <xsl:apply-templates select="node()"/>
<xsl:otherwise> </xsl:when>
{<xsl:for-each select="field[position() = 1]"> <xsl:otherwise>-->
<xsl:for-each select="@*[name()!='source']"> {<xsl:for-each select="node()[position() = 1]">
<xsl:if test="position() > 1">,</xsl:if> "code": "<xsl:value-of select="name()"/>"
"<xsl:value-of select="name()"/>": <xsl:for-each select="@*[name()!='source']">
<xsl:variable name="attrName"><xsl:value-of select="name()"/></xsl:variable> <xsl:if test="position() >= 1">,</xsl:if>
{ <xsl:choose>
<xsl:for-each select="parent::*/parent::*/field/@*[name()=$attrName]"> <xsl:when test="name()='type'">"<xsl:value-of select="name()"/>": <xsl:value-of select="."/></xsl:when>
<xsl:apply-templates select="." mode="withSource"/> <xsl:when test="name()='length'">"<xsl:value-of select="name()"/>": <xsl:value-of select="."/></xsl:when>
<xsl:if test="position() != last()">,</xsl:if> <xsl:when test="name()='searchable'">"<xsl:value-of select="name()"/>": <xsl:value-of select="."/></xsl:when>
</xsl:for-each> <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:for-each> <xsl:when test="name()='enabled'">"<xsl:value-of select="name()"/>": <xsl:value-of select="."/></xsl:when>
</xsl:for-each> <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:otherwise> <xsl:when test="name()='cacheable'">"<xsl:value-of select="name()"/>": <xsl:value-of select="."/></xsl:when>
</xsl:choose> <xsl:otherwise>"<xsl:value-of select="name()"/>": "<xsl:value-of select="."/>"</xsl:otherwise>
</xsl:choose>
<xsl:variable name="attrName"><xsl:value-of select="name()"/></xsl:variable>
<!-- {
<xsl:for-each select="parent::*/parent::*/*[name()=$nodeName]/@*[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>
<xsl:template match="*" mode="field"> <xsl:template match="*" mode="field">
<xsl:if test="position() > 1">,</xsl:if> <xsl:if test="position() > 1">,</xsl:if>
@ -181,7 +194,7 @@
</xsl:for-each> </xsl:for-each>
}} }}
</xsl:template> </xsl:template>
<xsl:template match="@*" mode="withSource"> <xsl:template match="@*" mode="withSource">
<xsl:choose> <xsl:choose>