org.strutsme.wishlist.client.adapter
Class WishOnlineAdapter

java.lang.Object
  extended by org.strutsme.wishlist.client.adapter.WishOnlineAdapter
All Implemented Interfaces:
WishAdapter

public final class WishOnlineAdapter
extends java.lang.Object
implements WishAdapter

This interface defines the access to a webserver, which is running with the StrutsME-Server Component.

Author:
lbusmann

Method Summary
static WishAdapter createInstance()
          returns the singletoninstance.
 void deleteWish(java.lang.String wishKey)
          deletes the wish with the key wishKey.
 SafeHashtable getErrors()
          gets errormessages from the last action.
 java.lang.String getLastAction()
          gets the last executed forward of the webserver.
 WishDtoImpl getLoadedWish()
          
 UserDtoImpl getLoadedWishAuthor()
          
 java.util.Vector getLoadedWishes()
          gets the loaded wishes, if the last forward performed by the server was a WlCommonConstants.ACTION_WISH_LIST_WISH.
 SafeHashtable getMessages()
          gets information about the last action.
 java.lang.String getNextAction()
           
 void loadWish(java.lang.String wishId)
          loads the wish and the author of the wish.
 void loadWishes()
          gets the wishlist.
 void login(java.lang.String username, java.lang.String password)
          performs the login to the server.
 void saveWish(WishDtoImpl wish)
          saves the wish.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createInstance

public static WishAdapter createInstance()
returns the singletoninstance.

Returns:
singleinstance

login

public void login(java.lang.String username,
                  java.lang.String password)
           throws AdapterException
performs the login to the server.

Specified by:
login in interface WishAdapter
Parameters:
username - the username of the user
password - the password of the user
Throws:
AdapterException - if the login could not be performed correctly

loadWishes

public void loadWishes()
                throws AdapterException
gets the wishlist.

Specified by:
loadWishes in interface WishAdapter
Throws:
AdapterException - if the wishes couldn't be retrieved

getLoadedWishes

public java.util.Vector getLoadedWishes()
gets the loaded wishes, if the last forward performed by the server was a WlCommonConstants.ACTION_WISH_LIST_WISH.

Specified by:
getLoadedWishes in interface WishAdapter
Returns:
the wishes

saveWish

public void saveWish(WishDtoImpl wish)
              throws AdapterException
saves the wish.

Specified by:
saveWish in interface WishAdapter
Parameters:
wish - the wish to save
Throws:
AdapterException - if the wish could not be saved

deleteWish

public void deleteWish(java.lang.String wishKey)
                throws AdapterException
deletes the wish with the key wishKey.

Specified by:
deleteWish in interface WishAdapter
Parameters:
wishKey - the key of the wish to delete
Throws:
AdapterException - if the wish could not be deleted

getNextAction

public java.lang.String getNextAction()
Returns:
the the last executed forward of the webserver.

getLastAction

public java.lang.String getLastAction()
gets the last executed forward of the webserver.

Specified by:
getLastAction in interface WishAdapter
Returns:
the last executed forward of the webserver

getLoadedWish

public WishDtoImpl getLoadedWish()
                          throws AdapterException

Specified by:
getLoadedWish in interface WishAdapter
Returns:
the previously loaded wish
Throws:
AdapterException - if the wish could not be loaded
See Also:
WishAdapter.loadWish(String)

getLoadedWishAuthor

public UserDtoImpl getLoadedWishAuthor()
                                throws AdapterException

Specified by:
getLoadedWishAuthor in interface WishAdapter
Returns:
the previously loaded wishauthor
Throws:
AdapterException - if the wish could not be loaded
See Also:
WishAdapter.loadWish(String)

loadWish

public void loadWish(java.lang.String wishId)
              throws AdapterException
loads the wish and the author of the wish. If wishKey is null, a new Wish is created.

Specified by:
loadWish in interface WishAdapter
Parameters:
wishId - the key of the wish to load
Throws:
AdapterException - if the wish could not be loaded
See Also:
WishAdapter.getLoadedWish(), WishAdapter.getLoadedWishAuthor()

getMessages

public SafeHashtable getMessages()
gets information about the last action. The values are from type String.

Specified by:
getMessages in interface WishAdapter
Returns:
the messages of the last action, or null if the last action didn't produce any message

getErrors

public SafeHashtable getErrors()
gets errormessages from the last action. The values are from type String.

Specified by:
getErrors in interface WishAdapter
Returns:
the errormessages of the last action, or null if the last action didn't produce any message