<?xml version="1.0" encoding="UTF-8"?>
<process xmlns:blue="http://www.e-marson.com/bluelemon">
<descriptor>
<name>com/emarson/lemonade/examples/mobank/moaccount/Validate</name>
<version>1.0</version>
<description>
This is the action invoked when user is trying to continue
after filling the TransferScreen text fields required to do the transfer:
ammount of money to send and a target account number.
This action:
- reads the values of the text fields,
- if any of them is empty, shows the warning alert and returns,
- otherwise forwards the processing to the DownloadingScreen
</description>
<vendor>E-MARSON</vendor>
</descriptor>
<path>
<action name="read data, verify and continue">
<type>general/bluelemon/code</type>
<definition resultTo="result">
<blue:call manager="GeneralManager" method="getCurrent"
toVariable="form"
castTo="com/emarson/lemonade/bluelemon/midp1/Form"/>
<blue:call object="form" method="getItem"
toVariable="ammountField"
castTo="com/emarson/lemonade/bluelemon/midp1/TextField">
<blue:argument type="byte" value="0"/>
</blue:call>
<blue:call object="ammountField" method="getString"
toVariable="ammountString"/>
<blue:call object="form" method="getItem"
toVariable="targetAccountField"
castTo="com/emarson/lemonade/bluelemon/midp1/TextField">
<blue:argument type="byte" value="1"/>
</blue:call>
<blue:call object="targetAccountField" method="getString"
toVariable="targetAccountString"/>
<blue:call manager="UtilsManager" method="length"
toVariable="ammountStringLength">
<blue:argument type="variable" name="ammountString"/>
</blue:call>
<blue:call manager="UtilsManager" method="length"
toVariable="targetAccountStringLength">
<blue:argument type="variable" name="targetAccountString"/>
</blue:call>
<blue:call manager="UtilsManager" method="=="
toVariable="ammountStringIsEmpty">
<blue:argument type="variable" name="ammountStringLength"/>
<blue:argument type="byte" value="0"/>
</blue:call>
<blue:call manager="UtilsManager" method="=="
toVariable="targetAccountStringIsEmpty">
<blue:argument type="variable" name="targetAccountStringLength"/>
<blue:argument type="byte" value="0"/>
</blue:call>
<blue:call manager="UtilsManager" method="OR"
toVariable="anyStringIsEmpty">
<blue:argument type="variable" name="ammountStringIsEmpty"/>
<blue:argument type="variable" name="targetAccountStringIsEmpty"/>
</blue:call>
<blue:if isTrue="anyStringIsEmpty">
<blue:newInstance module="com/emarson/lemonade/bluelemon/midp1/Alert"
toVariable="alert"/>
<blue:call object="alert" method="initialize">
<blue:argument type="String" value="Incorrect data"/>
<blue:argument type="String" value="All fields must be filled in."/>
<blue:argument type="byte" value="AlertType.WARNING"/>
<blue:argument type="short" value="1500"/>
</blue:call>
<blue:call manager="GeneralManager" method="setCurrent">
<blue:argument type="variable" name="alert"/>
</blue:call>
<blue:return/>
</blue:if>
<blue:call manager="UtilsManager" method="stringToNumber"
toVariable="ammount">
<blue:argument type="variable" name="ammountString"/>
<blue:argument type="byte" value="4"/>
</blue:call>
<blue:call node="com/emarson/lemonade/examples/mobank/moaccount/DownloadingScreen"
location="@com/emarson/lemonade/examples/mobank/moaccount">
<blue:argument type="variable" name="ammount"/>
<blue:argument type="variable" name="targetAccountString"/>
</blue:call>
</definition>
</action>
<finish name="done">
<return>result</return>
</finish>
</path>
</process>