|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectmagoffin.matt.ma2.biz.impl.UserBizImpl
public class UserBizImpl
Standard implementation of UserBiz.
Note: the init() method should be called after
configuring this class but before calling any other methods; the
finish() should be called when finished using.
The configurable properties of this class are:
DataEncryption instance
to use for encrypting the registration confirmation with.IOBiz implementation to ues.SystemBiz implementation to use.UserDao to use for managing
persistent User objects.CollectionDao to use for managing
persistent Collection objects.MediaItemDao to use for managing
persistent MediaItem objects.Validator instance to use for
validating User data with.MessageSource.DomainObjectFactory for creating
new domain objects.default.collection.name.default.collection.comment.
| Field Summary | |
|---|---|
static int |
DEFAULT_ALBUM_FEED_MAX_LENGHT
The default value for the albumFeedMaxLength property. |
| Fields inherited from interface magoffin.matt.ma2.biz.UserBiz |
|---|
ACCESS_ADMIN, DO_NOT_CHANGE_VALUE, WATERMARK_META_KEY |
| Constructor Summary | |
|---|---|
UserBizImpl()
|
|
| Method Summary | |
|---|---|
User |
confirmForgotPassword(java.lang.String login,
java.lang.String confirmationCode,
java.lang.String newPassword,
BizContext context)
Confirm a forgotten password. |
User |
confirmRegisteredUser(java.lang.String login,
java.lang.String confirmationCode,
BizContext context)
Confirm a registered user. |
void |
finish()
Call to release any class resources when finished using. |
java.lang.String |
forgotPassword(java.lang.String login,
BizContext context)
Call to email a user a link with a one-time password. |
java.util.Map<java.lang.String,java.lang.Object> |
getAdminUserTemplate()
|
AlbumDao |
getAlbumDao()
|
java.util.List<Album> |
getAlbumFeedForUser(AlbumFeedCommand command)
Get a List of Albums for a user's album feed. |
int |
getAlbumFeedMaxLength()
|
java.util.List<Album> |
getAlbumsForUser(User user,
BizContext context)
Get all albums for a given user. |
User |
getAnonymousUser()
Get an anonymous user object. |
java.util.Map<java.lang.String,java.lang.Object> |
getAnonymousUserTemplate()
|
Collection |
getCollection(java.lang.Long collectionId,
BizContext context)
Get a single collection. |
CollectionDao |
getCollectionDao()
|
java.io.File |
getCollectionDirectory(Collection collection,
BizContext context)
Get the directory for a given collection. |
java.util.List<Collection> |
getCollectionsForUser(User user,
BizContext context)
Get all collections for a given user. |
java.lang.String |
getDefaultCollectionCommentMessageKey()
|
java.lang.String |
getDefaultCollectionNameMessageKey()
|
MediaQuality |
getDefaultThumbQuality()
|
MediaSize |
getDefaultThumbSize()
|
MediaQuality |
getDefaultViewQuality()
|
MediaSize |
getDefaultViewSize()
|
DomainObjectFactory |
getDomainObjectFactory()
|
magoffin.matt.util.DataEncryption |
getEncryptor()
|
IOBiz |
getIoBiz()
|
org.springframework.context.MessageSource |
getMessages()
|
byte[] |
getSalt()
|
java.util.List<Album> |
getSharedAlbumsForUser(BrowseAlbumsCommand command)
Get a List of Albums for a browse command. |
SystemBiz |
getSystemBiz()
|
User |
getUserByAnonymousKey(java.lang.String key)
Get a User by its anonymous key. |
User |
getUserById(java.lang.Long userId,
BizContext context)
Get a User by its ID. |
UserDao |
getUserDao()
|
java.util.Locale |
getUserLocale(User user,
BizContext context)
Get the Locale for a User. |
java.util.List<User> |
getUsersWithAccess(int level)
Get a list of User objects that have a specific access level. |
org.springframework.validation.Validator |
getUserValidator()
|
org.springframework.core.io.Resource |
getUserWatermark(java.lang.Long userId)
Get a Resource for a user's watermark. |
java.util.Set<MediaSize> |
getWatermarkSizes()
|
boolean |
hasAccessLevel(User user,
int level)
Return true if the supplied user has the specified access level. |
void |
init()
Call to initialize the class after configuring properties. |
boolean |
isAnonymousUser(User user)
Test if a User is an anonoymous user. |
User |
logonUser(java.lang.String login,
java.lang.String password)
Authenticate a user by their username and password. |
Collection |
newCollectionForUser(Collection collection,
User user,
BizContext context)
Create a new Collection for a given user. |
java.lang.String |
registerUser(User user,
BizContext context)
Register a new user. |
void |
removeUser(java.lang.Long userId,
BizContext context)
Remove a User from the back end. |
void |
setAdminUserTemplate(java.util.Map<java.lang.String,java.lang.Object> adminUserTemplate)
|
void |
setAlbumDao(AlbumDao albumDao)
|
void |
setAlbumFeedMaxLength(int albumFeedMaxLength)
|
void |
setAnonymousUserTemplate(java.util.Map<java.lang.String,java.lang.Object> anonymousUserTemplate)
|
void |
setCollectionDao(CollectionDao collectionDao)
|
void |
setDefaultCollectionCommentMessageKey(java.lang.String defaultCollectionCommentMessageKey)
|
void |
setDefaultCollectionNameMessageKey(java.lang.String defaultCollectionNameMessageKey)
|
void |
setDefaultThumbQuality(MediaQuality defaultThumbQuality)
|
void |
setDefaultThumbSize(MediaSize defaultThumbMediaSize)
|
void |
setDefaultViewQuality(MediaQuality defaultViewQuality)
|
void |
setDefaultViewSize(MediaSize defaultViewMediaSize)
|
void |
setDomainObjectFactory(DomainObjectFactory domainObjectFactory)
|
void |
setEncryptor(magoffin.matt.util.DataEncryption encryptor)
|
void |
setIoBiz(IOBiz ioBiz)
|
void |
setMessages(org.springframework.context.MessageSource messages)
|
void |
setSalt(byte[] salt)
|
void |
setSystemBiz(SystemBiz systemBiz)
|
void |
setUserDao(UserDao userDao)
|
void |
setUserValidator(org.springframework.validation.Validator userValidator)
|
void |
setWatermarkSizes(java.util.Set<MediaSize> watermarkSizes)
|
java.lang.Long |
storeCollection(Collection collection,
BizContext context)
Store a collection in the back end. |
java.lang.Long |
storeUser(User user,
BizContext context)
Store a User in the back end. |
void |
storeUserPreferences(PreferencesCommand command,
BizContext context)
Store user preferences in the back end. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_ALBUM_FEED_MAX_LENGHT
albumFeedMaxLength property.
| Constructor Detail |
|---|
public UserBizImpl()
| Method Detail |
|---|
public void init()
public void finish()
public Collection getCollection(java.lang.Long collectionId,
BizContext context)
UserBizThe collection items need not be populated here. See the
MediaBiz.getCollectionWithItems(Long, BizContext) method
for that.
getCollection in interface UserBizcollectionId - the ID of the collection to getcontext - the current context
public java.lang.Long storeCollection(Collection collection,
BizContext context)
throws AuthorizationException
UserBizThis method will accept new collections as well as updates to existing collections.
storeCollection in interface UserBizcollection - the collection to storecontext - the current context
AuthorizationException - if the current user is not authorized to update
this collection
public java.lang.String registerUser(User user,
BizContext context)
throws AuthorizationException
UserBizUse this method to register a new user. After registration
the user will be stored in the back end, but the user will
require confirmation before they can officially log into the
application (see UserBiz.confirmRegisteredUser(String, String, BizContext)).
registerUser in interface UserBizuser - the new user to registercontext - the BizContext
UserBiz.confirmRegisteredUser(String, String, BizContext)
AuthorizationException - if the desired login is taken already,
this exception will be thrown with the reason code
AuthorizationException.Reason#DUPLICATE_LOGIN
public User confirmRegisteredUser(java.lang.String login,
java.lang.String confirmationCode,
BizContext context)
throws AuthorizationException
UserBizAfter a user has registered (see UserBiz.registerUser(User, BizContext)) they
must confirm the registration via this method. After confirmation the
user can login via UserBiz.logonUser(String, String) as a normal
user.
confirmRegisteredUser in interface UserBizlogin - the login to confirmconfirmationCode - the confirmation codecontext - the BizContext
AuthorizationException - if the confirmationCode does not match
then the reason code will be set to AuthorizationException.Reason#REGISTRATION_NOT_CONFIRMED,
if the login is not found then AuthorizationException.Reason#UNKNOWN_LOGIN, if
the account has already been confirmed then
AuthorizationException.Reason#REGISTRATION_ALREADY_CONFIRMED
public java.util.List<Collection> getCollectionsForUser(User user,
BizContext context)
UserBizNote this method is not presumed to return Collection instances populated
with the MediaItem instances associated
with each Collection. That is assumed to be a very expensive operation, so
the implementation need not bother returning "complete" Collection instanes.
getCollectionsForUser in interface UserBizuser - the user to get collections forcontext - the current context
public Collection newCollectionForUser(Collection collection,
User user,
BizContext context)
UserBiz
newCollectionForUser in interface UserBizcollection - the collection object to associate with the useruser - the usercontext - the current context
public java.util.List<Album> getAlbumsForUser(User user,
BizContext context)
UserBizNote this method is not presumed to return Album instances populated
with the MediaItem instances associated
with each Album. That is assumed to be a very expensive operation, so
the implementation need not bother returning "complete" Album instanes.
getAlbumsForUser in interface UserBizuser - the user to get albums forcontext - the current context
public java.io.File getCollectionDirectory(Collection collection,
BizContext context)
UserBiz
getCollectionDirectory in interface UserBizcollection - the collection to get the root directory forcontext - the current context
public java.util.Locale getUserLocale(User user,
BizContext context)
UserBiz
getUserLocale in interface UserBizuser - the user to get the Locale forcontext - the current context
public java.lang.Long storeUser(User user,
BizContext context)
throws AuthorizationException
UserBizThis method will accept new users as well as updates to existing users.
When updating an existing user, if the User's password field
is set to UserBiz.DO_NOT_CHANGE_VALUE then the User's password
will not be updated in the back end.
storeUser in interface UserBizuser - the user to storecontext - the current context
AuthorizationException - if the current user is not authorized to update
this user
public void storeUserPreferences(PreferencesCommand command,
BizContext context)
throws AuthorizationException
UserBiz
storeUserPreferences in interface UserBizcommand - the preferences to storecontext - the current context
AuthorizationException - if the current user is not authorized to update
this userpublic org.springframework.core.io.Resource getUserWatermark(java.lang.Long userId)
UserBiz
getUserWatermark in interface UserBizuserId - the ID of the user to get the watermark resource for
public void removeUser(java.lang.Long userId,
BizContext context)
UserBiz
removeUser in interface UserBizuserId - the ID of the User to removecontext - the current context
public User logonUser(java.lang.String login,
java.lang.String password)
throws AuthorizationException
UserBiz
logonUser in interface UserBizlogin - the login name of the user to logonpassword - the attempted password
AuthorizationException - if user not found or password
does not matchpublic java.util.List<Album> getAlbumFeedForUser(AlbumFeedCommand command)
UserBiz
getAlbumFeedForUser in interface UserBizcommand - the command
public java.util.List<Album> getSharedAlbumsForUser(BrowseAlbumsCommand command)
UserBiz
getSharedAlbumsForUser in interface UserBizcommand - the browse command
public User getUserById(java.lang.Long userId,
BizContext context)
UserBiz
getUserById in interface UserBizuserId - the ID of the user to getcontext - the current context
public boolean hasAccessLevel(User user,
int level)
UserBiz
hasAccessLevel in interface UserBizuser - the user to testlevel - the level (use the ACCESS_* constants)
public java.lang.String forgotPassword(java.lang.String login,
BizContext context)
throws AuthorizationException
UserBizCalling this method will do the following:
UserBiz.confirmForgotPassword(String, String, String, BizContext)
forgotPassword in interface UserBizlogin - the login of the user that forgot their passwordcontext - the current context
UserBiz.confirmForgotPassword(String, String, String, BizContext)
AuthorizationException - if the login is not found the reason
code will be set to AuthorizationException.Reason#UNKNOWN_LOGIN
public User confirmForgotPassword(java.lang.String login,
java.lang.String confirmationCode,
java.lang.String newPassword,
BizContext context)
throws AuthorizationException
UserBiz
confirmForgotPassword in interface UserBizlogin - the login of the user being confirmedconfirmationCode - the confirmation code issued by a previous
call to UserBiz.forgotPassword(String, BizContext)newPassword - the new password to setcontext - the current context
AuthorizationException - if the login is not found the reason
code will be set to AuthorizationException.Reason#UNKNOWN_LOGIN, if the confirmationCode
does not match then the reason code will be set to
AuthorizationException.Reason#FORGOTTEN_PASSWORD_NOT_CONFIRMEDpublic User getUserByAnonymousKey(java.lang.String key)
UserBiz
getUserByAnonymousKey in interface UserBizkey - the key of the user to get
public java.util.List<User> getUsersWithAccess(int level)
UserBiz
getUsersWithAccess in interface UserBizlevel - the access level
public User getAnonymousUser()
UserBiz
getAnonymousUser in interface UserBizpublic boolean isAnonymousUser(User user)
UserBiz
isAnonymousUser in interface UserBizuser - the user to test
public magoffin.matt.util.DataEncryption getEncryptor()
public void setEncryptor(magoffin.matt.util.DataEncryption encryptor)
encryptor - The encryptor to set.public byte[] getSalt()
public void setSalt(byte[] salt)
salt - The salt to set.public UserDao getUserDao()
public void setUserDao(UserDao userDao)
userDao - The userDao to set.public org.springframework.validation.Validator getUserValidator()
public void setUserValidator(org.springframework.validation.Validator userValidator)
userValidator - The userValidator to set.public SystemBiz getSystemBiz()
public void setSystemBiz(SystemBiz systemBiz)
systemBiz - The systemBiz to set.public CollectionDao getCollectionDao()
public void setCollectionDao(CollectionDao collectionDao)
collectionDao - The collectionDao to set.public DomainObjectFactory getDomainObjectFactory()
public void setDomainObjectFactory(DomainObjectFactory domainObjectFactory)
domainObjectFactory - The domainObjectFactory to set.public org.springframework.context.MessageSource getMessages()
public void setMessages(org.springframework.context.MessageSource messages)
messages - The messages to set.public java.lang.String getDefaultCollectionNameMessageKey()
public void setDefaultCollectionNameMessageKey(java.lang.String defaultCollectionNameMessageKey)
defaultCollectionNameMessageKey - The defaultCollectionNameMessageKey to set.public java.lang.String getDefaultCollectionCommentMessageKey()
public void setDefaultCollectionCommentMessageKey(java.lang.String defaultCollectionCommentMessageKey)
defaultCollectionCommentMessageKey - The defaultCollectionCommentMessageKey to set.public AlbumDao getAlbumDao()
public void setAlbumDao(AlbumDao albumDao)
albumDao - The albumDao to set.public java.util.Map<java.lang.String,java.lang.Object> getAdminUserTemplate()
public void setAdminUserTemplate(java.util.Map<java.lang.String,java.lang.Object> adminUserTemplate)
adminUserTemplate - The adminUserTemplate to set.public MediaSize getDefaultThumbSize()
public void setDefaultThumbSize(MediaSize defaultThumbMediaSize)
defaultThumbMediaSize - the defaultThumbMediaSize to setpublic MediaQuality getDefaultThumbQuality()
public void setDefaultThumbQuality(MediaQuality defaultThumbQuality)
defaultThumbQuality - the defaultThumbQuality to setpublic MediaSize getDefaultViewSize()
public void setDefaultViewSize(MediaSize defaultViewMediaSize)
defaultViewMediaSize - the defaultViewMediaSize to setpublic MediaQuality getDefaultViewQuality()
public void setDefaultViewQuality(MediaQuality defaultViewQuality)
defaultViewQuality - the defaultViewQuality to setpublic int getAlbumFeedMaxLength()
public void setAlbumFeedMaxLength(int albumFeedMaxLength)
albumFeedMaxLength - the albumFeedMaxLength to setpublic java.util.Map<java.lang.String,java.lang.Object> getAnonymousUserTemplate()
public void setAnonymousUserTemplate(java.util.Map<java.lang.String,java.lang.Object> anonymousUserTemplate)
anonymousUserTemplate - the anonymousUserTemplate to setpublic java.util.Set<MediaSize> getWatermarkSizes()
public void setWatermarkSizes(java.util.Set<MediaSize> watermarkSizes)
watermarkSizes - the watermarkSizes to setpublic IOBiz getIoBiz()
public void setIoBiz(IOBiz ioBiz)
ioBiz - the ioBiz to set
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||