Package com.netscape.cms.profile.common
Class Profile
- java.lang.Object
-
- com.netscape.cms.profile.common.Profile
-
- Direct Known Subclasses:
EnrollProfile
public abstract class Profile extends java.lang.Object
This class implements a basic profile. A profile contains a list of input policies, default policies, constraint policies and output policies.The input policy is for building the enrollment page.
The default policy is for populating user-supplied and system-supplied values into the request.
The constraint policy is for validating the request before processing.
The output policy is for building the result page.
Each profile can have multiple policy set. Each set is composed of zero or more default policies and zero or more constraint policies.
-
-
Field Summary
Fields Modifier and Type Field Description static org.slf4j.Logger
logger
protected java.lang.String
mAuthInstanceId
protected java.lang.String
mAuthzAcl
protected IConfigStore
mConfig
protected java.lang.String
mId
protected java.util.Vector<java.lang.String>
mInputIds
protected java.util.Vector<java.lang.String>
mInputNames
protected java.util.Hashtable<java.lang.String,ProfileInput>
mInputs
protected java.util.Vector<java.lang.String>
mOutputIds
protected java.util.Hashtable<java.lang.String,ProfileOutput>
mOutputs
protected java.util.Hashtable<java.lang.String,java.util.Vector<ProfilePolicy>>
mPolicySet
protected java.util.Vector<java.lang.String>
mUpdaterIds
protected java.util.Hashtable<java.lang.String,IProfileUpdater>
mUpdaters
static java.lang.String
PROP_CLASS_ID
static java.lang.String
PROP_CONSTRAINT
static java.lang.String
PROP_DEFAULT
static java.lang.String
PROP_DESC
static java.lang.String
PROP_ENABLE
static java.lang.String
PROP_ENABLE_BY
static java.lang.String
PROP_GENERIC_EXT_DEFAULT
static java.lang.String
PROP_INPUT
static java.lang.String
PROP_INPUT_LIST
static java.lang.String
PROP_INSTANCE_ID
static java.lang.String
PROP_IS_RENEWAL
static java.lang.String
PROP_NAME
static java.lang.String
PROP_NO_CONSTRAINT
static java.lang.String
PROP_NO_DEFAULT
static java.lang.String
PROP_OUTPUT
static java.lang.String
PROP_OUTPUT_LIST
static java.lang.String
PROP_PARAMS
static java.lang.String
PROP_POLICY_LIST
static java.lang.String
PROP_UPDATER_LIST
static java.lang.String
PROP_VISIBLE
static java.lang.String
PROP_XML_OUTPUT
protected PluginRegistry
registry
protected static Logger
signedAuditLogger
-
Constructor Summary
Constructors Constructor Description Profile()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addInputName(java.lang.String name)
protected java.lang.String
auditSubjectID()
Signed Audit Log Subject ID This method is used to obtain the "SubjectID" for a signed audit log message.ProfileInput
createProfileInput(java.lang.String id, java.lang.String inputID, NameValuePairs nvps)
Creates a input policy.ProfileInput
createProfileInput(java.lang.String id, java.lang.String inputId, NameValuePairs nvps, boolean createConfig)
ProfileOutput
createProfileOutput(java.lang.String id, java.lang.String outputID, NameValuePairs nvps)
Creates a output policy.ProfileOutput
createProfileOutput(java.lang.String id, java.lang.String outputId, NameValuePairs nvps, boolean createConfig)
ProfilePolicy
createProfilePolicy(java.lang.String setId, java.lang.String id, java.lang.String defaultClassId, java.lang.String constraintClassId)
Creates a profile policy.ProfilePolicy
createProfilePolicy(java.lang.String setId, java.lang.String id, java.lang.String defaultClassId, java.lang.String constraintClassId, boolean createConfig)
abstract IRequest[]
createRequests(java.util.Map<java.lang.String,java.lang.String> ctx, java.util.Locale locale)
Creates one or more requests.void
deleteAllProfileInputs()
Delete all profile inputsvoid
deleteAllProfileOutputs()
Delete all profile inputsvoid
deleteAllProfilePolicies()
Delete all profile policiesvoid
deleteProfileInput(java.lang.String inputId)
Deletes input policy by id.void
deleteProfileOutput(java.lang.String outputId)
Deletes output policy by id.void
deleteProfilePolicy(java.lang.String setId, java.lang.String policyId)
Deletes a policy.void
execute(IRequest request)
Process a request after validation.java.lang.String
getApprovedBy()
Retrieves the user id of the person who approves this profile.java.lang.String
getAuthenticatorId()
Retrieves the instance id of the authenticator for this profile.java.lang.String
getAuthzAcl()
IConfigStore
getConfigStore()
Retrieves the configuration store of this profile.java.lang.String
getDescription(java.util.Locale locale)
Returns the profile description.java.lang.String
getId()
Returns the identifier of this profile.java.lang.String
getInput(java.lang.String name, java.util.Locale locale, IRequest request)
IDescriptor
getInputDescriptor(java.lang.String name)
java.util.Enumeration<java.lang.String>
getInputNames()
java.lang.String
getName(java.util.Locale locale)
Returns the profile name.java.util.Vector<ProfilePolicy>
getPolicies(java.lang.String setId)
abstract java.lang.String
getPolicySetId(IRequest req)
Retrieves a default set id for the given request.ProfileInput
getProfileInput(java.lang.String id)
Retrieves input policy by id.java.util.Enumeration<java.lang.String>
getProfileInputIds()
Retrieves a list of input policy IDs.ProfileOutput
getProfileOutput(java.lang.String id)
Retrieves output policy by id.java.util.Enumeration<java.lang.String>
getProfileOutputIds()
Retrieves a list of output policy IDs.java.util.Enumeration<ProfilePolicy>
getProfilePolicies(java.lang.String setId)
Returns a list of profile policies.ProfilePolicy
getProfilePolicy(java.lang.String setId, java.lang.String id)
Retrieves a policy.java.util.Enumeration<java.lang.String>
getProfilePolicyIds(java.lang.String setId)
Retrieves all the policy id within a set.java.util.Enumeration<java.lang.String>
getProfilePolicySetIds()
Returns the profile policy set identifiers.IProfileUpdater
getProfileUpdater(java.lang.String name)
java.util.Enumeration<java.lang.String>
getProfileUpdaterIds()
java.lang.String
getRequestorDN(IRequest request)
Retrieves a localized string that represents requestor's distinguished name.void
init(IConfigStore config)
Initializes this profile.boolean
isEnable()
java.lang.String
isRenewal()
Is this a renewal profileboolean
isVisible()
Checks if this profile is end-user profile or not.java.lang.String
isXmlOutput()
is output going to be in xml?void
populate(IRequest request)
Passes the request to the set of default policies that populate the profile information against the profile.void
populateInput(java.util.Map<java.lang.String,java.lang.String> ctx, IRequest request)
Populates user-supplied input values into the requests.void
setAuthenticatorId(java.lang.String id)
Sets the instance id of the authenticator for this profile.void
setAuthzAcl(java.lang.String id)
void
setDescription(java.util.Locale locale, java.lang.String desc)
Returns the profile description.void
setId(java.lang.String id)
Sets id of this profile.void
setInput(java.lang.String name, java.util.Locale locale, IRequest request, java.lang.String value)
void
setName(java.util.Locale locale, java.lang.String name)
Returns the profile name.void
setRenewal(boolean renewal)
void
setVisible(boolean v)
Sets this profile end-user profile or not.void
setXMLOutput(boolean xmlOutput)
abstract void
submit(IAuthToken token, IRequest request)
Handles end-user request submission.abstract void
submit(IAuthToken token, IRequest request, boolean explicitApprovalRequired)
void
validate(IRequest request)
Passes the request to the set of constraint policies that validate the request against the profile.
-
-
-
Field Detail
-
logger
public static org.slf4j.Logger logger
-
signedAuditLogger
protected static Logger signedAuditLogger
-
PROP_ENABLE
public static final java.lang.String PROP_ENABLE
- See Also:
- Constant Field Values
-
PROP_ENABLE_BY
public static final java.lang.String PROP_ENABLE_BY
- See Also:
- Constant Field Values
-
PROP_IS_RENEWAL
public static final java.lang.String PROP_IS_RENEWAL
- See Also:
- Constant Field Values
-
PROP_XML_OUTPUT
public static final java.lang.String PROP_XML_OUTPUT
- See Also:
- Constant Field Values
-
PROP_VISIBLE
public static final java.lang.String PROP_VISIBLE
- See Also:
- Constant Field Values
-
PROP_INPUT_LIST
public static final java.lang.String PROP_INPUT_LIST
- See Also:
- Constant Field Values
-
PROP_OUTPUT_LIST
public static final java.lang.String PROP_OUTPUT_LIST
- See Also:
- Constant Field Values
-
PROP_UPDATER_LIST
public static final java.lang.String PROP_UPDATER_LIST
- See Also:
- Constant Field Values
-
PROP_POLICY_LIST
public static final java.lang.String PROP_POLICY_LIST
- See Also:
- Constant Field Values
-
PROP_DEFAULT
public static final java.lang.String PROP_DEFAULT
- See Also:
- Constant Field Values
-
PROP_CONSTRAINT
public static final java.lang.String PROP_CONSTRAINT
- See Also:
- Constant Field Values
-
PROP_INPUT
public static final java.lang.String PROP_INPUT
- See Also:
- Constant Field Values
-
PROP_OUTPUT
public static final java.lang.String PROP_OUTPUT
- See Also:
- Constant Field Values
-
PROP_CLASS_ID
public static final java.lang.String PROP_CLASS_ID
- See Also:
- Constant Field Values
-
PROP_INSTANCE_ID
public static final java.lang.String PROP_INSTANCE_ID
- See Also:
- Constant Field Values
-
PROP_PARAMS
public static final java.lang.String PROP_PARAMS
- See Also:
- Constant Field Values
-
PROP_NAME
public static final java.lang.String PROP_NAME
- See Also:
- Constant Field Values
-
PROP_DESC
public static final java.lang.String PROP_DESC
- See Also:
- Constant Field Values
-
PROP_NO_DEFAULT
public static final java.lang.String PROP_NO_DEFAULT
- See Also:
- Constant Field Values
-
PROP_NO_CONSTRAINT
public static final java.lang.String PROP_NO_CONSTRAINT
- See Also:
- Constant Field Values
-
PROP_GENERIC_EXT_DEFAULT
public static final java.lang.String PROP_GENERIC_EXT_DEFAULT
- See Also:
- Constant Field Values
-
mConfig
protected IConfigStore mConfig
-
registry
protected PluginRegistry registry
-
mInputNames
protected java.util.Vector<java.lang.String> mInputNames
-
mInputs
protected java.util.Hashtable<java.lang.String,ProfileInput> mInputs
-
mInputIds
protected java.util.Vector<java.lang.String> mInputIds
-
mOutputs
protected java.util.Hashtable<java.lang.String,ProfileOutput> mOutputs
-
mOutputIds
protected java.util.Vector<java.lang.String> mOutputIds
-
mUpdaters
protected java.util.Hashtable<java.lang.String,IProfileUpdater> mUpdaters
-
mUpdaterIds
protected java.util.Vector<java.lang.String> mUpdaterIds
-
mAuthInstanceId
protected java.lang.String mAuthInstanceId
-
mId
protected java.lang.String mId
-
mAuthzAcl
protected java.lang.String mAuthzAcl
-
mPolicySet
protected java.util.Hashtable<java.lang.String,java.util.Vector<ProfilePolicy>> mPolicySet
-
-
Method Detail
-
isEnable
public boolean isEnable()
-
isRenewal
public java.lang.String isRenewal()
Is this a renewal profile
-
setRenewal
public void setRenewal(boolean renewal)
-
isXmlOutput
public java.lang.String isXmlOutput()
is output going to be in xml?
-
setXMLOutput
public void setXMLOutput(boolean xmlOutput)
-
getApprovedBy
public java.lang.String getApprovedBy()
Retrieves the user id of the person who approves this profile.- Returns:
- user id of the approver of this profile
-
setId
public void setId(java.lang.String id)
Sets id of this profile.- Parameters:
id
- profile identifier
-
getId
public java.lang.String getId()
Returns the identifier of this profile.- Returns:
- profile id
-
getRequestorDN
public java.lang.String getRequestorDN(IRequest request)
Retrieves a localized string that represents requestor's distinguished name. This string displayed in the request listing user interface.- Parameters:
request
- request- Returns:
- distringuished name of the request owner
-
getAuthenticatorId
public java.lang.String getAuthenticatorId()
Retrieves the instance id of the authenticator for this profile.- Returns:
- authenticator instance id
-
setAuthenticatorId
public void setAuthenticatorId(java.lang.String id)
Sets the instance id of the authenticator for this profile.- Parameters:
id
- authenticator instance id
-
setAuthzAcl
public void setAuthzAcl(java.lang.String id)
-
getAuthzAcl
public java.lang.String getAuthzAcl()
-
init
public void init(IConfigStore config) throws EBaseException
Initializes this profile.- Parameters:
config
- configuration store for this profile- Throws:
EBaseException
- failed to initialize
-
getConfigStore
public IConfigStore getConfigStore()
Retrieves the configuration store of this profile.- Returns:
- configuration store
-
getInputNames
public java.util.Enumeration<java.lang.String> getInputNames()
-
getProfileUpdaterIds
public java.util.Enumeration<java.lang.String> getProfileUpdaterIds()
-
getProfileUpdater
public IProfileUpdater getProfileUpdater(java.lang.String name)
-
getProfileOutputIds
public java.util.Enumeration<java.lang.String> getProfileOutputIds()
Retrieves a list of output policy IDs.- Returns:
- output policy id list
-
getProfileOutput
public ProfileOutput getProfileOutput(java.lang.String id)
Retrieves output policy by id.- Parameters:
id
- output policy id- Returns:
- output policy instance
-
getProfileInputIds
public java.util.Enumeration<java.lang.String> getProfileInputIds()
Retrieves a list of input policy IDs.- Returns:
- input policy id list
-
getProfileInput
public ProfileInput getProfileInput(java.lang.String id)
Retrieves input policy by id.- Parameters:
id
- input policy id- Returns:
- input policy instance
-
addInputName
public void addInputName(java.lang.String name)
-
getInputDescriptor
public IDescriptor getInputDescriptor(java.lang.String name)
-
getInput
public java.lang.String getInput(java.lang.String name, java.util.Locale locale, IRequest request) throws EProfileException
- Throws:
EProfileException
-
setInput
public void setInput(java.lang.String name, java.util.Locale locale, IRequest request, java.lang.String value) throws EProfileException
- Throws:
EProfileException
-
getProfilePolicySetIds
public java.util.Enumeration<java.lang.String> getProfilePolicySetIds()
Returns the profile policy set identifiers.- Returns:
- a list of policy set id
-
deleteProfilePolicy
public void deleteProfilePolicy(java.lang.String setId, java.lang.String policyId) throws EProfileException
Deletes a policy.- Parameters:
setId
- id of the policy setpolicyId
- id of policy to delete- Throws:
EProfileException
- failed to delete
-
deleteAllProfilePolicies
public void deleteAllProfilePolicies() throws EProfileException
Delete all profile policies- Throws:
EProfileException
-
deleteProfileInput
public void deleteProfileInput(java.lang.String inputId) throws EProfileException
Deletes input policy by id.- Parameters:
inputId
- id of the input policy- Throws:
EProfileException
- failed to delete
-
deleteAllProfileInputs
public void deleteAllProfileInputs() throws EProfileException
Delete all profile inputs- Throws:
EProfileException
-
deleteProfileOutput
public void deleteProfileOutput(java.lang.String outputId) throws EProfileException
Deletes output policy by id.- Parameters:
outputId
- id of the output policy- Throws:
EProfileException
- failed to delete
-
deleteAllProfileOutputs
public void deleteAllProfileOutputs() throws EProfileException
Delete all profile inputs- Throws:
EProfileException
-
createProfileOutput
public ProfileOutput createProfileOutput(java.lang.String id, java.lang.String outputID, NameValuePairs nvps) throws EProfileException
Creates a output policy.- Parameters:
id
- output policy idoutputID
- id of the registered output implementationnvps
- default parameters- Returns:
- output policy
- Throws:
EProfileException
- failed to create
-
createProfileOutput
public ProfileOutput createProfileOutput(java.lang.String id, java.lang.String outputId, NameValuePairs nvps, boolean createConfig) throws EProfileException
- Throws:
EProfileException
-
createProfileInput
public ProfileInput createProfileInput(java.lang.String id, java.lang.String inputID, NameValuePairs nvps) throws EProfileException
Creates a input policy.- Parameters:
id
- input policy idinputID
- id of the registered input implementationnvps
- default parameters- Returns:
- input policy
- Throws:
EProfileException
- failed to create
-
createProfileInput
public ProfileInput createProfileInput(java.lang.String id, java.lang.String inputId, NameValuePairs nvps, boolean createConfig) throws EProfileException
- Throws:
EProfileException
-
createProfilePolicy
public ProfilePolicy createProfilePolicy(java.lang.String setId, java.lang.String id, java.lang.String defaultClassId, java.lang.String constraintClassId) throws EProfileException
Creates a profile policy.- Parameters:
setId
- id of the policy set that owns this policyid
- policy iddefaultClassId
- id of the registered default implementationconstraintClassId
- id of the registered constraint implementation- Returns:
- profile policy instance
- Throws:
EProfileException
- failed to create policy
-
createProfilePolicy
public ProfilePolicy createProfilePolicy(java.lang.String setId, java.lang.String id, java.lang.String defaultClassId, java.lang.String constraintClassId, boolean createConfig) throws EProfileException
- Throws:
EProfileException
-
getProfilePolicy
public ProfilePolicy getProfilePolicy(java.lang.String setId, java.lang.String id)
Retrieves a policy.- Parameters:
setId
- set idid
- policy id- Returns:
- profile policy
-
isVisible
public boolean isVisible()
Checks if this profile is end-user profile or not. End-user profile will be displayed to the end user. Non end-user profile mainly is for registration manager.- Returns:
- end-user profile or not
-
setVisible
public void setVisible(boolean v)
Sets this profile end-user profile or not.- Parameters:
v
- end-user profile or not
-
getName
public java.lang.String getName(java.util.Locale locale)
Returns the profile name.- Parameters:
locale
- end-user locale- Returns:
- localized profile name
-
setName
public void setName(java.util.Locale locale, java.lang.String name)
Returns the profile name.- Parameters:
locale
- end-user localename
- profile name
-
createRequests
public abstract IRequest[] createRequests(java.util.Map<java.lang.String,java.lang.String> ctx, java.util.Locale locale) throws java.lang.Exception
Creates one or more requests. Normally, only one request will be created. In case of CRMF request, multiple requests may be created for one submission.- Parameters:
ctx
- profile contextlocale
- user locale- Returns:
- a list of requests
- Throws:
java.lang.Exception
- failed to create requests
-
getDescription
public java.lang.String getDescription(java.util.Locale locale)
Returns the profile description.- Parameters:
locale
- end-user locale- Returns:
- localized profile description
-
setDescription
public void setDescription(java.util.Locale locale, java.lang.String desc)
Returns the profile description.- Parameters:
locale
- end-user localedesc
- profile description
-
populateInput
public void populateInput(java.util.Map<java.lang.String,java.lang.String> ctx, IRequest request) throws java.lang.Exception
Populates user-supplied input values into the requests.- Parameters:
ctx
- profile contextrequest
- request- Throws:
java.lang.Exception
- failed to populate
-
getPolicies
public java.util.Vector<ProfilePolicy> getPolicies(java.lang.String setId)
-
getPolicySetId
public abstract java.lang.String getPolicySetId(IRequest req)
Retrieves a default set id for the given request. It is the profile's responsibility to return an appropriate set id for the request.- Parameters:
req
- request- Returns:
- policy set id
-
populate
public void populate(IRequest request) throws EProfileException
Passes the request to the set of default policies that populate the profile information against the profile.- Parameters:
request
- request- Throws:
EProfileException
- failed to populate default values
-
validate
public void validate(IRequest request) throws ERejectException
Passes the request to the set of constraint policies that validate the request against the profile.- Parameters:
request
- request- Throws:
ERejectException
- validation violation
-
getProfilePolicies
public java.util.Enumeration<ProfilePolicy> getProfilePolicies(java.lang.String setId)
Returns a list of profile policies.- Parameters:
setId
- set id- Returns:
- a list of policies
-
getProfilePolicyIds
public java.util.Enumeration<java.lang.String> getProfilePolicyIds(java.lang.String setId)
Retrieves all the policy id within a set.- Parameters:
setId
- set id- Returns:
- a list of policy id
-
execute
public void execute(IRequest request) throws EProfileException
Process a request after validation.- Parameters:
request
- request to be processed- Throws:
EProfileException
- failed to process
-
submit
public abstract void submit(IAuthToken token, IRequest request) throws EDeferException, EProfileException
Handles end-user request submission.- Parameters:
token
- authentication tokenrequest
- request to be processed- Throws:
EDeferException
- defer requestEProfileException
- failed to submit
-
submit
public abstract void submit(IAuthToken token, IRequest request, boolean explicitApprovalRequired) throws EDeferException, EProfileException
- Throws:
EDeferException
EProfileException
-
auditSubjectID
protected java.lang.String auditSubjectID()
Signed Audit Log Subject ID This method is used to obtain the "SubjectID" for a signed audit log message.- Returns:
- id string containing the signed audit log message SubjectID
-
-