Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
SPB_Exchange_Repo
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Amelin Konstantin
SPB_Exchange_Repo
Commits
5a949c6c
Commit
5a949c6c
authored
Oct 22, 2018
by
Amelin Konstantin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change get signature
parent
ee6e333a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
81 additions
and
80 deletions
+81
-80
src/main/scala/templates/Logger.scala
+19
-18
src/main/scala/templates/RepoTemplate.scala
+28
-28
src/main/scala/templates/Template.scala
+8
-7
src/main/scala/templates/TradeTemplate.scala
+11
-11
src/test/scala/templates/TemplateSpec.scala
+15
-16
No files found.
src/main/scala/templates/Logger.scala
View file @
5a949c6c
...
@@ -2,7 +2,7 @@ package templates
...
@@ -2,7 +2,7 @@ package templates
import
scala.collection.mutable
import
scala.collection.mutable
import
scala.util.
{
Success
,
Try
}
import
scala.util.
{
Success
,
Try
}
import
scala.xml.
{
Node
,
Text
}
import
scala.xml.
{
Node
Seq
,
Text
}
trait
Logger
{
trait
Logger
{
this:
Template
=>
this:
Template
=>
...
@@ -37,27 +37,28 @@ trait Logger {
...
@@ -37,27 +37,28 @@ trait Logger {
m
m
}
}
override
protected
[
this
]
def
get
(
content
:
Try
[
Node
],
attr
:
String
=
null
)
:
Text
=
content
match
{
override
protected
[
this
]
def
get
(
content
:
NodeSeq
,
attr
:
String
=
null
,
idx
:
Int
=
0
)
:
Text
=
case
Success
(
v
)
=>
Try
{
content
(
idx
)
}
match
{
var
res
=
Text
(
v
.
text
)
case
Success
(
v
)
=>
var
res
=
Text
(
v
.
text
)
if
(
attr
!=
null
)
v
.
attribute
(
attr
)
match
{
if
(
attr
!=
null
)
v
.
attribute
(
attr
)
match
{
case
None
=>
case
None
=>
res
=
Text
(
msgNotFound
)
res
=
Text
(
msgNotFound
)
case
o
=>
case
o
=>
data
(
v
.
hashCode
).
head
.
_3
-=
o
.
get
.
hashCode
data
(
v
.
hashCode
).
head
.
_3
-=
o
.
get
.
hashCode
res
=
Text
(
o
.
get
.
text
)
res
=
Text
(
o
.
get
.
text
)
}
else
if
(
data
(
v
.
hashCode
).
nonEmpty
)
{
}
else
if
(
data
(
v
.
hashCode
).
nonEmpty
)
{
if
(
data
(
v
.
hashCode
).
head
.
_3
!=
null
)
{
if
(
data
(
v
.
hashCode
).
head
.
_3
!=
null
)
{
val
e
=
data
(
v
.
hashCode
).
head
.
copy
(
_2
=
null
)
val
e
=
data
(
v
.
hashCode
).
head
.
copy
(
_2
=
null
)
data
(
v
.
hashCode
).
enqueue
(
e
)
data
(
v
.
hashCode
).
enqueue
(
e
)
}
data
(
v
.
hashCode
).
dequeue
()
}
}
data
(
v
.
hashCode
).
dequeue
()
}
res
res
case
_
=>
Text
(
msgNotFound
)
case
_
=>
Text
(
msgNotFound
)
}
}
def
log
()
:
Unit
=
data
.
foreach
(
e
=>
println
(
e
.
_2
))
def
log
()
:
Unit
=
data
.
foreach
(
e
=>
println
(
e
.
_2
))
...
...
src/main/scala/templates/RepoTemplate.scala
View file @
5a949c6c
...
@@ -9,8 +9,8 @@ class RepoTemplate(source: Node) extends TradeTemplate(source) {
...
@@ -9,8 +9,8 @@ class RepoTemplate(source: Node) extends TradeTemplate(source) {
<fpml:tradeHeader>
<fpml:tradeHeader>
{
for
(
s
<-
source
\
"
trade
"
\
"
tradeHeader
"
\
"
partyTradeIdentifier
"
)
yield
{
{
for
(
s
<-
source
\
"
trade
"
\
"
tradeHeader
"
\
"
partyTradeIdentifier
"
)
yield
{
<fpml:partyTradeIdentifier>
<fpml:partyTradeIdentifier>
<fpml:partyReference
href
={
get
(
Try
{
(
s
\
"
partyReference
"
)
.head
},
"
href
"
)
}
/>
<fpml:partyReference
href
={
get
(
s
\
"
partyReference
"
,
"
href
"
)
}
/>
<fpml:tradeId
tradeIdScheme
={
get
(
Try
{
(
s
\
"tradeId"
).
head
},
"tradeIdScheme"
)
}>{
get
(
Try
{
(
s
\
"tradeId"
).
head
}
)
}</
fpml
:
tradeId>
<fpml:tradeId
tradeIdScheme
={
get
(
s
\
"tradeId"
,
"tradeIdScheme"
)
}>{
get
(
s
\
"tradeId"
)
}</
fpml
:
tradeId>
</fpml:partyTradeIdentifier>
</fpml:partyTradeIdentifier>
}
}
}
}
...
@@ -113,38 +113,38 @@ class RepoTemplate(source: Node) extends TradeTemplate(source) {
...
@@ -113,38 +113,38 @@ class RepoTemplate(source: Node) extends TradeTemplate(source) {
*/
}
*/
}
</
fpml
:
tradeHeader>
</
fpml
:
tradeHeader>
<fpmlext:repo
xsi:
type
=
"rtsrep:Repo"
>
<fpmlext:repo
xsi:
type
=
"rtsrep:Repo"
>
<
fpml
:
productId>
{
get
(
Try
{
(
source
\
"
trade
"
\
"
repo
"
\
"
productType
"
)
.head
}
)
}
</fpml:productId>
<
fpml
:
productId>
{
get
(
source
\
"
trade
"
\
"
repo
"
\
"
productType
"
)
}
</fpml:productId>
<fpml:productId
productIdScheme
={
get
(
Try
{
(
source
\
"trade"
\
"repo"
\
"productId"
).
head
},
"productIdScheme"
)
}>{
get
(
Try
{
(
source
\
"trade"
\
"repo"
\
"productId"
).
head
}
)
}</
fpml
:
productId>
<fpml:productId
productIdScheme
={
get
(
source
\
"trade"
\
"repo"
\
"productId"
,
"productIdScheme"
)
}>{
get
(
source
\
"trade"
\
"repo"
\
"productId"
)
}</
fpml
:
productId>
<fpmlext:fixedRateSchedule>
<fpmlext:fixedRateSchedule>
<fpml:initialValue>
{
get
(
Try
{
(
source
\
"
trade
"
\
"
repo
"
\
"
fixedRateSchedule
"
\
"
initialValue
"
)
.head
}
)
}
</fpml:initialValue>
<fpml:initialValue>
{
get
(
source
\
"
trade
"
\
"
repo
"
\
"
fixedRateSchedule
"
\
"
initialValue
"
)
}
</fpml:initialValue>
<step>
<step>
<stepDate>
{
get
(
Try
{
(
source
\
"
trade
"
\
"
repo
"
\
"
fixedRateSchedule
"
\\
"
stepDate
"
)
.head
}
)
}
</stepDate>
<stepDate>
{
get
(
source
\
"
trade
"
\
"
repo
"
\
"
fixedRateSchedule
"
\\
"
stepDate
"
)
}
</stepDate>
<stepValue>
{
get
(
Try
{
(
source
\
"
trade
"
\
"
repo
"
\
"
fixedRateSchedule
"
\\
"
stepValue
"
)
.head
}
)
}
</stepValue>
<stepValue>
{
get
(
source
\
"
trade
"
\
"
repo
"
\
"
fixedRateSchedule
"
\\
"
stepValue
"
)
}
</stepValue>
</step>
</step>
</fpmlext:fixedRateSchedule>
</fpmlext:fixedRateSchedule>
<fpmlext:floatingRateCalculation>
<fpmlext:floatingRateCalculation>
<fpml:floatingRateIndex>
{
get
(
Try
{
(
source
\
"
trade
"
\
"
repo
"
\
"
floatingRateCalculation
"
\
"
floatingRateIndex
"
)
.head
}
)
}
</fpml:floatingRateIndex>
<fpml:floatingRateIndex>
{
get
(
source
\
"
trade
"
\
"
repo
"
\
"
floatingRateCalculation
"
\
"
floatingRateIndex
"
)
}
</fpml:floatingRateIndex>
<indexTenor>
<indexTenor>
<periodMultiplier>
{
get
(
Try
{
(
source
\
"
trade
"
\
"
repo
"
\
"
floatingRateCalculation
"
\\
"
periodMultiplier
"
)
.head
}
)
}
</periodMultiplier>
<periodMultiplier>
{
get
(
source
\
"
trade
"
\
"
repo
"
\
"
floatingRateCalculation
"
\\
"
periodMultiplier
"
)
}
</periodMultiplier>
<period>
{
get
(
Try
{
(
source
\
"
trade
"
\
"
repo
"
\
"
floatingRateCalculation
"
\\
"
period
"
)
.head
}
)
}
</period>
<period>
{
get
(
source
\
"
trade
"
\
"
repo
"
\
"
floatingRateCalculation
"
\\
"
period
"
)
}
</period>
</indexTenor>
</indexTenor>
<spreadSchedule>
<spreadSchedule>
<initialValue>
{
get
(
Try
{
(
source
\
"
trade
"
\
"
repo
"
\
"
floatingRateCalculation
"
\\
"
initialValue
"
)
.head
}
)
}
</initialValue>
<initialValue>
{
get
(
source
\
"
trade
"
\
"
repo
"
\
"
floatingRateCalculation
"
\\
"
initialValue
"
)
}
</initialValue>
</spreadSchedule>
</spreadSchedule>
<initialRate>
{
get
(
Try
{
(
source
\
"
trade
"
\
"
repo
"
\
"
floatingRateCalculation
"
\\
"
initialRate
"
)
.head
}
)
}
</initialRate>
<initialRate>
{
get
(
source
\
"
trade
"
\
"
repo
"
\
"
floatingRateCalculation
"
\\
"
initialRate
"
)
}
</initialRate>
</fpmlext:floatingRateCalculation>
</fpmlext:floatingRateCalculation>
<fpmlext:dayCountFraction>
{
get
(
Try
{
(
source
\
"
trade
"
\
"
repo
"
\
"
dayCountFraction
"
)
.head
}
)
}
</fpmlext:dayCountFraction>
<fpmlext:dayCountFraction>
{
get
(
source
\
"
trade
"
\
"
repo
"
\
"
dayCountFraction
"
)
}
</fpmlext:dayCountFraction>
<fpmlext:spotLeg
xsi:
type
=
"rtsrep:RepoTransactionLeg"
>
<fpmlext:spotLeg
xsi:
type
=
"rtsrep:RepoTransactionLeg"
>
<
fpml
:
buyerPartyReference
href
={
get
(
Try
{
(
source
\
"trade"
\
"repo"
\
"spotLeg"
\
"buyerPartyReference"
).
head
}
,
"href"
)
}
/>
<
fpml
:
buyerPartyReference
href
={
get
(
source
\
"trade"
\
"repo"
\
"spotLeg"
\
"buyerPartyReference"
,
"href"
)
}
/>
<
fpml
:
sellerPartyReference
href
={
get
(
Try
{
(
source
\
"trade"
\
"repo"
\
"spotLeg"
\
"sellerPartyReference"
).
head
}
,
"href"
)
}
/>
<
fpml
:
sellerPartyReference
href
={
get
(
source
\
"trade"
\
"repo"
\
"spotLeg"
\
"sellerPartyReference"
,
"href"
)
}
/>
<
fpmlext
:
settlementDate>
<
fpmlext
:
settlementDate>
<fpml:adjustableDate>
<fpml:adjustableDate>
<fpml:unadjustedDate>
{
get
(
Try
{
(
source
\
"
trade
"
\
"
repo
"
\
"
spotLeg
"
\\
"
unadjustedDate
"
)
.head
}
)
}
</fpml:unadjustedDate>
<fpml:unadjustedDate>
{
get
(
source
\
"
trade
"
\
"
repo
"
\
"
spotLeg
"
\\
"
unadjustedDate
"
)
}
</fpml:unadjustedDate>
</fpml:adjustableDate>
</fpml:adjustableDate>
</fpmlext:settlementDate>
</fpmlext:settlementDate>
<fpml:settlementAmount>
<fpml:settlementAmount>
<fpml:currency>
{
get
(
Try
{
(
source
\
"
trade
"
\
"
repo
"
\
"
spotLeg
"
\\
"
currency
"
)
.head
}
)
}
</fpml:currency>
<fpml:currency>
{
get
(
source
\
"
trade
"
\
"
repo
"
\
"
spotLeg
"
\\
"
currency
"
)
}
</fpml:currency>
<fpml:amount>
{
get
(
Try
{
(
source
\
"
trade
"
\
"
repo
"
\
"
spotLeg
"
\\
"
amount
"
)
.head
}
)
}
</fpml:amount>
<fpml:amount>
{
get
(
source
\
"
trade
"
\
"
repo
"
\
"
spotLeg
"
\\
"
amount
"
)
}
</fpml:amount>
</fpml:settlementAmount>
</fpml:settlementAmount>
{
/*
{
/*
<fpmlext:collateral
xsi:
type
=
"
rtsrep:CollateralValuation
"
>
<fpmlext:collateral
xsi:
type
=
"
rtsrep:CollateralValuation
"
>
...
@@ -161,16 +161,16 @@ class RepoTemplate(source: Node) extends TradeTemplate(source) {
...
@@ -161,16 +161,16 @@ class RepoTemplate(source: Node) extends TradeTemplate(source) {
*/
}
*/
}
</
fpmlext
:
spotLeg>
</
fpmlext
:
spotLeg>
<fpmlext:forwardLeg
xsi:
type
=
"rtsrep:ForwardRepoTransactionLeg"
>
<fpmlext:forwardLeg
xsi:
type
=
"rtsrep:ForwardRepoTransactionLeg"
>
<
fpml
:
buyerPartyReference
href
={
get
(
Try
{
(
source
\
"trade"
\
"repo"
\
"forwardLeg"
\
"buyerPartyReference"
).
head
}
,
"href"
)
}
/>
<
fpml
:
buyerPartyReference
href
={
get
(
source
\
"trade"
\
"repo"
\
"forwardLeg"
\
"buyerPartyReference"
,
"href"
)
}
/>
<
fpml
:
sellerPartyReference
href
={
get
(
Try
{
(
source
\
"trade"
\
"repo"
\
"forwardLeg"
\
"sellerPartyReference"
).
head
}
,
"href"
)
}
/>
<
fpml
:
sellerPartyReference
href
={
get
(
source
\
"trade"
\
"repo"
\
"forwardLeg"
\
"sellerPartyReference"
,
"href"
)
}
/>
<
fpmlext
:
settlementDate>
<
fpmlext
:
settlementDate>
<fpml:adjustableDate>
<fpml:adjustableDate>
<fpml:unadjustedDate>
{
get
(
Try
{
(
source
\
"
trade
"
\
"
repo
"
\
"
forwardLeg
"
\
"
settlementDate
"
\\
"
unadjustedDate
"
)
.head
}
)
}
</fpml:unadjustedDate>
<fpml:unadjustedDate>
{
get
(
source
\
"
trade
"
\
"
repo
"
\
"
forwardLeg
"
\
"
settlementDate
"
\\
"
unadjustedDate
"
)
}
</fpml:unadjustedDate>
</fpml:adjustableDate>
</fpml:adjustableDate>
</fpmlext:settlementDate>
</fpmlext:settlementDate>
<fpml:settlementAmount>
<fpml:settlementAmount>
<fpml:currency>
{
get
(
Try
{
(
source
\
"
trade
"
\
"
repo
"
\
"
forwardLeg
"
\\
"
currency
"
)
.head
}
)
}
</fpml:currency>
<fpml:currency>
{
get
(
source
\
"
trade
"
\
"
repo
"
\
"
forwardLeg
"
\\
"
currency
"
)
}
</fpml:currency>
<fpml:amount>
{
get
(
Try
{
(
source
\
"
trade
"
\
"
repo
"
\
"
forwardLeg
"
\\
"
amount
"
)
.head
}
)
}
</fpml:amount>
<fpml:amount>
{
get
(
source
\
"
trade
"
\
"
repo
"
\
"
forwardLeg
"
\\
"
amount
"
)
}
</fpml:amount>
</fpml:settlementAmount>
</fpml:settlementAmount>
{
/*
{
/*
<rtsrep:deliveryDate>
<rtsrep:deliveryDate>
...
@@ -180,16 +180,16 @@ class RepoTemplate(source: Node) extends TradeTemplate(source) {
...
@@ -180,16 +180,16 @@ class RepoTemplate(source: Node) extends TradeTemplate(source) {
</rtsrep:deliveryDate>
</rtsrep:deliveryDate>
*/
}
*/
}
</fpmlext:forwardLeg>
</fpmlext:forwardLeg>
<fpml:equity
id
={
get
(
Try
{
(
source
\
"trade"
\
"repo"
\
"equity"
).
head
}
,
"id"
)
}>
<fpml:equity
id
={
get
(
source
\
"trade"
\
"repo"
\
"equity"
,
"id"
)
}>
<
fpml
:
instrumentId
instrumentIdScheme
={
get
(
Try
{
(
source
\
"trade"
\
"repo"
\
"equity"
\
"instrumentId"
).
head
},
"instrumentIdScheme"
)
}>{
get
(
Try
{
(
source
\
"trade"
\
"repo"
\
"equity"
\
"instrumentId"
).
head
}
)
}</
fpml
:
instrumentId>
<
fpml
:
instrumentId
instrumentIdScheme
={
get
(
source
\
"trade"
\
"repo"
\
"equity"
\
"instrumentId"
,
"instrumentIdScheme"
)
}>{
get
(
source
\
"trade"
\
"repo"
\
"equity"
\
"instrumentId"
)
}</
fpml
:
instrumentId>
</fpml:equity>
</fpml:equity>
<fpml:bond
id
={
get
(
Try
{
(
source
\
"trade"
\
"repo"
\
"bond"
).
head
}
,
"id"
)
}>
<fpml:bond
id
={
get
(
source
\
"trade"
\
"repo"
\
"bond"
,
"id"
)
}>
<
fpml
:
instrumentId
instrumentIdScheme
={
get
(
Try
{
(
source
\
"trade"
\
"repo"
\
"bond"
\
"instrumentId"
).
head
},
"instrumentIdScheme"
)
}>{
get
(
Try
{
(
source
\
"trade"
\
"repo"
\
"bond"
\
"instrumentId"
).
head
}
)
}</
fpml
:
instrumentId>
<
fpml
:
instrumentId
instrumentIdScheme
={
get
(
source
\
"trade"
\
"repo"
\
"bond"
\
"instrumentId"
,
"instrumentIdScheme"
)
}>{
get
(
source
\
"trade"
\
"repo"
\
"bond"
\
"instrumentId"
)
}</
fpml
:
instrumentId>
</fpml:bond>
</fpml:bond>
</fpmlext:repo>
</fpmlext:repo>
<fpml:documentation>
<fpml:documentation>
<fpml:masterAgreement>
<fpml:masterAgreement>
<fpml:masterAgreementId>
{
get
(
Try
{
(
source
\
"
trade
"
\
"
tradeHeader
"
\
"
partyTradeIdentifier
"
\
"
linkId
"
)
.head
}
)
}
</fpml:masterAgreementId>
<fpml:masterAgreementId>
{
get
(
source
\
"
trade
"
\
"
tradeHeader
"
\
"
partyTradeIdentifier
"
\
"
linkId
"
)
}
</fpml:masterAgreementId>
</fpml:masterAgreement>
</fpml:masterAgreement>
</fpml:documentation>
</fpml:documentation>
</fpml:trade>
</fpml:trade>
...
...
src/main/scala/templates/Template.scala
View file @
5a949c6c
...
@@ -7,13 +7,14 @@ import scala.xml._
...
@@ -7,13 +7,14 @@ import scala.xml._
abstract
class
Template
(
protected
[
this
]
val
source
:
Node
)
{
abstract
class
Template
(
protected
[
this
]
val
source
:
Node
)
{
protected
[
this
]
val
msgNotFound
=
"Not found"
protected
[
this
]
val
msgNotFound
=
"Not found"
protected
[
this
]
def
get
(
content
:
Try
[
Node
],
attr
:
String
=
null
)
:
Text
=
content
match
{
protected
[
this
]
def
get
(
content
:
NodeSeq
,
attr
:
String
=
null
,
idx
:
Int
=
0
)
:
Text
=
case
Success
(
v
)
if
attr
!=
null
=>
v
.
attribute
(
attr
)
match
{
Try
{
content
(
idx
)
}
match
{
case
None
=>
Text
(
msgNotFound
)
case
Success
(
v
)
if
attr
!=
null
=>
v
.
attribute
(
attr
)
match
{
case
o
=>
Text
(
o
.
get
.
text
)
case
None
=>
Text
(
msgNotFound
)
}
case
o
=>
Text
(
o
.
get
.
text
)
case
Success
(
v
)
=>
Text
(
v
.
text
)
}
case
_
=>
Text
(
msgNotFound
)
case
Success
(
v
)
=>
Text
(
v
.
text
)
case
_
=>
Text
(
msgNotFound
)
}
}
def
template
:
Node
def
template
:
Node
...
...
src/main/scala/templates/TradeTemplate.scala
View file @
5a949c6c
...
@@ -13,23 +13,23 @@ abstract class TradeTemplate(source: Node) extends Template(source) {
...
@@ -13,23 +13,23 @@ abstract class TradeTemplate(source: Node) extends Template(source) {
xmlns
:
fpmlext
=
"http://www.fpml.org/FpML-5/ext"
xmlns
:
rtsrep
=
"http://www.fpml.ru/repository"
xmlns
:
fpmlext
=
"http://www.fpml.org/FpML-5/ext"
xmlns
:
rtsrep
=
"http://www.fpml.ru/repository"
xmlns
:
xsi
=
"http://www.w3.org/2001/XMLSchema-instance"
fpmlVersion
=
"5-7"
>
xmlns
:
xsi
=
"http://www.w3.org/2001/XMLSchema-instance"
fpmlVersion
=
"5-7"
>
<
fpml
:
header>
<
fpml
:
header>
<fpml:messageId>
{
get
(
Try
{
(
source
\
"
header
"
\
"
messageId
"
)
.head
}
)
}
</fpml:messageId>
<fpml:messageId>
{
get
(
source
\
"
header
"
\
"
messageId
"
)
}
</fpml:messageId>
<fpml:sentBy>
{
get
(
Try
{
(
source
\
"
header
"
\
"
sentBy
"
)
.head
}
)
}
</fpml:sentBy>
<fpml:sentBy>
{
get
(
source
\
"
header
"
\
"
sentBy
"
)
}
</fpml:sentBy>
<fpml:sendTo>
{
get
(
Try
{
(
source
\
"
header
"
\
"
sendTo
"
)
.head
}
)
}
</fpml:sendTo>
<fpml:sendTo>
{
get
(
source
\
"
header
"
\
"
sendTo
"
)
}
</fpml:sendTo>
<fpml:creationTimestamp>
{
get
(
Try
{
(
source
\
"
header
"
\
"
creationTimestamp
"
)
.head
}
)
}
</fpml:creationTimestamp>
<fpml:creationTimestamp>
{
get
(
source
\
"
header
"
\
"
creationTimestamp
"
)
}
</fpml:creationTimestamp>
<fpml:implementationSpecification>
<fpml:implementationSpecification>
<fpml:version>
2
</fpml:version>
<fpml:version>
2
</fpml:version>
</fpml:implementationSpecification>
</fpml:implementationSpecification>
</fpml:header>
</fpml:header>
<fpml:isCorrection>
{
get
(
Try
{
(
source
\
"
isCorrection
"
)
.head
}
)
}
</fpml:isCorrection>
<fpml:isCorrection>
{
get
(
source
\
"
isCorrection
"
)
}
</fpml:isCorrection>
<fpml:correlationId
correlationIdScheme
=
""
>{
get
(
Try
{
(
source
\
"correlationId"
).
head
}
)
}</
fpml
:
correlationId>
<fpml:correlationId
correlationIdScheme
=
""
>{
get
(
source
\
"correlationId"
)
}</
fpml
:
correlationId>
{
templateTrade
}
{
templateTrade
}
{
for
(
s
<-
source
\
"
party
"
)
yield
{
{
for
(
s
<-
source
\
"
party
"
)
yield
{
<fpml:party
id
={
get
(
Try
{
s.head
}
,
"
id
"
)
}
>
<fpml:party
id
={
get
(
s
,
"
id
"
)
}
>
<fpml:partyId
partyIdScheme
={
get
(
Try
{
(
s
\
"partyId"
).
head
},
"partyIdScheme"
)
}>{
get
(
Try
{
(
s
\
"partyId"
).
head
}
)
}</
fpml
:
partyId>
<fpml:partyId
partyIdScheme
={
get
(
s
\
"partyId"
,
"partyIdScheme"
)
}>{
get
(
s
\
"partyId"
)
}</
fpml
:
partyId>
<fpml:partyName>
{
get
(
Try
{
(
s
\
"
partyName
"
)
.head
}
)
}
</fpml:partyName>
<fpml:partyName>
{
get
(
s
\
"
partyName
"
)
}
</fpml:partyName>
<fpml:country>
{
get
(
Try
{
(
s
\
"
country
"
)
.head
}
)
}
</fpml:country>
<fpml:country>
{
get
(
s
\
"
country
"
)
}
</fpml:country>
<fpml:organizationType>
{
get
(
Try
{
(
s
\
"
classification
"
)
.head
}
)
}
</fpml:organizationType>
<fpml:organizationType>
{
get
(
s
\
"
classification
"
)
}
</fpml:organizationType>
</fpml:party>
</fpml:party>
}
}
}
}
...
...
src/test/scala/templates/TemplateSpec.scala
View file @
5a949c6c
...
@@ -3,7 +3,6 @@ package templates
...
@@ -3,7 +3,6 @@ package templates
import
org.scalatest._
import
org.scalatest._
import
xmlvalid._
import
xmlvalid._
import
scala.util.Try
import
scala.xml.
{
Elem
,
Node
,
XML
}
import
scala.xml.
{
Elem
,
Node
,
XML
}
class
TemplateSpec
extends
WordSpec
{
class
TemplateSpec
extends
WordSpec
{
...
@@ -49,30 +48,30 @@ class TemplateSpec extends WordSpec {
...
@@ -49,30 +48,30 @@ class TemplateSpec extends WordSpec {
xsi
:
schemaLocation
=
"https://www.w3schools.com test_valid.xsd"
>
xsi
:
schemaLocation
=
"https://www.w3schools.com test_valid.xsd"
>
<
nonpublicExecutionReport
>
<
nonpublicExecutionReport
>
<
trade
>
<
trade
>
<
tradeHeader
>{
get
(
Try
{
(
source
\\
"tradeHeader"
).
head
}
)
}</
tradeHeader
>
<
tradeHeader
>{
get
(
source
\\
"tradeHeader"
)
}</
tradeHeader
>
<
repo
>
<
repo
>
<
title
>{
get
(
Try
{
(
source
\\
"repo"
\
"title"
).
head
}
)
}</
title
>
<
title
>{
get
(
source
\\
"repo"
\
"title"
)
}</
title
>
<
from
href
={
get
(
Try
{
(
source
\\
"repo"
\
"from"
).
head
}
,
"href"
)
}>
<
from
href
={
get
(
source
\\
"repo"
\
"from"
,
"href"
)
}>
{
get
(
Try
{
(
source
\\
"repo"
\
"from"
).
head
}
)
}
{
get
(
source
\\
"repo"
\
"from"
)
}
</
from
>
</
from
>
<
to
href
={
get
(
Try
{
(
source
\\
"repo"
\
"to"
).
head
}
,
"href"
)
}>
<
to
href
={
get
(
source
\\
"repo"
\
"to"
,
"href"
)
}>
{
get
(
Try
{
(
source
\\
"repo"
\
"notExist"
).
head
}
)
}
{
get
(
source
\\
"repo"
\
"notExist"
)
}
</
to
>
</
to
>
</
repo
>
</
repo
>
<
notFoundpart
>{
get
(
Try
{
(
source
\\
"notFoundpart"
).
head
}
)
}</
notFoundpart
>
<
notFoundpart
>{
get
(
source
\\
"notFoundpart"
)
}</
notFoundpart
>
<
notFoundpartNested1
>
<
notFoundpartNested1
>
<
noElem
>{
get
(
Try
{
(
source
\\
"notFoundpartNested1"
\
"noElem"
).
head
}
)
}</
noElem
>
<
noElem
>{
get
(
source
\\
"notFoundpartNested1"
\
"noElem"
)
}</
noElem
>
<
noAttr
href
={
get
(
Try
{
(
source
\\
"notFoundpartNested1"
\
"noAttr"
).
head
}
,
"href"
)
}
/>
<
noAttr
href
={
get
(
source
\\
"notFoundpartNested1"
\
"noAttr"
,
"href"
)
}
/>
<
noAttrAndElem
href
={
get
(
Try
{
(
source
\\
"notFoundpartNested1"
\
"noAttrAndElem"
).
head
}
,
"href"
)
}>
<
noAttrAndElem
href
={
get
(
source
\\
"notFoundpartNested1"
\
"noAttrAndElem"
,
"href"
)
}>
{
get
(
Try
{
(
source
\\
"notFoundpartNested1"
\
"noAttrAndElem"
).
head
}
)
}
{
get
(
source
\\
"notFoundpartNested1"
\
"noAttrAndElem"
)
}
</
noAttrAndElem
>
</
noAttrAndElem
>
</
notFoundpartNested1
>
</
notFoundpartNested1
>
<
notFoundpartNested2
>
<
notFoundpartNested2
>
<
notFoundPartNested21
>
<
notFoundPartNested21
>
<
noElem
>{
get
(
Try
{
(
source
\\
"notFoundpartNested21"
\
"noElem"
).
head
}
)
}</
noElem
>
<
noElem
>{
get
(
source
\\
"notFoundpartNested21"
\
"noElem"
)
}</
noElem
>
<
noAttr
href
={
get
(
Try
{
(
source
\\
"notFoundpartNested21"
\
"noAttr"
).
head
}
,
"href"
)
}
/>
<
noAttr
href
={
get
(
source
\\
"notFoundpartNested21"
\
"noAttr"
,
"href"
)
}
/>
<
noAttrAndElem
href
={
get
(
Try
{
(
source
\\
"notFoundpartNested21"
\
"noAttrAndElem"
).
head
}
,
"href"
)
}>
<
noAttrAndElem
href
={
get
(
source
\\
"notFoundpartNested21"
\
"noAttrAndElem"
,
"href"
)
}>
{
get
(
Try
{
(
source
\\
"notFoundpartNested21"
\
"noAttrAndElem"
).
head
}
)
}
{
get
(
source
\\
"notFoundpartNested21"
\
"noAttrAndElem"
)
}
</
noAttrAndElem
>
</
noAttrAndElem
>
</
notFoundPartNested21
>
</
notFoundPartNested21
>
</
notFoundpartNested2
>
</
notFoundpartNested2
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment