org.olat.user.propertyhandlers
Class MSNPropertyHandler

java.lang.Object
  extended by org.olat.user.AbstractUserPropertyHandler
      extended by org.olat.user.propertyhandlers.Generic127CharTextPropertyHandler
          extended by org.olat.user.propertyhandlers.MSNPropertyHandler
All Implemented Interfaces:
ItemValidatorProvider, UserPropertyHandler

public class MSNPropertyHandler
extends Generic127CharTextPropertyHandler

Implements a user property handler for MSN screen names.

Initial Date: Jul 28, 2009

Author:
twuersch

Field Summary
static int MSN_NAME_MAX_LENGTH
           
static java.lang.String MSN_NAME_URL_PARAMETER
           
static java.lang.String MSN_NAME_VALIDATION_URL
           
 
Constructor Summary
MSNPropertyHandler()
           
 
Method Summary
 FormItem addFormItem(java.util.Locale locale, User user, java.lang.String usageIdentifyer, boolean isAdministrativeUser, FormItemContainer formItemContainer)
          Adds a flexi-form Item for this UserPropertyHandler.
 java.lang.String getUserPropertyAsHTML(User user, java.util.Locale locale)
           
 boolean isValid(FormItem formItem, java.util.Map formContext)
          Checks if a form item for a property has a valid value and sets the appropriate error key if necessary.
 boolean isValidValue(java.lang.String value, ValidationError validationError, java.util.Locale locale)
          Checks if the given value is a valid value for this property (e.g.
 
Methods inherited from class org.olat.user.propertyhandlers.Generic127CharTextPropertyHandler
getFormElement, getStringValue, getStringValue, getStringValue, isValid, updateFormElementFromUser, updateUserFromFormElement, updateUserFromFormItem
 
Methods inherited from class org.olat.user.AbstractUserPropertyHandler
getColumnDescriptor, getGroup, getName, getUserProperty, i18nColumnDescriptorLabelKey, i18nFormElementGroupKey, i18nFormElementLabelKey, isDeletable, setDeletable, setGroup, setName, setUserProperty, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MSN_NAME_MAX_LENGTH

public static final int MSN_NAME_MAX_LENGTH
See Also:
Constant Field Values

MSN_NAME_VALIDATION_URL

public static final java.lang.String MSN_NAME_VALIDATION_URL
See Also:
Constant Field Values

MSN_NAME_URL_PARAMETER

public static final java.lang.String MSN_NAME_URL_PARAMETER
See Also:
Constant Field Values
Constructor Detail

MSNPropertyHandler

public MSNPropertyHandler()
Method Detail

getUserPropertyAsHTML

public java.lang.String getUserPropertyAsHTML(User user,
                                              java.util.Locale locale)
Specified by:
getUserPropertyAsHTML in interface UserPropertyHandler
Overrides:
getUserPropertyAsHTML in class AbstractUserPropertyHandler
Parameters:
user - the user for which we want to get the value
locale - the current users locale or NULL if default locale should be used.
Returns:
The value formatted in HTML or an empty String if no value exists
See Also:
AbstractUserPropertyHandler.getUserPropertyAsHTML(org.olat.core.id.User, java.util.Locale)

isValidValue

public boolean isValidValue(java.lang.String value,
                            ValidationError validationError,
                            java.util.Locale locale)
Description copied from interface: UserPropertyHandler
Checks if the given value is a valid value for this property (e.g. syntax checking). This is not connected to any form item, in contrast to UserPropertyHandler.isValid(FormItem, Map), so all validations which do not depend on a form item can be done here.

Specified by:
isValidValue in interface ItemValidatorProvider
Specified by:
isValidValue in interface UserPropertyHandler
Overrides:
isValidValue in class Generic127CharTextPropertyHandler
Parameters:
value - The value to be checked
validationError - Callback to get the error key in case of validation=false
Returns:
true: value is valid, false: value is invalid. Check validationError to get the error message
See Also:
Generic127CharTextPropertyHandler.isValidValue(java.lang.String, org.olat.core.gui.components.form.ValidationError, java.util.Locale)

addFormItem

public FormItem addFormItem(java.util.Locale locale,
                            User user,
                            java.lang.String usageIdentifyer,
                            boolean isAdministrativeUser,
                            FormItemContainer formItemContainer)
Description copied from interface: UserPropertyHandler
Adds a flexi-form Item for this UserPropertyHandler. The usageIdentifyer indicates in which form the element is to be used.

Specified by:
addFormItem in interface UserPropertyHandler
Overrides:
addFormItem in class Generic127CharTextPropertyHandler
Parameters:
locale - The current users locale
user - The user containing data to be prefilled or NULL if it should be left empty
usageIdentifyer - The identifyer of the form where this form element is used
isAdministrativeUser - true: Form element will be set to administrative mode. false: the element is set to user mode. In some cases the field is then read-only
formItemContainer - Container to which Form Item has to be added
Returns:
The formItem will be added to formItemContainer
See Also:
Generic127CharTextPropertyHandler.addFormItem(java.util.Locale, org.olat.core.id.User, java.lang.String, boolean, org.olat.core.gui.components.form.flexible.FormItemContainer)

isValid

public boolean isValid(FormItem formItem,
                       java.util.Map formContext)
Description copied from interface: UserPropertyHandler
Checks if a form item for a property has a valid value and sets the appropriate error key if necessary. This is different from UserPropertyHandler.isValidValue(String, ValidationError, Locale) since it takes the value of the form item associated with this user property into account. Do all validations which depend on a form item here.

Specified by:
isValid in interface UserPropertyHandler
Overrides:
isValid in class Generic127CharTextPropertyHandler
Parameters:
formItem - The flexi form item previously created with the addFormItem method
formContext - Map containing some variables used in this form context, e.g. for cross form value checks. NULL to not use any form context variables
Returns:
true: the entered value is ok; false: the entered value is not accepted (Validation error)
See Also:
Generic127CharTextPropertyHandler.isValid(org.olat.core.gui.components.form.flexible.FormItem, java.util.Map)