diff options
Diffstat (limited to 'sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_properties.xq')
-rw-r--r-- | sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_properties.xq | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_properties.xq b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_properties.xq new file mode 100644 index 0000000000..62275b41f8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_properties.xq @@ -0,0 +1,48 @@ +declare namespace quoteJoin="scaservice:java/xquery.quote.PropertiesQuoteJoin"; + +declare namespace quoteCalculator="scareference:java/xquery.quote.QuoteCalculator"; + +declare namespace priceQuoteDoc="scaproperty:xml/http://www.example.org/price:priceQuote"; +declare namespace availQuoteDoc="scaproperty:xml/http://www.example.org/avail:availQuote"; +declare namespace taxRate="scaproperty:java/java.lang.Float"; + +declare variable $quoteCalculator external; + +declare variable $priceQuoteDoc external; +declare variable $availQuoteDoc external; +declare variable $taxRate external; + +declare function quoteJoin:joinPriceAndAvailQuotes() { +<quote> + <name>{ data($priceQuoteDoc/priceQuote/customerName) }</name> + <address>{ concat($priceQuoteDoc/priceQuote/shipAddress/@street , ",", $priceQuoteDoc/priceQuote/shipAddress/@city ,",", fn:upper-case($priceQuoteDoc/priceQuote/shipAddress/@state) , ",", $priceQuoteDoc/priceQuote/shipAddress/@zip) }</address> + { + for $priceRequest in $priceQuoteDoc/priceQuote/priceRequests/priceRequest, + $availRequest in $availQuoteDoc/availQuote/availRequest + where data($priceRequest/widgetId) = data($availRequest/widgetId) + return + <quoteResponse> + <widgetId>{ data($priceRequest/widgetId) }</widgetId> + <unitPrice>{ data($priceRequest/price) }</unitPrice> + <requestedQuantity>{ data($availRequest/requestedQuantity) }</requestedQuantity> + <fillOrder>{ data($availRequest/quantityAvail) }</fillOrder> + { + for $shipDate in $availRequest/shipDate + return + <shipDate>{ data($shipDate) }</shipDate> + } + <taxRate>{ $taxRate }</taxRate> + <totalCost>{ quoteCalculator:calculateTotalPrice( + $quoteCalculator, + + $taxRate, + + $availRequest/requestedQuantity, + + $priceRequest/price, + + $availRequest/quantityAvail) }</totalCost> + </quoteResponse> + } + </quote> +};
\ No newline at end of file |