|
Foundation |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.services.user.Profile
public class Profile
The Profile class maintains information about a user
that generally pertains to a specific application. Each
profile can store subprofiles so they can be searched
hierarchically. The root of the profile "tree" is the
global profile. It contains information that doesn't
really apply to a single application (like the user's
name). An example of an application string is:
Solutions/SalesVision/Reports
Each level of the hierarchy can contain information about
the user. For instance, the Solutions application may
contain information whose scope spans all of the applications
under it. The SalesVision application can have profile
information specific to it, and the Reports profile can
have SalesVision report preferences and customizations
stored under it.
This class is intended as a parent for classes that will have specific methods for accessing profile information rather than having to use keys for everything. Subclasses will also be responsible for handling the persistence of any information that is changed in the profile.
Field Summary |
---|
Fields inherited from interface com.sas.services.user.ProfileInterface |
---|
NO_BACK_END_MSG_KEY |
Constructor Summary | |
---|---|
protected |
Profile()
Constructs a default profile. |
protected |
Profile(java.lang.Class theClass)
Constructs a profile and exports it to the RMI system using RMI socket factories for the specified class. |
|
Profile(java.lang.String application)
Default constructor. |
protected |
Profile(java.lang.String application,
java.lang.Class subClass)
Default constructor. |
Method Summary | |
---|---|
protected void |
addAttribute(java.lang.String key,
java.lang.String value)
Add an attribute to the current set of attributes. |
void |
addAttribute(java.lang.String application,
java.lang.String key,
java.lang.String value)
Add a value to an attribute. |
void |
addProfile(java.lang.String application,
ProfileInterface profile,
boolean force)
Add a new application profile. |
protected java.util.Locale |
attribute2Locale(java.lang.String localeString)
|
void |
create(MetadataInterface root,
UserContextInterface user,
RepositoryInterface repos,
ProfileDomain pd)
Create a new profile object in the metadata store. |
void |
createSubprofile(ProfileInterface profile)
Create a new subprofile under this profile in the same repository. |
void |
deleteProfile(java.lang.String application)
Delete a Profile from the metadata and the profile hierarchy. |
void |
destroy()
Destroy any resources held by this profile instance and its subordinates. |
java.util.Map |
getAllAttributes(java.lang.String application)
Get all of the attributes in this Profile. |
java.lang.String |
getApplication()
Gets the application. |
protected java.util.List |
getAttribute(java.lang.String key)
Get an attribute from this profile. |
java.lang.String |
getAttribute(java.lang.String application,
java.lang.String key)
Get an attribute from a profile. |
java.util.List |
getAttributes(java.lang.String application,
java.lang.String key)
Get all the attributes for a key. |
java.util.Locale |
getLocale(java.lang.String application)
Get the profile locale. |
ProfileInterface |
getParentProfile()
Get the profile that's the parent of this one. |
java.lang.String |
getPathFromRoot()
Get the application path string from the root to this profile object. |
ProfileInterface |
getProfile(java.lang.String application)
Get a Profile object associated with a given application string. |
ProfileInterface |
getProfile(java.lang.String application,
boolean create)
Get a Profile object associated with a given application string. |
ProfileInterface |
getRootProfile()
Follow the parent chain up to the root of the preference tree. |
UserContextInterface |
getUserContext()
Get a handle to the UserContext that owns this profile. |
boolean |
isLoaded()
Determines whether or not the profile is loaded. |
java.util.Set |
keySet()
Gets the key set for the attributes. |
void |
load(MetadataInterface root,
UserContextInterface user,
RepositoryInterface repos,
ProfileDomain pd)
Load user profile information from a repository. |
protected boolean |
needReload()
|
void |
persist(java.lang.String application,
boolean recursive)
Write any changes to the profile back to the persistent store. |
void |
refresh()
Causes a re-fetch of data from the back-end store. |
protected void |
reload()
|
protected void |
removeAttribute(java.lang.String key)
|
void |
removeAttribute(java.lang.String application,
java.lang.String key)
Remove an attribute from the profile. |
boolean |
removeProfile(java.lang.String application)
Remove an application profile from the profile tree. |
protected void |
setAttribute(java.lang.String key,
java.lang.String value)
Set an attribute value in the profile. |
void |
setAttribute(java.lang.String application,
java.lang.String key,
java.lang.String value)
Set the value of an attribute in an application profile. |
void |
setLoadParameters(MetadataInterface root,
UserContextInterface user,
RepositoryInterface repos,
ProfileDomain pd)
Set the parameters necessary to load the profile from a backing store. |
void |
setLocale(java.lang.String application,
java.util.Locale locale)
Set the profile locale. |
void |
setParentProfile(ProfileInterface parent)
Set the parent profile in the preference tree. |
void |
setRefreshCycle(long refreshInMillis)
Set the refresh cycle for this profile instance. |
java.util.Collection |
values()
Gets the values for the attributes. |
Constructor Detail |
---|
protected Profile() throws java.rmi.RemoteException
java.rmi.RemoteException
- if a networking issue is encountered.public Profile(java.lang.String application) throws java.rmi.RemoteException
application
- Application
java.rmi.RemoteException
- if a networking issue is encountered.protected Profile(java.lang.String application, java.lang.Class subClass) throws java.rmi.RemoteException
application
- ApplicationsubClass
- The subclass's class which will be used to determine
the appropriate RMI socket factories used to export this remote object.
java.rmi.RemoteException
- if a networking issue is encountered.protected Profile(java.lang.Class theClass) throws java.rmi.RemoteException
theClass
- Class to be used to determine the appropriate RMI socket factory.
java.rmi.RemoteException
- if unable to export a remote object to the RMI system.Method Detail |
---|
public void setRefreshCycle(long refreshInMillis) throws java.rmi.RemoteException
setRefreshCycle
in interface ProfileInterface
refreshInMillis
- Number of milliseconds that the profile information
is considered valid.
java.rmi.RemoteException
- in the event of remote object failure.public boolean isLoaded() throws java.rmi.RemoteException
isLoaded
in interface ProfileInterface
true
if the profile is loaded.
java.rmi.RemoteException
- if a networking issue is encountered.public java.lang.String getApplication() throws java.rmi.RemoteException
getApplication
in interface ProfileInterface
java.rmi.RemoteException
- if a networking issue is encountered.public UserContextInterface getUserContext() throws java.rmi.RemoteException
ProfileInterface
getUserContext
in interface ProfileInterface
java.rmi.RemoteException
- In the event of remote object failure.public java.util.Map getAllAttributes(java.lang.String application) throws java.rmi.RemoteException, ServiceException
ProfileInterface
getAllAttributes
in interface ProfileInterface
application
- The application path for the profile to get
the attribute map for.
java.rmi.RemoteException
- in the event of remote object failure.
ServiceException
- if there is no profile matching the
application string.public java.lang.String getAttribute(java.lang.String application, java.lang.String key) throws java.rmi.RemoteException, ServiceException
getAttribute
in interface ProfileInterface
application
- The application string to search with. This is
a dot-separated list of application names, which should specify the
most specific location to start looking for the key.key
- The key of the attribute to return.
ServiceException
- If there is no profile that matches the
application string.
java.rmi.RemoteException
- if a networking issue is encountered.public java.util.List getAttributes(java.lang.String application, java.lang.String key) throws java.rmi.RemoteException, ServiceException
getAttributes
in interface ProfileInterface
application
- The application string to search with. This is
a slash-separated list of application names, which can include "*" as
a wildcard.key
- The key of the attribute to return.
ServiceException
- If there is no profile that matches the
application string.
java.rmi.RemoteException
protected java.util.List getAttribute(java.lang.String key) throws java.rmi.RemoteException
key
- The key for which to return values.
java.rmi.RemoteException
public ProfileInterface getProfile(java.lang.String application) throws java.rmi.RemoteException, ServiceException
getProfile
in interface ProfileInterface
application
- The application to return the profile for.
ServiceException
- if no Profile matching the application
string is found.
java.rmi.RemoteException
public ProfileInterface getProfile(java.lang.String application, boolean create) throws java.rmi.RemoteException, ServiceException
getProfile
in interface ProfileInterface
application
- The application to return the profile for.create
- If true, the profile will be created if it doesn't
already exist.
ServiceException
- if no Profile matching the application
string is found.
java.rmi.RemoteException
public void setAttribute(java.lang.String application, java.lang.String key, java.lang.String value) throws java.rmi.RemoteException, ServiceException
setAttribute
in interface ProfileInterface
application
- A slash-separated list of application names. Wildcards
are not accepted for this operation.key
- The attribute key to set.value
- The new value for the key. If this value is null, any
existing value(s) are removed for the application.
ServiceException
- If there is no profile for the application string.
java.rmi.RemoteException
protected void setAttribute(java.lang.String key, java.lang.String value) throws java.rmi.RemoteException
key
- The key of the attribute to set.value
- The new value of the attribute
java.rmi.RemoteException
public void removeAttribute(java.lang.String application, java.lang.String key) throws java.rmi.RemoteException, ServiceException
removeAttribute
in interface ProfileInterface
application
- A dot-separated list of application strings. Wildcard
operations are not allowed here.key
- The attribute key to add a value for.
ServiceException
- If there is no profile for the given application string.
java.rmi.RemoteException
- in the event of a remote communication failure.protected void removeAttribute(java.lang.String key) throws java.rmi.RemoteException
java.rmi.RemoteException
public void addAttribute(java.lang.String application, java.lang.String key, java.lang.String value) throws java.rmi.RemoteException, ServiceException
addAttribute
in interface ProfileInterface
application
- A slash-separated list of application strings. Wildcard
operations are not allowed here.key
- The attribute key to add a value for.value
- The new value to add.
ServiceException
- If there is no profile for the given application string.
java.rmi.RemoteException
protected void addAttribute(java.lang.String key, java.lang.String value) throws java.rmi.RemoteException
key
- The key of the attribute to add a value to.value
- The new value to add.
java.rmi.RemoteException
public void setParentProfile(ProfileInterface parent) throws ServiceException, java.rmi.RemoteException
setParentProfile
in interface ProfileInterface
parent
- The parent profile for this one.
ServiceException
- In the event of service failure.
java.rmi.RemoteException
- In the event of remote object failure.public ProfileInterface getParentProfile() throws ServiceException, java.rmi.RemoteException
ProfileInterface
getParentProfile
in interface ProfileInterface
ServiceException
- In the event of service failure.
java.rmi.RemoteException
- in the event of remote object failure.public ProfileInterface getRootProfile() throws ServiceException, java.rmi.RemoteException
ProfileInterface
getRootProfile
in interface ProfileInterface
ServiceException
- If a service error occurs.
java.rmi.RemoteException
- In the event of remote object failure.public java.lang.String getPathFromRoot() throws ServiceException, java.rmi.RemoteException
ProfileInterface
getPathFromRoot
in interface ProfileInterface
ServiceException
- If a service error occurs.
java.rmi.RemoteException
- In the event of remote object failure.public void createSubprofile(ProfileInterface profile) throws ServiceException, java.rmi.RemoteException
createSubprofile
in interface ProfileInterface
profile
- The profile to create as a subprofile of this one.
ServiceException
- In the case of repository failure, or
parameter errors.
java.rmi.RemoteException
- in the event of network problems.public void addProfile(java.lang.String application, ProfileInterface profile, boolean force) throws java.rmi.RemoteException, ServiceException
addProfile
in interface ProfileInterface
application
- A slash-separated list of application names forming a
"tree".profile
- The new profile to add.force
- A flag to indicate if the tree structure represented by the
application string should be created if it doesn't already exist. If
this is false, if the tree doesn't exist, a ServiceException will be thrown.
ServiceException
- If the force flag is false, and an application level
is missing.
java.rmi.RemoteException
public void deleteProfile(java.lang.String application) throws ServiceException, java.rmi.RemoteException
ProfileInterface
deleteProfile
in interface ProfileInterface
application
- The application string
ServiceException
- If the profile for the application doesn't
exist, or if a back end error occurs.
java.rmi.RemoteException
- In the event of remote object failure.public boolean removeProfile(java.lang.String application) throws java.rmi.RemoteException, ServiceException
removeProfile
in interface ProfileInterface
application
- The application string that identifies the profile to
remove. This is a slash-separated application list.
ServiceException
- If the application string is invalid (null or
zero length).
java.rmi.RemoteException
public java.util.Set keySet() throws java.rmi.RemoteException
keySet
in interface ProfileInterface
java.rmi.RemoteException
- if a networking issue is encountered.public java.util.Collection values() throws java.rmi.RemoteException
values
in interface ProfileInterface
java.rmi.RemoteException
- if a networking issue is encountered.public void persist(java.lang.String application, boolean recursive) throws java.rmi.RemoteException, ServiceException
persist
in interface ProfileInterface
application
- The appliation string that identitfies the profile
to persist.recursive
- If this flag is true, all profiles below the one
specified in the application string will be persisted.
ServiceException
- If the application string is invalid or
isn't found in the profile "tree".
java.rmi.RemoteException
public void refresh() throws ServiceException, java.rmi.RemoteException
ProfileInterface
refresh
in interface ProfileInterface
ServiceException
- If a data repository exception occurs.
java.rmi.RemoteException
- In the event of remote object failure.protected boolean needReload() throws ServiceException, java.rmi.RemoteException
ServiceException
java.rmi.RemoteException
protected void reload() throws ServiceException, java.rmi.RemoteException
ServiceException
java.rmi.RemoteException
public void setLoadParameters(MetadataInterface root, UserContextInterface user, RepositoryInterface repos, ProfileDomain pd) throws java.rmi.RemoteException, ServiceException
setLoadParameters
in interface ProfileInterface
root
- The object off which the profile information is anchored.user
- The UserContextInterface to which the profile belongs.repos
- The RepositoryInterface in which the profile is stored.pd
- The configuration information for the Profile.
ServiceException
- In the event of repository failure.
java.rmi.RemoteException
- if a networking issue is encountered.public void load(MetadataInterface root, UserContextInterface user, RepositoryInterface repos, ProfileDomain pd) throws java.rmi.RemoteException, ServiceException
load
in interface ProfileInterface
root
- The object that the profile is "rooted" to. This will
be a Person object for the first-level profile, but may be another
property set, or other entity for lower level profiles.user
- User contextrepos
- The repository to load from.pd
- The profile to add the new information to.
ServiceException
- In the event of repository failure.
java.rmi.RemoteException
- if a networking issue is encountered.public void create(MetadataInterface root, UserContextInterface user, RepositoryInterface repos, ProfileDomain pd) throws java.rmi.RemoteException, ServiceException
create
in interface ProfileInterface
root
- The object that the profile is "rooted" to. This will
be a Person object for the first-level profile, but may be another
property set, or other entity for lower level profiles.user
- User contextrepos
- The repository to load from.pd
- The profile to add the new information to.
ServiceException
- In the event of repository failure.
java.rmi.RemoteException
- in the event of a remote communication failure.public void setLocale(java.lang.String application, java.util.Locale locale) throws ServiceException, java.rmi.RemoteException
setLocale
in interface ProfileInterface
application
- The application to set the locale for.locale
- A Locale object to use for this application.
ServiceException
- in the event of errors.
java.rmi.RemoteException
- in the event of remote object failure.public java.util.Locale getLocale(java.lang.String application) throws ServiceException, java.rmi.RemoteException
getLocale
in interface ProfileInterface
application
- The application to get the locale for.
ServiceException
- if the application string is invalid.
java.rmi.RemoteException
- in the event of remote object failure.protected java.util.Locale attribute2Locale(java.lang.String localeString) throws java.rmi.RemoteException
java.rmi.RemoteException
public void destroy() throws java.rmi.RemoteException
ProfileInterface
destroy
in interface ProfileInterface
java.rmi.RemoteException
- In the event of remote object failure.
|
Foundation |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |