com.webmethods.caf.faces.data.dir
Class PrincipalModel

java.lang.Object
  extended by com.webmethods.caf.faces.bean.PageFlowScopeAdapter
      extended by com.webmethods.caf.faces.data.dir.PrincipalModel
All Implemented Interfaces:
IPageFlowScopeAdapter, IPrincipalProvider, Externalizable, Serializable
Direct Known Subclasses:
GroupModel, RoleModel, UserModel

public abstract class PrincipalModel
extends PageFlowScopeAdapter
implements IPrincipalProvider, Externalizable

Base interface implementation for directory objects content providers: users, groups and roles.

Since:
7.0
See Also:
Serialized Form

Field Summary
protected  IDirPrincipal fDirPrincipal
           
protected  IDirSystemBizPolicy fDirSysBizPolicy
           
protected  IPrincipalAttributeBizPolicy fPapBizPolicy
           
protected  IContext fPortalContext
           
protected  Map fPrincipalAttributes
           
protected  IPrincipalBizPolicy fPrincipalBizPolicy
           
protected  Map fProvidersMap
           
 
Fields inherited from class com.webmethods.caf.faces.bean.PageFlowScopeAdapter
fExpireWithPageFlow
 
Constructor Summary
PrincipalModel()
          Default constructor.
 
Method Summary
protected  void clear()
          Clear the provider, map, and attribute information.
 boolean equals(Object obj)
          Indicates whether some other object is "equal to" this one.
 AttributeProviderModel getAttributeProvider(IThingID providerThingID)
          Get the principal attribute provider model.
 AttributeProviderModel[] getAttributeProviders()
          Get the principal's attribute providers.
protected  Map getAttributeProvidersMap()
          Get the principal's attribute providers as a map.
 Map getAttributes()
          Get all attributes as a Map.
protected  IDirPrincipal getDirPrincipal()
          Look up the principal using the current context's user directory URI.
protected  IDirSystemBizPolicy getDirSystemBizPolicy()
          Get system level biz policies (commands) for this principal.
abstract  String getDisplayName()
          Get display name for this principal.
 String getEmail()
          Get the defined email address for this principal.
 String getIconURL()
          Get icon URL for this principal.
 String getLink()
          Get the linkable URL to open My Profile page for this principal.
protected  IContext getPortalContext()
          Acquire a portal context and cache it.
protected  IPrincipalAttributeBizPolicy getPrincipalAttributeBizPolicy()
          Get service level biz policies (commands) for this principal's attributes providers.
protected  IPrincipalBizPolicy getPrincipalBizPolicy()
          Get system level biz policies (commands) for this principal.
 String getPrincipalDN()
          Get the value of the principal DN.
 String getPrincipalID()
          Get the principal object internal ID.
abstract  int getPrincipalType()
          Get the type of principal used by this model.
 IURI getPrincipalURI()
          Get the value of the principal URI.
 String getPrincipalURIAsString()
          Get the internal principal object URI as String.
 void readExternal(ObjectInput in)
          Set the principal DN from an input.
protected  void setDirPrincipal(IDirPrincipal principal)
          Set the directory principal.
 void setPrincipalAlias(String alias)
          Sets principal alias and initialized this content provider with principal data identified by this alias If the principal is different or null, clear the provider, map, and attribute information.
 void setPrincipalDN(String dn)
          Sets principal DN and initializes this content provider with principal data identified by this DN.
 void setPrincipalID(String principalID)
          Sets principal internal ID and initializes this content provider with principal data identified by this ID If the principal is different or null, clear the provider, map, and attribute information.
 void setPrincipalURI(IURI uri)
          Set the URI value for this principal.
 String toString()
          Returns a string representation of the object.
 void writeExternal(ObjectOutput out)
          Get the principal DN as an output.
 
Methods inherited from class com.webmethods.caf.faces.bean.PageFlowScopeAdapter
getExpireWithPageFlow, setExpireWithPageFlow
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fDirPrincipal

protected transient IDirPrincipal fDirPrincipal

fProvidersMap

protected transient Map fProvidersMap

fPortalContext

protected transient IContext fPortalContext

fPapBizPolicy

protected transient IPrincipalAttributeBizPolicy fPapBizPolicy

fDirSysBizPolicy

protected transient IDirSystemBizPolicy fDirSysBizPolicy

fPrincipalBizPolicy

protected transient IPrincipalBizPolicy fPrincipalBizPolicy

fPrincipalAttributes

protected transient Map fPrincipalAttributes
Constructor Detail

PrincipalModel

public PrincipalModel()
Default constructor. Provides info for the current user unless the setPrincipalURI is called with a different principal.

Method Detail

getPrincipalType

public abstract int getPrincipalType()
Get the type of principal used by this model.

Returns:
IDirConstants.TYPE_USER, IDirConstants.TYPE_GROUP, or IDirConstants.TYPE_ROLE

clear

protected void clear()
Clear the provider, map, and attribute information. Used when changing principals.


getDirPrincipal

protected IDirPrincipal getDirPrincipal()
Look up the principal using the current context's user directory URI.

