<!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=orderMeal&baRequest=true&continue=ordermeal.jsp" method="post">
        <fieldset class="medium">
            <legend>orderMeal()</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="reservation">Reservation number</label>
                <input type="text" name="parameters"/>
            </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">cancelMeal</span>",<br>
&#09;type=DataMatch.<span class="enum">CUSTOM</span>,<br>
&#09;mode=ExecutionMode.<span class="enum">EJB</span>)<br>
public MealOrder orderMeal(<span class="annotation">@BAParam</span>("<span class="id">user</span>")String username,<br>
&#09;<span class="annotation">@BAParam</span>("<span class="id">password</span>")String password, Integer reservationNumber)<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">order</span>",orderId);<br>
&#09;//...<br>
}
</pre>
    </div>

</p>


<p>
</p>

<p align="left">
    <b>Service description</b>
    <br>
    This service books a given number of Fitness Passes for the given reservation. It must be executed within a Business
    Activity.<br>
    This service requires following parameters:
    <ul align="left">
        <li>Username
        <li>Password
        <li>Reservation Number
    </ul>
</p>
<p align="left">
    It throws following exceptions:
    <ul align="left">
        <li>HotelCustomException
    </ul>
</p>
<p align="left">
    HotelCustomException is thrown if either the user cannot log in (username, password or both are incorrect)
    or the reservation number is incorrect (reservation does not exist).
</p>

<p align="left">
    This service returns:
    <ul align="left">
        <li>Complex object representing a meal order
    </ul>
</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=cancelmeal.jsp">cancelMeal()</a>
</p>

</div>


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

</div>

</body>
</html>