Commit f75aa9ff by Amelin Konstantin

Change Main. Add dynamically formed output file name.

parent 26fae532
...@@ -16,8 +16,9 @@ object Main extends App { ...@@ -16,8 +16,9 @@ object Main extends App {
} }
} }
val sourceName = "Repo NSD bond"
val p = new PrettyPrinter(140, 2) val p = new PrettyPrinter(140, 2)
val sourceXml = XML.loadFile("src/main/resources/nsd/Repo Client equity.xml") val sourceXml = XML.loadFile("src/main/resources/nsd/" + sourceName + ".xml")
val template = Template(sourceXml) val template = Template(sourceXml)
val outputXml = XML.loadString(p.format(template.render)) val outputXml = XML.loadString(p.format(template.render))
//val outputXml = template.template //val outputXml = template.template
...@@ -38,6 +39,6 @@ object Main extends App { ...@@ -38,6 +39,6 @@ object Main extends App {
case Failure(ex) => println(s"Output xml isn`t wellformed or invalid: ${ex.getMessage}") case Failure(ex) => println(s"Output xml isn`t wellformed or invalid: ${ex.getMessage}")
} }
XML.save("output/Output repo RTS.xml", outputXml, xmlDecl = true) XML.save("output/" + sourceName + "_RTS.xml", outputXml, xmlDecl = true)
} }
...@@ -44,7 +44,7 @@ abstract class TradeTemplate(source: Node) extends Template(source) { ...@@ -44,7 +44,7 @@ abstract class TradeTemplate(source: Node) extends Template(source) {
<fpml:executionDateTime>{ get(source \ "trade" \ "tradeHeader" \ "tradeDate") + "T00:00:00" }</fpml:executionDateTime> <fpml:executionDateTime>{ get(source \ "trade" \ "tradeHeader" \ "tradeDate") + "T00:00:00" }</fpml:executionDateTime>
<fpml:reportingRegime> <fpml:reportingRegime>
<fpml:name>{ get(source \ "trade" \ "tradeHeader" \ "partyTradeInformation" \ "reportingRegime" \ "name") }</fpml:name> <fpml:name>{ get(source \ "trade" \ "tradeHeader" \ "partyTradeInformation" \ "reportingRegime" \ "name") }</fpml:name>
<fpml:mandatorilyClearable>{ if (get(source \ "trade" \ "nsdSpecificTradeFields" \ "cleared").mkString.contains("Y")) "true" else "" }</fpml:mandatorilyClearable> <fpml:mandatorilyClearable>{ if (get(source \ "trade" \ "nsdSpecificTradeFields" \ "cleared").mkString.contains("Y")) "true" else msgNotFound }</fpml:mandatorilyClearable>
</fpml:reportingRegime> </fpml:reportingRegime>
</fpml:partyTradeInformation> </fpml:partyTradeInformation>
{ for (s <- source \ "trade" \ "nsdSpecificTradeFields" \ "clientDetails") yield { { for (s <- source \ "trade" \ "nsdSpecificTradeFields" \ "clientDetails") yield {
...@@ -80,10 +80,10 @@ abstract class TradeTemplate(source: Node) extends Template(source) { ...@@ -80,10 +80,10 @@ abstract class TradeTemplate(source: Node) extends Template(source) {
</fpml:timestamps> </fpml:timestamps>
<fpml:collateralizationType>{ <fpml:collateralizationType>{
get(source \ "trade" \ "collateral" \ "marginType").mkString match { get(source \ "trade" \ "collateral" \ "marginType").mkString match {
case v if v == "FC" => "Fully" case "FC" => "Fully"
case v if v == "PC" => "Partially" case "PC" => "Partially"
case v if v == "OC" => "OneWay" case "OC" => "OneWay"
case v if v == "U" => "Uncollateralized" case "U" => "Uncollateralized"
case _ => msgNotFound case _ => msgNotFound
} }
}</fpml:collateralizationType> }</fpml:collateralizationType>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment