|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.waveset.object.LighthouseContextWrapper
com.waveset.object.ViewMaster
This class serves two purposes. First, system components that need to access views will use the "View Access API" to create views and store modifications. ViewMaster is responsible for locating the registered ViewHandler for the view, and passing control to the handler. It is the ViewHandler where the interesting work happens, ViewMaster is simply a fascade above the various handlers, isolating the rest of the system from knowledge of specific handler classes.
The second purpose of ViewMaster is to provide the "View Services API" which is to be used by ViewHandler implementations to access other parts of the system. ViewHandler methods are always passed a handle to a ViewMaster, from which the handlers request system services. Handlers should not access objects like Server or Repository directly, they must always go through ViewMaster.
Field Summary | |
protected java.lang.String |
_appName
The "application name" used when logging events. |
protected boolean |
_authorized
Kludge to disable authorization checking in some circumstances. |
protected static java.util.HashMap |
_handlers
Cache of resolved ViewHandler implementation classes. |
protected Subject |
_subject
The "subject" using our view. |
protected java.lang.String |
_subjectName
The (name of the) "subject" using our view. |
static java.lang.String |
code_id
|
protected static Trace |
trace
|
Fields inherited from class com.waveset.object.LighthouseContextWrapper |
_context |
Fields inherited from interface com.waveset.object.LighthouseContext |
COMP_ACCESS_POLICY, COMP_AUTH_CACHE, COMP_LOGIN_CONFIG_INFO, COMP_PROVISIONER, COMP_RECONCILER, COMP_REPOSITORY, COMP_SUBJECT_AUTH_CACHE, COMP_TASK_MANAGER, COMP_WORKFLOW, OP_CACHE, OP_CACHE_TIMEOUT, OP_CLEAR_CACHE, OP_NO_RESULT |
Fields inherited from interface com.waveset.object.ObjectSource |
HIGH_VALUES, OP_ALLOW_NOT_FOUND, OP_ATTRIBUTES, OP_BLOCK_SIZE, OP_BUFFERED, OP_CONDITIONS, OP_END_BEFORE, OP_FAST, OP_FILTER, OP_FORCE, OP_KEEP_LOCK, OP_MAX_ROWS, OP_NO_CACHE, OP_NO_RULE_DRIVEN_MEMBERS, OP_ONLY_NAMES, OP_ORDER_BY, OP_START_AFTER, OP_SUBJECT, OP_SUBTYPES, OP_USER |
Constructor Summary | |
ViewMaster()
Deprecated. - as of 3.5 use ViewMaster(LighthouseContext) |
|
ViewMaster(LighthouseContext context)
Build a ViewMaster wrapping an existing LighthouseContext. |
|
ViewMaster(java.lang.String subjectName,
java.lang.String appName)
Deprecated. - as of 3.5 use ViewMaster(LighthouseContext) |
|
ViewMaster(Subject subject,
java.lang.String appName)
Deprecated. - as of 3.5 use ViewMaster(LighthouseContext) |
Method Summary | |
void |
addErrors(GenericObject view,
java.util.List errors)
Add a list of errors to a view. |
java.lang.Object |
callRule(ExState state,
java.lang.String name,
java.util.Map args)
Implement this so we can perform special rule authorization during form processing. |
WavesetResult |
checkinView(GenericObject view,
java.util.Map options)
Apply changes made in a view to the underlying object, and store it back into the repository. |
boolean |
checkOption(java.util.Map options,
java.lang.String name)
Test a boolean option. |
GenericObject |
checkoutView(java.lang.String id,
java.util.Map options)
Checkout a view for editing. |
WavesetResult |
commitView(GenericObject view,
java.util.Map options)
Apply changes made in a view to the underlying object, and store it back into the repository. |
GenericObject |
createView(java.lang.String id,
java.util.Map options)
Create an empty view. |
void |
deleteTask(java.lang.String id)
Delete a task, presumably one that is finished. |
java.lang.String |
getAppName()
Returns the name of the "application" that is calling us. |
protected java.lang.Class |
getArbitraryHandlerClass(java.lang.String vtype)
Give any subclass (that likes our naming standard enough to inherit #getHandler) a chance to handle types that don't follow the convention. |
LighthouseContext |
getAuthenticatedContext(IDMXUser user)
Derive a LighthouseContext from this one, that is configured to perform operations on behalf of a user specified with an IDMXUser |
LighthouseContext |
getAuthenticatedContext(java.lang.String user)
Derive a LighthouseContext from this one, that is configured to perform operations on behalf of the named user. |
LighthouseContext |
getAuthenticatedContext(Subject subject)
Derive a LighthouseContext from this one, that is configured to perform operations on behalf of a user specified with a Subject. |
LighthouseContext |
getAuthenticatedContext(WSUser user)
Derive a LighthouseContext from this one, that is configured to perform operations on behalf of a user specified with a WSUser |
LighthouseContext |
getContext()
Kludge to detect between LighthouseContext and IDMXContext when accessing IDMX from IDM. |
Form |
getForm(GenericObject view,
java.util.Map options)
Get the form to be used with a view. |
Form |
getForm(GenericObject view,
java.lang.String formId,
java.util.Map options)
Get an alternate view form. |
protected ViewHandler |
getHandler(java.lang.String vtype)
Get the handler for a particular view type. |
protected java.lang.String |
getHandlerPackage()
Allow overriding by subclass to make handlers come from different packages. |
java.util.Locale |
getLocale()
Get the locale. |
java.lang.String |
getOptionString(java.util.Map options,
java.lang.String name)
Get an option. |
Subject |
getSubject()
If we are associated with a LocalSession, always prefer the Subject from there rather than the one in our LighthouseContext. |
TaskDefinition |
getTaskDefinition(java.lang.String id)
Gets a read-only copy of a TaskDefinition |
TaskDefinition |
getTaskDefinition(java.lang.String id,
boolean ignoreMissing)
Gets a read-only copy of a TaskDefinition. |
ObjectGroup[] |
getTopControlledObjectGroups(Subject subject)
Get Top Controlled Object Groups for a Subject |
java.lang.String |
getUser()
Returns the effective user name for an authenticated context. |
GenericObject |
getView(java.lang.String id,
java.util.Map options)
Generate a view given an abstract type name and an object ID. |
java.lang.String |
getViewName(GenericObject view)
Extract the "name" from a view id within a view. |
java.lang.String |
getViewName(java.lang.String vid)
Extract the "name" from a view id. |
java.lang.String |
getViewType(java.lang.String vid)
Extract the "type" from the view id. |
boolean |
isAdministrator()
Returns true if the current subject is an Administrator. |
boolean |
isAuthorized()
Test the "pre authorized" flag. |
boolean |
isRealAdministrator(java.lang.String userName)
We frequently want to know whether this is a "real" administrator so combine the tests. |
boolean |
isResetAdministrator()
Returns true if the subject is the Reset Administrator. |
boolean |
isSelf(java.lang.String userName)
Returns true if the subject is the same as the userName passed in |
QueryResult |
listAuthorizedObjects(Type type,
java.util.Map attributes)
Get an authorized list for a particular type, qualified by attributes. |
void |
logAuthorizationFailure(PersistentObject obj,
Right action)
|
void |
logAuthorizationFailure(PersistentObject obj,
java.lang.String action)
Log an authorization failure event. |
void |
logFailure(PersistentObject obj,
Right action)
Log a failure event, since the default reason is almost "database access failed" provide a method for that. |
void |
logFailure(PersistentObject obj,
Right action,
java.lang.String reason)
For backward compatibility, convert arguments and call the LighthouseContextWrapper method. |
void |
logFailure(PersistentObject obj,
java.lang.String action)
For backward compatibility, convert arguments and call the LighthouseContextWrapper method. |
void |
logResultErrors(PersistentObject obj,
Right action,
WavesetResult result)
|
void |
logResultErrors(PersistentObject obj,
java.lang.String action,
WavesetResult result)
Log any errors found within a WavesetResult. |
void |
logSuccess(PersistentObject obj,
Right action)
|
void |
logSuccess(PersistentObject obj,
java.lang.String action)
Log a success event for an object. |
void |
logSuccess(PersistentObject obj,
java.lang.String action,
java.util.Map oldValues,
java.util.Map newValues)
Log a success event for an object, include new and old values that will be stored in the blob of the audit table. |
void |
prepareViewSession(GenericObject view)
Ensure that a view has a valid display.session attribute before evaluating form expressions. |
GenericObject |
refreshView(GenericObject view,
java.util.Map options)
Refresh a view. |
void |
releaseViewSession(GenericObject view)
Must be called after calling prepareViewSession. |
void |
runDerivations(FormState fs,
GenericObject view)
Run derivations given an existing FormState. |
void |
runExpansions(FormState fs,
GenericObject view,
boolean validate)
Public expansion runner that can be called by ViewHandlers that need more control over when expansion is run, and how the FormState is created. |
TaskInstance |
runTask(TaskTemplate tt)
Launch a task defined by a task template. |
void |
setAuthorized(boolean b)
Set the "pre authorized" flag. |
protected static void |
setHandler(java.lang.String name,
java.lang.Class handler)
Store something in the global handler cache. |
static void |
setHandler(java.lang.String name,
java.lang.String handler)
Register a view handler. |
void |
setSubject(Subject subject)
Change the effective user for logical locking. |
void |
setUser(java.lang.String name)
Change the effective user for logical locking. |
protected void |
throwUnsupported(java.lang.String methodName)
Throw the standard "method not supported message. |
void |
unlockObject(PersistentObject obj)
Unlock an object. |
void |
unlockView(GenericObject view,
java.util.Map options)
Unlock a view. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String code_id
protected static final Trace trace
protected static java.util.HashMap _handlers
protected java.lang.String _appName
protected Subject _subject
protected java.lang.String _subjectName
protected boolean _authorized
I decided not to use the view option map for this, since it would expose a rather obvious security hole, anyone could pass in the option through the session API. As an alternative, the session API could always filter this option.
I thought about removing the Subject from the ViewMaster, but that's nice to have to convey the name for database locks and audit events. Instead, we have a flag that says if we're in "pre-authorized" mode.
Next, I considered testing this flag in the checkAuthorization method, but it really needs to be tested by the view handler, since end-user authorization is performed in a different way. Also, even if authorization checking is off, there may still be a need to call checkAuthorization and testAuthorization and have them work as usual. So, we're leaving it up the ViewHandler to test this flag and do whatever is appropriate.
Constructor Detail |
public ViewMaster(LighthouseContext context) throws WavesetException
public ViewMaster() throws WavesetException
Since TaskContext now provides a LighthouseContext, there is no longer a need for custom tasks to create their own ViewMaster.
Currently used by FirstAmerican TaskDefinition-LinkAccounts, used only to refresh a view within a work item variable. No longer necessary.
public ViewMaster(Subject subject, java.lang.String appName) throws WavesetException
Since TaskContext now provides a LighthouseContext, there is no longer a need for custom tasks to create their own ViewMaster.
Currently, this is used by MerrillLynchDeleteUsers, ProBusiness DeleteUsers, DellProcessNameChangdUsers, and DellProcessTerminatedUsers.
public ViewMaster(java.lang.String subjectName, java.lang.String appName) throws WavesetException
Currently used by TaskDefinition-DellNameChange, used only to call ViewUtil.getForm.
Method Detail |
public LighthouseContext getContext()
public static void setHandler(java.lang.String name, java.lang.String handler)
protected static void setHandler(java.lang.String name, java.lang.Class handler)
protected ViewHandler getHandler(java.lang.String vtype) throws WavesetException
WavesetException
protected java.lang.String getHandlerPackage()
protected java.lang.Class getArbitraryHandlerClass(java.lang.String vtype)
public GenericObject createView(java.lang.String id, java.util.Map options) throws WavesetException
createView
in interface ObjectSource
createView
in class LighthouseContextWrapper
WavesetException
public GenericObject getView(java.lang.String id, java.util.Map options) throws WavesetException
The options list is a map of arbitrary name/value pairs, we might want to evolve this to a ViewMaster.Options object?
getView
in interface ObjectSource
getView
in class LighthouseContextWrapper
WavesetException
public Form getForm(GenericObject view, java.util.Map options) throws WavesetException
ObjectSource
getForm
in interface ObjectSource
getForm
in class LighthouseContextWrapper
WavesetException
public Form getForm(GenericObject view, java.lang.String formId, java.util.Map options) throws WavesetException
WavesetException
public GenericObject checkoutView(java.lang.String id, java.util.Map options) throws WavesetException
checkoutView
in interface ObjectSource
checkoutView
in class LighthouseContextWrapper
WavesetException
public void unlockView(GenericObject view, java.util.Map options) throws WavesetException
unlockView
in interface ObjectSource
unlockView
in class LighthouseContextWrapper
WavesetException
public WavesetResult checkinView(GenericObject view, java.util.Map options) throws WavesetException
checkinView
in interface ObjectSource
checkinView
in class LighthouseContextWrapper
WavesetException
public WavesetResult commitView(GenericObject view, java.util.Map options) throws WavesetException
commitView
in interface ObjectSource
commitView
in class LighthouseContextWrapper
WavesetException
public GenericObject refreshView(GenericObject view, java.util.Map options) throws WavesetException
refreshView
in interface ObjectSource
refreshView
in class LighthouseContextWrapper
WavesetException
public void runDerivations(FormState fs, GenericObject view) throws WavesetException
WavesetException
public void prepareViewSession(GenericObject view) throws WavesetException
UPDATE: When the dust settles, FormUtil needs to be reimplemented using LighthouseContext rather than Session.
WavesetException
public void releaseViewSession(GenericObject view)
public void runExpansions(FormState fs, GenericObject view, boolean validate) throws WavesetException
WavesetException
public void addErrors(GenericObject view, java.util.List errors)
public java.lang.Object callRule(ExState state, java.lang.String name, java.util.Map args) throws WavesetException
callRule
in interface RuleExecutor
WavesetException
public TaskDefinition getTaskDefinition(java.lang.String id) throws WavesetException
TaskDefinition
id
- ID of the TaskDefinition to obtain
TaskDefinition
whose ID is equal to the input
parameter
WavesetException
- if no TaskDefinition exists with an
ID equal to the input parameter or if there is a problem obtaining
the definitionpublic TaskDefinition getTaskDefinition(java.lang.String id, boolean ignoreMissing) throws WavesetException
getTaskDefinition(String)
in that if ignoreMissing
is true, does not throw an exception if no TaskDefinition exists whose
ID is equal to the input parameter
id
- ID of the TaskDefinition to obtainignoreMissing
- when true suppresses ItemNotFound
exception
if there is not TaskDefinition
with ID id
in
the repo
TaskDefinition
whose ID is equal to the input
parameter
WavesetException
- if there is a problem obtaining
the definitionpublic LighthouseContext getAuthenticatedContext(java.lang.String user) throws WavesetException
LighthouseContext
getAuthenticatedContext
in interface LighthouseContext
getAuthenticatedContext
in class LighthouseContextWrapper
WavesetException
public LighthouseContext getAuthenticatedContext(Subject subject) throws WavesetException
LighthouseContext
getAuthenticatedContext
in interface LighthouseContext
getAuthenticatedContext
in class LighthouseContextWrapper
WavesetException
public LighthouseContext getAuthenticatedContext(WSUser user) throws WavesetException
LighthouseContext
getAuthenticatedContext
in interface LighthouseContext
getAuthenticatedContext
in class LighthouseContextWrapper
WavesetException
public LighthouseContext getAuthenticatedContext(IDMXUser user) throws WavesetException
LighthouseContext
getAuthenticatedContext
in interface LighthouseContext
getAuthenticatedContext
in class LighthouseContextWrapper
WavesetException
public void setUser(java.lang.String name) throws WavesetException
LighthouseContext
setUser
in interface LighthouseContext
setUser
in class LighthouseContextWrapper
WavesetException
public void setSubject(Subject subject) throws WavesetException
LighthouseContext
setSubject
in interface LighthouseContext
setSubject
in class LighthouseContextWrapper
WavesetException
public java.lang.String getUser()
LighthouseContext
getUser
in interface LighthouseContext
getUser
in class LighthouseContextWrapper
public Subject getSubject()
getSubject
in interface LighthouseContext
getSubject
in class LighthouseContextWrapper
public ObjectGroup[] getTopControlledObjectGroups(Subject subject) throws WavesetException
Returns the set of 0 or more object groups controlled by the specified principal, each of which has no object group parent that is also controlled by the principal.
getTopControlledObjectGroups
in interface LighthouseContext
getTopControlledObjectGroups
in class LighthouseContextWrapper
WavesetException
public void logSuccess(PersistentObject obj, Right action) throws WavesetException
WavesetException
public void logSuccess(PersistentObject obj, java.lang.String action) throws WavesetException
LighthouseContext
logSuccess
in interface LighthouseContext
logSuccess
in class LighthouseContextWrapper
WavesetException
public void logSuccess(PersistentObject obj, java.lang.String action, java.util.Map oldValues, java.util.Map newValues) throws WavesetException
LighthouseContext
logSuccess
in interface LighthouseContext
logSuccess
in class LighthouseContextWrapper
WavesetException
public void logResultErrors(PersistentObject obj, Right action, WavesetResult result) throws WavesetException
WavesetException
public void logResultErrors(PersistentObject obj, java.lang.String action, WavesetResult result) throws WavesetException
LighthouseContext
logResultErrors
in interface LighthouseContext
logResultErrors
in class LighthouseContextWrapper
WavesetException
public TaskInstance runTask(TaskTemplate tt) throws WavesetException
LighthouseContext
runTask
in interface LighthouseContext
runTask
in class LighthouseContextWrapper
WavesetException
public void setAuthorized(boolean b)
public boolean isAuthorized()
public java.lang.String getViewType(java.lang.String vid)
public java.lang.String getViewName(java.lang.String vid)
public java.lang.String getViewName(GenericObject view)
public java.lang.String getOptionString(java.util.Map options, java.lang.String name)
public boolean checkOption(java.util.Map options, java.lang.String name)
public boolean isAdministrator()
public boolean isResetAdministrator()
public boolean isSelf(java.lang.String userName)
public boolean isRealAdministrator(java.lang.String userName)
Since we've merged Admins into Users, we need to enhance this test to include a check to see if the current admin is editting themselves. If so, return false, so all end user operations can be done correctly (e.g. setting expire password date, etc.)
public java.util.Locale getLocale() throws WavesetException
WavesetException
public java.lang.String getAppName()
public QueryResult listAuthorizedObjects(Type type, java.util.Map attributes) throws WavesetException
WavesetException
public void deleteTask(java.lang.String id) throws WavesetException
WavesetException
public void logFailure(PersistentObject obj, Right action) throws WavesetException
WavesetException
public void logFailure(PersistentObject obj, java.lang.String action) throws WavesetException
WavesetException
public void logFailure(PersistentObject obj, Right action, java.lang.String reason) throws WavesetException
WavesetException
public void logAuthorizationFailure(PersistentObject obj, java.lang.String action) throws WavesetException
WavesetException
public void logAuthorizationFailure(PersistentObject obj, Right action) throws WavesetException
WavesetException
public void unlockObject(PersistentObject obj) throws WavesetException
WavesetException
protected void throwUnsupported(java.lang.String methodName) throws WavesetException
WavesetException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |