org.strutsme.wishlist.client.control
Class WishEditor

java.lang.Object
  extended by org.strutsme.wishlist.client.control.WishEditor

public class WishEditor
extends java.lang.Object

Author:
lbusmann

Constructor Summary
WishEditor()
          the default Constructor. sets the User to the default values.
 
Method Summary
 void deleteWish(java.lang.String wishKey)
          deletes the wish with the id wishKey.
 void fetchWish()
          fetches the wish into the editor.
 void fetchWishes()
          fetches the wishlist from the adapter.
 java.util.Vector getAllWishes()
          gets all wishlist.
 UserDtoImpl getCurrentWishAuthor()
           
 SafeHashtable getErrors()
           
 int getIndexSelectedWish()
           
static WishEditor getInstance()
          singleton accessor method.
 java.lang.String getLastAction()
           
 SafeHashtable getMessages()
           
 WishDtoImpl getNewWish()
          creates a new Wish.
 int getSize()
          determines the count of the currently cached wishlist.
 UserDtoImpl getUser()
          delivers the actual user.
 UserDtoImpl getUser(java.lang.String loginname, java.lang.String passwort)
          searches for the user with the username loginname and checks the password.
 WishDtoImpl getWish()
          retrieves the data of the active wish.
 void loadWish(java.lang.String wishKey)
          loads the wish with the key.
 void loadWishes()
          loads the wishList from the adapter.
 void login(java.lang.String username, java.lang.String password)
          performs the login to the server.
 void refreshData()
          refresh all Data.
 void resetWishSelection()
          resets the selectioninformation of an wish.
 void saveWish(WishDtoImpl wish)
          saves the wish.
 boolean selectWishInternal(java.lang.String key)
          gets the wish with the id key.
 void setCurrentWish(WishDtoImpl wish)
          sets the content of currently selected wish.
 void setCurrentWishAuthor(UserDtoImpl currentWishAuthor)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WishEditor

public WishEditor()
the default Constructor. sets the User to the default values.

Method Detail

getInstance

public static WishEditor getInstance()
singleton accessor method.

Returns:
a unique instance of this class.

login

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

Parameters:
username - the username of the user
password - the password of the user
Throws:
AdapterException - if the login could not be performed correctly

loadWish

public final void loadWish(java.lang.String wishKey)
                    throws AdapterException
loads the wish with the key.

Parameters:
wishKey - the key of the wish to select
Throws:
AdapterException - when wishlist could not be loaded, if the wish is not in the cache
See Also:
fetchWish()

fetchWish

public final void fetchWish()
                     throws AdapterException
fetches the wish into the editor.

Throws:
AdapterException - if the wish could not be fetched
See Also:
loadWish(String)

getWish

public final WishDtoImpl getWish()
retrieves the data of the active wish.

Returns:
the active wish

getAllWishes

public final java.util.Vector getAllWishes()
gets all wishlist.

Returns:
all wishlist

loadWishes

public final void loadWishes()
                      throws AdapterException
loads the wishList from the adapter.

Throws:
AdapterException - if the wishlist could not be loaded

fetchWishes

public final void fetchWishes()
fetches the wishlist from the adapter.


getNewWish

public final WishDtoImpl getNewWish()
creates a new Wish.

Returns:
the new Wish

resetWishSelection

public final void resetWishSelection()
resets the selectioninformation of an wish.


saveWish

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

Parameters:
wish - the wish to save
Throws:
AdapterException - if the wish could not be saved

deleteWish

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

Parameters:
wishKey - the key of the wish to delete
Throws:
AdapterException - if the wish couldn't be deleted

getUser

public final UserDtoImpl getUser(java.lang.String loginname,
                                 java.lang.String passwort)
                          throws AdapterException
searches for the user with the username loginname and checks the password.

Parameters:
loginname - the loginname for the user
passwort - the password of the user
Returns:
the User, if the password matches the password of the user, null else
Throws:
AdapterException - if no user with the loginname could not be found

getUser

public final UserDtoImpl getUser()
delivers the actual user.

Returns:
the actual user

getIndexSelectedWish

public final int getIndexSelectedWish()
Returns:
Returns the Index of the selected wish

refreshData

public void refreshData()
refresh all Data.


setCurrentWish

public final void setCurrentWish(WishDtoImpl wish)
sets the content of currently selected wish.

Parameters:
wish - the wishcontent

getCurrentWishAuthor

public final UserDtoImpl getCurrentWishAuthor()
Returns:
the currentWishAuthor

setCurrentWishAuthor

public final void setCurrentWishAuthor(UserDtoImpl currentWishAuthor)
Parameters:
currentWishAuthor - the currentWishAuthor to set

selectWishInternal

public final boolean selectWishInternal(java.lang.String key)
gets the wish with the id key.

Parameters:
key - the key of the desired wish
Returns:
the wish with the id key

getSize

public final int getSize()
                  throws AdapterException
determines the count of the currently cached wishlist.

Returns:
count of wishlist
Throws:
AdapterException - if the size of the wishlist couldn't be determined.

getLastAction

public final java.lang.String getLastAction()
Returns:
the last action, the editor has performed.

getErrors

public final SafeHashtable getErrors()
Returns:
the errorinformation of the last action

getMessages

public final SafeHashtable getMessages()
Returns:
messages about the last action