<!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>
    </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=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=bookRoom&baRequest=true&continue=bookroom.jsp" method="post">
            <fieldset class="medium">
                <legend>bookRoom()</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">Room number</label>
                    <input type="text" name="parameters" value="1"/>
                </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>Method's signature</b><br>

        <div id="code">

<pre>
@WebMethod<br>
<span class="annotation">@BAService</span>(BAServiceType.<span class="enum">MODIFY</span>,BAAgreementType.<span
        class="enum">PARTICIPANT_COMPLETION</span>)<br>
<span class="annotation">@BACompensatedBy</span>(value="<span class="id">cancelRoom</span>",<br>
&#09;type=BACompensationType.<span class="enum">CUSTOM</span>,<br>
&#09;mode=BACompensationMode.<span class="enum">EJB</span>)<br>
<span class="annotation">@BAResult</span>("<span class="id">reservationNumber</span>")<br>
public Integer bookRoom(<span class="annotation">@BAParam</span>("<span
        class="id">username</span>")String username,<span class="annotation">@BAParam</span>("<span
        class="id">password</span>")<br>
String password, Integer roomNumber)<br>
<br>
throws HotelCustomException, RoomAlreadyOccupiedException
</pre>

        </div>

    </p>

    <p>
    </p>

    <p align="left">
        <b>Service description</b>
        <br>
        This service books a single hotel room. It must be executed within a Business Activity. It also remembers a
        refundValue so that if the booking is cancelled within a scope of a Business Activity then the customer does not
        loose all the money.<br>
        This service takes following parameters:
        <ul align="left">
            <li>Username
            <li>Password
            <li>Room Number
        </ul>
    </p>
    <p align="left">
        This service returns:
        <ul align="left">
            <li>Reservation number
        </ul>
    </p>
    <p align="left">
        It throws following exceptions:
        <ul align="left">
            <li>HotelCustomException
            <li>RoomAlreadyOccupiedException
        </ul>
    </p>
    <p align="left">
        HotelCustomException is thrown if either the user cannot log in (username, password or both are incorrect)
        or the room number is incorrect (room does not exist). If the user wants to book a room that is already
        occupied then RoomAlreadyOccupiedException is thrown.
    </p>

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


</div>


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

</div>

</body>
</html>