stella.util
Class UserProperty

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by stella.util.UserProperty
All Implemented Interfaces:
Cloneable, UserProfile, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying

public class UserProperty
extends PropertyBundles
implements UserProfile

A class to facilitate user properties on a telescope. It is a convenience class to allow simple properties retrieval.


Nested Class Summary
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Nested classes/interfaces inherited from interface stella.util.UserProfile
UserProfile.Affil, UserProfile.Notifies
 
Field Summary
private  Collection<javax.mail.internet.InternetAddress> address
          The list of e-mail addresses.
private  List<UserProfile.Affil> affils
          The list of allowed affiliations.
private static Color DEFCOLOR
          The default color.
private static String DEFINSTITUTION
          The default user institution.
private static String DEFNOTIFY
          The default user-notification.
static String KEY_COLOR
          The preferred color for various display purposes.
static String KEY_EMAIL
          The e-mail addresses of the user, as a comma-separated list.
static String KEY_INSTITUTION
          The institution observing time is accounted to.
static String KEY_NOTIFY
          The notification preferences for the user, as a comma-list.
static String KEY_USER
          The user this properties are bound to.
private  UserProfile.Affil mainaffil
          The default affiliation (first in list or explicedly set).
private  Collection<UserProfile.Notifies> notify
          The list of notification events.
 
Fields inherited from class util.PropertyBundles
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES
 
Fields inherited from class util.PropertyResources
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset
 
Fields inherited from class util.PropertyContainer
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR
 
Fields inherited from interface stella.util.UserProfile
AFFILCOLOR, SYSTEM
 
Fields inherited from interface util.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Fields inherited from interface util.PropertySupplying
CONFIG, KEY_CLASS
 
Constructor Summary
UserProperty(Map<String,String> prop)
          Creates a new user-preferences helper.
 
Method Summary
 List<UserProfile.Affil> getAllowedInstitutions()
          Returns all allowed billing institutions for this user.
 Color getColor()
          Retunrs the user color.
 Collection<? extends javax.mail.Address> getEmail()
          Returns the e-mail list.
 UserProfile.Affil getInstitution()
          Returns the institution.
 PublicKey getKey()
          Return null.
 Collection<UserProfile.Notifies> getNotify()
          Returns the notification list.
 PasswordAuthentication getPassword()
          Return null.
 String getUser()
          Returns the user name.
 void init()
          Checks if the user name and the e-mail address is set.
 boolean setInstitution(UserProfile.Affil allowed)
          Tries to set a new affiliation, which is only allowed if the new affiliation is part of the KEY_INSTITUTION list.
 String toString()
          Returns a string description.
 
Methods inherited from class util.PropertyBundles
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource
 
Methods inherited from class util.PropertyResources
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, keyCreate, keyCreate, reload, setApplet
 
Methods inherited from class util.PropertyContainer
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface util.ResourceSupplying
getResource, getResourceAsStream, getResources
 
Methods inherited from interface util.PropertySupplying
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties
 

Field Detail

KEY_USER

public static final String KEY_USER
The user this properties are bound to.

See Also:
Constant Field Values

KEY_INSTITUTION

public static final String KEY_INSTITUTION
The institution observing time is accounted to.

See Also:
Constant Field Values

KEY_EMAIL

public static final String KEY_EMAIL
The e-mail addresses of the user, as a comma-separated list.

See Also:
Constant Field Values

KEY_NOTIFY

public static final String KEY_NOTIFY
The notification preferences for the user, as a comma-list.

See Also:
Constant Field Values

KEY_COLOR

public static final String KEY_COLOR
The preferred color for various display purposes.

See Also:
Constant Field Values

DEFINSTITUTION

private static final String DEFINSTITUTION
The default user institution.


DEFNOTIFY

private static final String DEFNOTIFY
The default user-notification.


DEFCOLOR

private static final Color DEFCOLOR
The default color.


address

private Collection<javax.mail.internet.InternetAddress> address
The list of e-mail addresses.


notify

private Collection<UserProfile.Notifies> notify
The list of notification events.


affils

private List<UserProfile.Affil> affils
The list of allowed affiliations.


mainaffil

private UserProfile.Affil mainaffil
The default affiliation (first in list or explicedly set).

Constructor Detail

UserProperty

public UserProperty(Map<String,String> prop)
Creates a new user-preferences helper.

Method Detail

init

public void init()
Checks if the user name and the e-mail address is set. Constructs the notification list of strings.

Specified by:
init in interface Initializable
Overrides:
init in class PropertyResources

getUser

public String getUser()
Returns the user name. Always defined if object survived init.

Specified by:
getUser in interface UserProfile

getInstitution

public UserProfile.Affil getInstitution()
Returns the institution.

Specified by:
getInstitution in interface UserProfile

getAllowedInstitutions

public List<UserProfile.Affil> getAllowedInstitutions()
Description copied from interface: UserProfile
Returns all allowed billing institutions for this user.

Specified by:
getAllowedInstitutions in interface UserProfile

setInstitution

public boolean setInstitution(UserProfile.Affil allowed)
Tries to set a new affiliation, which is only allowed if the new affiliation is part of the KEY_INSTITUTION list.

Specified by:
setInstitution in interface UserProfile

getEmail

public Collection<? extends javax.mail.Address> getEmail()
Returns the e-mail list.

Specified by:
getEmail in interface UserProfile

getNotify

public Collection<UserProfile.Notifies> getNotify()
Returns the notification list.

Specified by:
getNotify in interface UserProfile

getColor

public Color getColor()
Retunrs the user color.

Specified by:
getColor in interface UserProfile

toString

public String toString()
Returns a string description.

Overrides:
toString in class PropertyContainer

getKey

public PublicKey getKey()
Return null.

Specified by:
getKey in interface UserProfile

getPassword

public PasswordAuthentication getPassword()
Return null.

Specified by:
getPassword in interface UserProfile