Friday, September 25, 2020

for-each activity in SOA

 

For each activity

 

 

Major Parts 

1. Activity Name

Simple name of the activity, does not play any major role in the processing of the component.  

2.Counter Name

This is the self increased counter value,which keep on increasing once we do it for   

3.Start Value

This is the value of the counter when the activity is initiated, this is decided on run-time. You can have a static value here too. 

4.End Value

 This is the final value of the counter, where loop terminate.  

5.Completion condition

Not mandatory but it will provide the  condition which will be considered as a completion of the activity.  

Parallel flow will give an indication to execution engine, if activity has to run in parallel or sequential. 






XSLT:

Global declaration:

<xsl:param name="InvokeStoreId_Select_OutputVariable.LocationInfoCollection"/>

  <xsl:param name="forEachCountervalue"/> 

Call functions:

<xsl:call-template name="rtl_loc_id_template">

        <xsl:with-param name="forEachCountervalue" select="$forEachCountervalue"/>

      </xsl:call-template>

Called functions:

<xsl:template name="rtl_loc_id_template">

    <xsl:param name="forEachCountervalue"/>

    <xsl:param name="index" select="1"/>

    <xsl:param name="total" select="50"/>

    <xsl:if test="$InvokeStoreId_Select_OutputVariable.LocationInfoCollection/ns1:LocationInfoCollection/ns1:pLocationInfo[$index + (($forEachCountervalue - 1) * 50)]/ns1:locationId/text()">

      <tns:rtl_loc_id>

        <xsl:value-of select="$InvokeStoreId_LOCATION_INFOSelect_OutputVariable.LocationInfoCollection/ns1:LocationInfoCollection/ns1:LocationInfo[$index + (($forEachCountervalue - 1) * 50)]/ns1:locationId"/>

      </tns:rtl_loc_id>

    </xsl:if>

    <xsl:if test="not($index = $total)">

      <xsl:call-template name="rtl_loc_id_template">

        <xsl:with-param name="index" select="$index + 1"/>

        <xsl:with-param name="forEachCountervalue" select="$forEachCountervalue"/>

      </xsl:call-template> 

We can create variable in transformation:

StoreBatchSize


  Declaration:

<xsl:param name="InvokeStoreId_LOCATION_INFOSelect_OutputVariable.LocationInfoCollection"/>

  <xsl:param name="forEachCountervalue"/>

  <xsl:param name="StoreBatchSize"/>

 

To check each index of 50:

Function declaration:

<xsl:call-template name="rtl_loc_id_template">

        <xsl:with-param name="forEachCountervalue" select="$forEachCountervalue"/>

      </xsl:call-template>

Function definition:

<xsl:template name="rtl_loc_id_template">

    <xsl:param name="forEachCountervalue"/>

    <xsl:param name="index" select="1"/>

    <xsl:param name="total" select="$StoreBatchSize"/>

    <xsl:if test="$InvokeStoreId_LOCATION_INFOSelect_OutputVariable.LocationInfoCollection/ns1:LocationInfoCollection/ns1:LocationInfo[$index + (($forEachCountervalue - 1) * $StoreBatchSize)]/ns1:locationId/text()">

      <tns:rtl_loc_id>

        <xsl:value-of select="$InvokeStoreId_LOCATION_INFOSelect_OutputVariable.LocationInfoCollection/ns1:LocationInfoCollection/ns1:LocationInfo[$index + (($forEachCountervalue - 1) * $StoreBatchSize)]/ns1:locationId"/>

      </tns:rtl_loc_id>

    </xsl:if>

    <xsl:if test="not($index = $total)">

      <xsl:call-template name="rtl_loc_id_template">

        <xsl:with-param name="index" select="$index + 1"/>

        <xsl:with-param name="forEachCountervalue" select="$forEachCountervalue"/>

      </xsl:call-template>

    </xsl:if>

  </xsl:template>

From update date and to update date:  it should take one day before: 

<xsl:choose>

        <xsl:when test="/ns0:TransactionRequest/ns0:from_update_date/text()">

          <tns:from_update_date>

            <xsl:value-of select="/ns0:TransactionRequest/ns0:from_update_date"/>

          </tns:from_update_date>

        </xsl:when>

        <xsl:when test="/ns0:TransactionRequest/ns0:Source='ESS_SCHEDULE'">

          <tns:from_update_date>

            <xsl:call-template name="XDaysMinus"/>

          </tns:from_update_date>

        </xsl:when>

        <xsl:otherwise>

          <tns:from_update_date></tns:from_update_date>

        </xsl:otherwise>

      </xsl:choose> 

<xsl:template name="XDaysMinus">

    <xsl:variable name="vToday" select="xp20:current-dateTime()"/>

    <xsl:variable name="vXday" select="xp20:subtract-dayTimeDuration-from-dateTime($vToday,'P1D')"/>

    <xsl:variable name="vXdayFormated" select="xp20:format-dateTime($vXday, '[M01]-[D01]-[Y0001]')"/>

    <xsl:value-of select="$vXdayFormated"/>

  </xsl:template>

 

No comments:

Post a Comment

SOA Overview Part-1

  Middleware It provides a mechanism for the process to interact with other processes running on multiple network machines. Advantages...