com.openexchange.mail.usersetting
Class UserSettingMailStorage

java.lang.Object
  extended by com.openexchange.mail.usersetting.UserSettingMailStorage
All Implemented Interfaces:
com.openexchange.cache.registry.CacheAvailabilityListener
Direct Known Subclasses:
CachingUserSettingMailStorage

public abstract class UserSettingMailStorage
extends java.lang.Object
implements com.openexchange.cache.registry.CacheAvailabilityListener

UserSettingMailStorage - Access to UserSettingMail

Author:
Thorben Betten

Method Summary
abstract  void clearStorage()
          Clears this storage's cache if any used
 void deleteUserSettingMail(int user, com.openexchange.groupware.contexts.Context ctx)
          Deletes the user's mail settings from database
abstract  void deleteUserSettingMail(int user, com.openexchange.groupware.contexts.Context ctx, java.sql.Connection writeConArg)
          Deletes the user's mail settings from database
static UserSettingMailStorage getInstance()
          Gets the singleton instance of UserSettingMailStorage
 UserSettingMail getUserSettingMail(int user, com.openexchange.groupware.contexts.Context ctx)
          A convenience method that returns getUserSettingMail(int, Context, Connection) with the connection parameter set to null.
 UserSettingMail getUserSettingMail(int user, com.openexchange.groupware.contexts.Context ctx, java.sql.Connection readCon)
          A convenience method that returns loadUserSettingMail(int, Context, Connection).
 UserSettingMail getUserSettingMail(int user, int cid)
          A convenience method that returns getUserSettingMail(int, Context, Connection) with the connection parameter set to null.
 UserSettingMail loadUserSettingMail(int user, com.openexchange.groupware.contexts.Context ctx)
          Loads user's mail settings from database
abstract  UserSettingMail loadUserSettingMail(int user, com.openexchange.groupware.contexts.Context ctx, java.sql.Connection readConArg)
          Loads user's mail settings from database
static void releaseInstance()
          Releases this storage instance
abstract  void removeUserSettingMail(int user, com.openexchange.groupware.contexts.Context ctx)
          Removes the user's mail settings from cache if any used
 void saveUserSettingMail(UserSettingMail usm, int user, com.openexchange.groupware.contexts.Context ctx)
          Saves given user's mail settings to database
abstract  void saveUserSettingMail(UserSettingMail usm, int user, com.openexchange.groupware.contexts.Context ctx, java.sql.Connection writeConArg)
          Saves given user's mail settings to database
abstract  void shutdownStorage()
          Triggers necessary action to shutdown the storage
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.openexchange.cache.registry.CacheAvailabilityListener
handleAbsence, handleAvailability
 

Method Detail

getInstance

public static final UserSettingMailStorage getInstance()
Gets the singleton instance of UserSettingMailStorage

Returns:
The singleton instance of UserSettingMailStorage

releaseInstance

public static final void releaseInstance()
Releases this storage instance


getUserSettingMail

public final UserSettingMail getUserSettingMail(int user,
                                                int cid)
                                         throws com.openexchange.groupware.userconfiguration.UserConfigurationException
A convenience method that returns getUserSettingMail(int, Context, Connection) with the connection parameter set to null.

Parameters:
user - The user ID
cid - The context ID
Returns:
The instance of UserSettingMail which matches given user ID and context or null on exception
Throws:
com.openexchange.groupware.userconfiguration.UserConfigurationException - If context cannot be loaded

getUserSettingMail

public final UserSettingMail getUserSettingMail(int user,
                                                com.openexchange.groupware.contexts.Context ctx)
A convenience method that returns getUserSettingMail(int, Context, Connection) with the connection parameter set to null.

Parameters:
user - The user ID
ctx - The context
Returns:
The instance of UserSettingMail which matches given user ID and context or null on exception

getUserSettingMail

public final UserSettingMail getUserSettingMail(int user,
                                                com.openexchange.groupware.contexts.Context ctx,
                                                java.sql.Connection readCon)
