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": {
"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": [

View file

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