Returns:
The current context's user directory principal.

setDirPrincipal

protected void setDirPrincipal(IDirPrincipal principal)
Set the directory principal. If the principal is different or null, clear the provider, map, and attribute information.

Parameters:
principal - The directory principal.

setPrincipalURI

public void setPrincipalURI(IURI uri)
Set the URI value for this principal. If the principal is different or null, clear the provider, map, and attribute information.

Parameters:
uri - The IURI value for the principal.

getPrincipalURI

public IURI getPrincipalURI()
Get the value of the principal URI.

Returns:
The IURI value for the principal.

getPrincipalDN

public String getPrincipalDN()
Get the value of the principal DN.

Specified by:
getPrincipalDN in interface IPrincipalProvider
Returns:
The DN value.

setPrincipalDN

public void setPrincipalDN(String dn)
Sets principal DN and initializes this content provider with principal data identified by this DN. If the principal is different or null, clear the provider, map, and attribute information.

Specified by:
setPrincipalDN in interface IPrincipalProvider
Parameters:
dn - The DN value for this principal.

getPrincipalID

public String getPrincipalID()
Get the principal object internal ID.

Specified by:
getPrincipalID in interface IPrincipalProvider
Returns:
The Id value for this principal.

setPrincipalID

public void setPrincipalID(String principalID)
Sets principal internal ID and initializes this content provider with principal data identified by this ID If the principal is different or null, clear the provider, map, and attribute information.

Specified by:
setPrincipalID in interface IPrincipalProvider
Parameters:
principalID - The Id value for this principal.

setPrincipalAlias

public void setPrincipalAlias(String alias)
Sets principal alias and initialized this content provider with principal data identified by this alias If the principal is different or null, clear the provider, map, and attribute information.

Specified by:
setPrincipalAlias in interface IPrincipalProvider
Parameters:
alias - The alias value for this principal.

getPortalContext

protected IContext getPortalContext()
Acquire a portal context and cache it. Cache the results.

Returns:
The portal context.

getPrincipalAttributeBizPolicy

protected IPrincipalAttributeBizPolicy getPrincipalAttributeBizPolicy()
                                                               throws BizException
Get service level biz policies (commands) for this principal's attributes providers.

Returns:
The biz policies for this principal's attribute providers.
Throws:
BizException

getDirSystemBizPolicy

protected IDirSystemBizPolicy getDirSystemBizPolicy()
                                             throws BizException
Get system level biz policies (commands) for this principal.

Returns:
The biz policies for this principal.
Throws:
BizException

getPrincipalBizPolicy

protected IPrincipalBizPolicy getPrincipalBizPolicy()
                                             throws BizException
Get system level biz policies (commands) for this principal.

Returns:
The biz policies for this principal.
Throws:
BizException

getLink

public String getLink()
Get the linkable URL to open My Profile page for this principal.

Specified by:
getLink in interface IPrincipalProvider
Returns:
The linkable URL as a string.

getIconURL

public String getIconURL()
Get icon URL for this principal. Different icons are used for different principal types.

Specified by:
getIconURL in interface IPrincipalProvider
Returns:
The URL for this principal's icon.

getDisplayName

public abstract String getDisplayName()
Get display name for this principal. It could be either role or group name, or combination of first and last name for the user

Specified by:
getDisplayName in interface IPrincipalProvider
Returns:
The display name for this principal.

getEmail

public String getEmail()
Get the defined email address for this principal.

Specified by:
getEmail in interface IPrincipalProvider
Returns:
The email address for this principal.

getAttributeProviders

public AttributeProviderModel[] getAttributeProviders()
Get the principal's attribute providers.

Returns:
An array of attribute providers.

getAttributeProvidersMap

protected Map getAttributeProvidersMap()
Get the principal's attribute providers as a map.

Returns:
A map of attribute providers.

getAttributes

public Map getAttributes()
Get all attributes as a Map.

Specified by:
getAttributes in interface IPrincipalProvider
Returns:
The attribute map for this principal.

getAttributeProvider

public AttributeProviderModel getAttributeProvider(IThingID providerThingID)
Get the principal attribute provider model.

Parameters:
providerThingID - The thing Id for the attribute provider.
Returns:
The attribute provider model.

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Set the principal DN from an input.

Specified by:
readExternal in interface Externalizable
Parameters:
in - The ObjectInput containing the DN.
Throws:
IOException
ClassNotFoundException

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Get the principal DN as an output.

Specified by:
writeExternal in interface Externalizable
Parameters:
out - The ObjectOutput to write the DN into.
Throws:
IOException

equals

public boolean equals(Object obj)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class Object
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.
See Also:
Object.equals(Object)

toString

public String toString()
Returns a string representation of the object.

Overrides:
toString in class Object
Returns:
The string contains principal Id, DN, and type.

getPrincipalURIAsString

public String getPrincipalURIAsString()
Get the internal principal object URI as String.

Specified by:
getPrincipalURIAsString in interface IPrincipalProvider
Returns:
The URI, as a string.