A convenience method that returns loadUserSettingMail(int, Context, Connection). If an exception is thrown in delegated method null is returned.

Parameters:
user - The user ID
ctx - The context
readCon - The readable connection (may be null)
Returns:
The instance of UserSettingMail which matches given user ID and context or null on exception

saveUserSettingMail

public final void saveUserSettingMail(UserSettingMail usm,
                                      int user,
                                      com.openexchange.groupware.contexts.Context ctx)
                               throws com.openexchange.groupware.userconfiguration.UserConfigurationException
Saves given user's mail settings to database

Parameters:
usm - the user's mail settings to save
user - the user ID
ctx - the context
Throws:
com.openexchange.groupware.userconfiguration.UserConfigurationException - if user's mail settings could not be saved

saveUserSettingMail

public abstract void saveUserSettingMail(UserSettingMail usm,
                                         int user,
                                         com.openexchange.groupware.contexts.Context ctx,
                                         java.sql.Connection writeConArg)
                                  throws com.openexchange.groupware.userconfiguration.UserConfigurationException
Saves given user's mail settings to database

Parameters:
usm - the user's mail settings to save
user - the user ID
ctx - the context
writeConArg - - the writable connection; may be null
Throws:
com.openexchange.groupware.userconfiguration.UserConfigurationException - if user's mail settings could not be saved

deleteUserSettingMail

public final void deleteUserSettingMail(int user,
                                        com.openexchange.groupware.contexts.Context ctx)
                                 throws com.openexchange.groupware.userconfiguration.UserConfigurationException
Deletes the user's mail settings from database

Parameters:
user - the user ID
ctx - the context
Throws:
com.openexchange.groupware.userconfiguration.UserConfigurationException - if deletion fails

deleteUserSettingMail

public abstract void deleteUserSettingMail(int user,
                                           com.openexchange.groupware.contexts.Context ctx,
                                           java.sql.Connection writeConArg)
                                    throws com.openexchange.groupware.userconfiguration.UserConfigurationException
Deletes the user's mail settings from database

Parameters:
user - the user ID
ctx - the context
writeConArg - the writable connection; may be null
Throws:
com.openexchange.groupware.userconfiguration.UserConfigurationException - - if deletion fails

loadUserSettingMail

public final UserSettingMail loadUserSettingMail(int user,
                                                 com.openexchange.groupware.contexts.Context ctx)
                                          throws com.openexchange.groupware.userconfiguration.UserConfigurationException
Loads user's mail settings from database

Parameters:
user - the user
ctx - the context
Returns:
The instance of UserSettingMail which matches given user ID and context
Throws:
com.openexchange.groupware.userconfiguration.UserConfigurationException - if loading fails

loadUserSettingMail

public abstract UserSettingMail loadUserSettingMail(int user,
                                                    com.openexchange.groupware.contexts.Context ctx,
                                                    java.sql.Connection readConArg)
                                             throws com.openexchange.groupware.userconfiguration.UserConfigurationException
Loads user's mail settings from database

Parameters:
user - the user
ctx - the context
readConArg - the readable connection
Returns:
The instance of UserSettingMail which matches given user ID and context
Throws:
com.openexchange.groupware.userconfiguration.UserConfigurationException - if loading fails

removeUserSettingMail

public abstract void removeUserSettingMail(int user,
                                           com.openexchange.groupware.contexts.Context ctx)
                                    throws com.openexchange.groupware.userconfiguration.UserConfigurationException
Removes the user's mail settings from cache if any used

Parameters:
user - the user
ctx - the context
Throws:
com.openexchange.groupware.userconfiguration.UserConfigurationException - if cache removal fails

clearStorage

public abstract void clearStorage()
                           throws com.openexchange.groupware.userconfiguration.UserConfigurationException
Clears this storage's cache if any used

Throws:
com.openexchange.groupware.userconfiguration.UserConfigurationException - if cache clearing fails

shutdownStorage

public abstract void shutdownStorage()
Triggers necessary action to shutdown the storage