org.springframework.extensions.webscripts
Class ScriptUser

java.lang.Object
  extended by org.springframework.extensions.webscripts.ScriptBase
      extended by org.springframework.extensions.webscripts.ScriptUser
All Implemented Interfaces:
Serializable

public final class ScriptUser
extends ScriptBase

Read-only root-scoped script object wrapping the current user for the current thread of execution. The following is equivalent: var organization = user.organization; var organization = user.properties.organization; var organization = user.properties["organization"];

Author:
muzquiano, kevinr
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.springframework.extensions.webscripts.ScriptBase
context, properties
 
Constructor Summary
ScriptUser(RequestContext context, User user)
          Instantiates a new ScriptUser object which wraps a given request context and framework user object.
 
Method Summary
protected  ScriptableMap buildProperties()
          Provides an associative array of properties that can be accessed via scripting by using the .properties accessor.
 String getBiography()
           
 String getCompanyAddress1()
           
 String getCompanyAddress2()
           
 String getCompanyAddress3()
           
 String getCompanyEmail()
           
 String getCompanyFax()
           
 String getCompanyPostcode()
           
 String getCompanyTelephone()
           
 String getEmail()
           
 String getFirstName()
           
 String getFullName()
           
 String getId()
          Gets the id.
 String getInstantMsg()
           
 boolean getIsAdmin()
           
 boolean getIsGuest()
           
 String getJobTitle()
           
 String getLastName()
           
 String getLocation()
           
 String getMiddleName()
           
 String getMobilePhone()
           
 String getName()
          Gets the name (generally this is the username - i.e.
 String getOrganization()
           
 String getSkype()
           
 String getTelephone()
           
 ScriptUser getUser(String userId)
          Retrieve a user object with populated details for the given user Id
 void save()
          Persist user changes
 void setBiography(String value)
           
 void setCompanyAddress1(String value)
           
 void setCompanyAddress2(String value)
           
 void setCompanyAddress3(String value)
           
 void setCompanyEmail(String value)
           
 void setCompanyFax(String value)
           
 void setCompanyPostcode(String value)
           
 void setCompanyTelephone(String value)
           
 void setEmail(String value)
           
 void setFirstName(String value)
           
 void setInstantMsg(String value)
           
 void setJobTitle(String value)
           
 void setLastName(String value)
           
 void setLocation(String value)
           
 void setMiddleName(String value)
           
 void setMobilePhone(String value)
           
 void setOrganization(String value)
           
 void setSkype(String value)
           
 void setTelephone(String value)
           
 String toString()
           
 
Methods inherited from class org.springframework.extensions.webscripts.ScriptBase
getConfig, getModel, getObject, getProperties, getRequestContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScriptUser

public ScriptUser(RequestContext context,
                  User user)
Instantiates a new ScriptUser object which wraps a given request context and framework user object.

Parameters:
context - the render context
user - the user
Method Detail

buildProperties

protected ScriptableMap buildProperties()
Provides an associative array of properties that can be accessed via scripting by using the .properties accessor.

Specified by:
buildProperties in class ScriptBase
Returns:
the properties

getId

public String getId()
Gets the id.

Returns:
the id

getName

public String getName()
Gets the name (generally this is the username - i.e. same as id)

Returns:
the name

getFullName

public String getFullName()

getFirstName

public String getFirstName()

setFirstName

public void setFirstName(String value)

getLastName

public String getLastName()

setLastName

public void setLastName(String value)

getMiddleName

public String getMiddleName()

setMiddleName

public void setMiddleName(String value)

getEmail

public String getEmail()

setEmail

public void setEmail(String value)

getOrganization

public String getOrganization()

setOrganization

public void setOrganization(String value)

getJobTitle

public String getJobTitle()

setJobTitle

public void setJobTitle(String value)

getLocation

public String getLocation()

setLocation

public void setLocation(String value)

getBiography

public String getBiography()

setBiography

public void setBiography(String value)

getTelephone

public String getTelephone()

setTelephone

public void setTelephone(String value)

getMobilePhone

public String getMobilePhone()

setMobilePhone

public void setMobilePhone(String value)

getSkype

public String getSkype()

setSkype

public void setSkype(String value)

getInstantMsg

public String getInstantMsg()

setInstantMsg

public void setInstantMsg(String value)

getCompanyPostcode

public String getCompanyPostcode()

setCompanyPostcode

public void setCompanyPostcode(String value)

getCompanyTelephone

public String getCompanyTelephone()

setCompanyTelephone

public void setCompanyTelephone(String value)

getCompanyFax

public String getCompanyFax()

setCompanyFax

public void setCompanyFax(String value)

getCompanyEmail

public String getCompanyEmail()

setCompanyEmail

public void setCompanyEmail(String value)

getCompanyAddress1

public String getCompanyAddress1()

setCompanyAddress1

public void setCompanyAddress1(String value)

getCompanyAddress2

public String getCompanyAddress2()

setCompanyAddress2

public void setCompanyAddress2(String value)

getCompanyAddress3

public String getCompanyAddress3()

setCompanyAddress3

public void setCompanyAddress3(String value)

getIsAdmin

public boolean getIsAdmin()

getIsGuest

public boolean getIsGuest()

save

public void save()
Persist user changes


getUser

public ScriptUser getUser(String userId)
Retrieve a user object with populated details for the given user Id

Parameters:
userId -
Returns:
ScriptUser

toString

public String toString()
Overrides:
toString in class ScriptBase


Copyright © 2009 SpringSource, Inc. All Rights Reserved.