<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<!--
JBoss, Home of Professional Open Source
Copyright 2007, Red Hat Middleware LLC, and individual contributors
as indicated by the @author tags.
See the copyright.txt in the distribution for a full listing
of individual contributors.
This copyrighted material is made available to anyone wishing to use,
modify, copy, or redistribute it subject to the terms and conditions
of the GNU General Public License, v. 2.0.
This program is distributed in the hope that it will be useful, but WITHOUT A
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.  See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License,
v. 2.0 along with this distribution; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA  02110-1301, USA.

(C) 2007,
@author JBoss Inc.
-->

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Business Activity Framework Demo Application</title>
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-2">
    <meta http-equiv="content-language" content="en">
    <meta name="author" content="Maciej Machulak">
    <link rel="stylesheet" type="text/css" href="green.css"/>
</head>
<body>

<div id="main">

<div id="headerLeft">
    <h1>Business Activity Framework Demo Application</h1>
</div>

<div id="headerRight">
    <img src="jboss.jpg">
</div>

<div id="headerBottom">
    Debug window (service return value):
</div>

<div id="headerDebug">
    ${requestScope.DEBUG}
</div>

${requestScope.ACTIVE}

<div id="menu">
    <p>
        <a href="HotelService?page=index.jsp">Home</a><br>
        <a href="HotelService?page=about.jsp">About Demo Application</a><br>
        <a href="HotelService?page=author.jsp">About Author</a><br>
    </p>
    <hr>
    <p>
        <a href="HotelService?page=initialise.jsp" ${requestScope.INITIALISE}>Initialise data</a><br>
        <a href="HotelService?method=dropHotelData&baRequest=false" ${requestScope.DROP}>Delete data</a><br>
        <a href="HotelService?method=getHotelData&baRequest=false" ${requestScope.SHOW}>Show data</a><br>
        <a href="HotelService?method=getHotelOrders&baRequest=true" ${requestScope.ORDER}>Show orders</a><br>
    </p>
    <hr>
    <p>
        <a href="HotelService?method=startBA&baRequest=true" ${requestScope.BEGIN}>Begin Business Activity</a><br>
    </p>
    <hr>
    <p>
        <b>BA services:</b><br>
        <a href="HotelService?page=hotelinfo.jsp" ${requestScope.BASERVICE}>Hotel Info</a><br>
        <a href="HotelService?page=bookroom.jsp" ${requestScope.BASERVICE}>Book Room</a><br>
        <a href="HotelService?page=getpackage.jsp" ${requestScope.BASERVICE}>Get Package</a><br>
        <a href="HotelService?page=bookfitness.jsp" ${requestScope.BASERVICE}>Book Fitness</a><br>
        <a href="HotelService?page=bookcasino.jsp" ${requestScope.BASERVICE}>Book Casino</a><br>
        <a href="HotelService?page=ordermeal.jsp" ${requestScope.BASERVICE}>Order Meal</a><br>
        <a href="HotelService?page=increaserating.jsp" ${requestScope.BASERVICE}>Increase Rating</a><br>
        <a href="HotelService?page=decreaserating.jsp" ${requestScope.BASERVICE}>Decrease Rating</a><br>
    </p>
    <hr>
    <p>
        <a href="HotelService?method=completeBA&baRequest=true" ${requestScope.COMPLETE}>Complete Business Activity</a><br>
        <a href="HotelService?method=closeBA&baRequest=true" ${requestScope.CLOSE}>Close Business Activity</a><br>
        <a href="HotelService?method=cancelBA&baRequest=true" ${requestScope.CANCEL}>Cancel Business Activity</a><br>
    </p>
    <hr>
    <p>
        <b>Normal services:</b><br>
        <a href="HotelService?page=cancelroom.jsp" ${requestScope.SERVICE}>Cancel Room</a><br>
        <a href="HotelService?page=cancelpackage.jsp" ${requestScope.SERVICE}>Cancel Package</a><br>
        <a href="HotelService?page=cancelfitness.jsp" ${requestScope.SERVICE}>Cancel Fitness</a><br>
        <a href="HotelService?page=cancelcasino.jsp" ${requestScope.SERVICE}>Cancel Casino</a><br>
        <a href="HotelService?page=cancelmeal.jsp" ${requestScope.SERVICE}>Cancel Meal</a><br>
    </p>
    <hr>
</div>


<div id="body" align=center>

<p align="center">

    <form action="HotelService?method=getCasinoToken&baRequest=true&continue=bookcasino.jsp" method="post">
        <fieldset class="medium">
            <legend>getCasinoToken()</legend>

            <p>
                <label for="username">Username</label>
                <input type="text" name="parameters" value="user1"/>
                <br>
                <label for="password">Password</label>
                <input type="text" name="parameters" value="pass1"/>
                <br>
                <label for="room">Money amount</label>
                <input type="text" name="parameters" value="3"/>
            </p>

            <input type="submit" value="Invoke Web Service"/>

        </fieldset>
    </form>

</p>

<p align="left">
    <b>Method's class</b><br>
    com.jboss.ba.demo.service.HotelImpl
</p>

<p align="left">
    <b>Agreement Protocol</b><br>
    Business Agreement With Participant Completion
</p>

<p align="left">
    <b>Method's signature</b><br>

    <div id="code">

<pre>
@WebMethod<br>
<span class="annotation">@BAMethod</span>(AgreementType.<span class="enum">PARTICIPANT_COMPLETION</span>,MethodType.<span class="enum">MODIFY</span>)<br>
<span class="annotation">@BACompensatedBy</span>(value="<span class="id">cancelCasinoToken</span>",<br>
&#09;type=DataMatch.<span class="enum">RETURN_VALUE</span>,<br>
&#09;mode=ExecutionMode.<span class="enum">EJB</span>)<br>
public Integer getCasinoToken(String username, String password, Integer amount)<br>
<br>
throws HotelCustomException
</pre>

    </div>

</p>
<p align="left">
    <b>BA-related code</b>
    <br>

    <div id="code">

<pre>
{
&#09;//...<br>
&#09;dm.<span class="annotation">put</span>("<span class="id">refund</span>",amount/2);<br>
&#09;//...<br>
}
</pre>
    </div>

</p>
<p>
</p>

<p align="left">
    <b>Service description</b>
    <br>
    This service exchanges a given amount of money for a casino token. This token is a unique number meaningless
    for the client but meaningful for the service (represents the exchanged money). It must be executed within a
    Business Activity.<br>
    This service takes following parameters:
    <ul align="left">
        <li>Username
        <li>Password
        <li>Amount of money to exchange for a casino token
    </ul>
</p>
<p align="left">
    This service returns:
    <ul align="left">
        <li>Unique number of a casino token
    </ul>
</p>
<p align="left">
    It throws following exceptions:
    <ul align="left">
        <li>HotelCustomException
    </ul>
</p>
<p align="left">
    HotelCustomException is thrown if the user cannot log in (username, password or both are incorrect).
</p>

<p align="left">
    <b>Agreement Protocol</b><br>
    <a href="HotelService?page=bawpc.jsp">Business Agreement With Participant Completion</a>
</p>

<p align="left">
    <b>Compensation action</b>
    <br>
    <a href="HotelService?page=cancelcasino.jsp">cancelCasinoToken()</a>
</p>

</div>


<div id="footer">
    <p align=right>
        &copy; JBoss, a division of Red Hat
    </p>
</div>

</div>

</body>
</html>