com.waveset.object
Class ViewMaster

java.lang.Object
  extended bycom.waveset.object.LighthouseContextWrapper
      extended bycom.waveset.object.ViewMaster
All Implemented Interfaces:
LighthouseContext, ObjectSource, RuleExecutor

public class ViewMaster
extends LighthouseContextWrapper
implements RuleExecutor

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 com.waveset.object.LighthouseContextWrapper
breakLock, callResourceMethod, checkinObject, checkoutObject, checkPermission, checkPermission, checkPermissionToAnyAuthTypeSubType, checkReferencePermissions, clearResourceObjectGetCache, clearResourceObjectGetCache, clearResourceObjectListCache, clearResourceObjectListCache, countObjects, deleteObject, deleteObjects, deleteView, extendedOperation, getCache, getComponent, getLock, getObject, getObject, getObjectIfExists, getObjectIfExists, getObjects, getResourceObject, getResourceObjects, getSystemConfiguration, listObjects, listResourceObjects, listResourceObjects, lockObject, log, logFailure, logFailure, renameObject, setContext, subjectControlsObjectGroup, subjectHasRight, subjectHasRightToAnyAuthTypeSubType, subjectIsAssignedAdminGroups, testPermission, testPermission, unlockObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

code_id

public static final java.lang.String code_id
See Also:
Constant Field Values

trace

protected static final Trace trace

_handlers

protected static java.util.HashMap _handlers
Cache of resolved ViewHandler implementation classes. Note that we don't try to reuse ViewHandler instances, allow them to maintain state and not have to be thread safe.


_appName

protected java.lang.String _appName
The "application name" used when logging events. This is supposed to be the same as the application that ultimately caused this view to be used, which may be long gone since we can be used in the background.


_subject

protected Subject _subject
The "subject" using our view.


_subjectName

protected java.lang.String _subjectName
The (name of the) "subject" using our view.


_authorized

protected boolean _authorized
Kludge to disable authorization checking in some circumstances. Some of the views, notably ProcessViewer are used both through the Session layer, and also internally to launch process underneath other views. In the later case, we don't want to check authorization since it will already have been done by the upper view.

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

ViewMaster

public ViewMaster(LighthouseContext context)
           throws WavesetException
Build a ViewMaster wrapping an existing LighthouseContext. This is the preferred constructor as most components now should have access to a LighthouseContext.


ViewMaster

public ViewMaster()
           throws WavesetException
Deprecated. - as of 3.5 use ViewMaster(LighthouseContext)

Build an anonymous ViewMaster. This should no longer be used, but unfortunately is used by a few older custom tasks so we have to retain it temporarily. Since we have not been passed a LighthouseContext, we have to build one ourselves. This introduces a dependency on InternalSession.

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.


ViewMaster

public ViewMaster(Subject subject,
                  java.lang.String appName)
           throws WavesetException
Deprecated. - as of 3.5 use ViewMaster(LighthouseContext)

Build a view handler, able to check authorization on behalf of a particular subject. This should no longer be used, but it is used by a few older custom tasks so we must retain it temporarily.

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.


ViewMaster

public ViewMaster(java.lang.String subjectName,
                  java.lang.String appName)
           throws WavesetException
Deprecated. - as of 3.5 use ViewMaster(LighthouseContext)

Build a view master, given only an abstract subject name.

Currently used by TaskDefinition-DellNameChange, used only to call ViewUtil.getForm.

Method Detail

getContext

public LighthouseContext getContext()
Kludge to detect between LighthouseContext and IDMXContext when accessing IDMX from IDM.


setHandler

public static void setHandler(java.lang.String name,
                              java.lang.String handler)
Register a view handler. // jsl - made this public so we can register application specific // view handlers (e.g. for IDMX)


setHandler

protected static void setHandler(java.lang.String name,
                                 java.lang.Class handler)
Store something in the global handler cache.


getHandler

protected ViewHandler getHandler(java.lang.String vtype)
                          throws WavesetException
Get the handler for a particular view type. Originally we had a set of type constants and mapped them to class names here. Now we use naming conventions and reflection. Might want a registration object someday that would allow us to splice in alternate implementations. If the type name contains a '.' it is assumed to be a fully qualified class name and we leave it alone. Otherwise the class is assumed to be in the com.waveset.session package. If the name does not end with "Viewer", we will append "Viewer" and try to locate a class with that name. If one is not found, we will use the unmolested name. For backward compatibility with some old views that didn't follow this convention, we have some wired in constants.

Throws:
WavesetException

getHandlerPackage

protected java.lang.String getHandlerPackage()
Allow overriding by subclass to make handlers come from different packages.

Returns:
String like "com.waveset.view."

getArbitraryHandlerClass

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.


createView

public GenericObject createView(java.lang.String id,
                                java.util.Map options)
                         throws WavesetException
Create an empty view.

Specified by:
createView in interface ObjectSource
Overrides:
createView in class LighthouseContextWrapper
Throws:
WavesetException

getView

public GenericObject getView(java.lang.String id,
                             java.util.Map options)
                      throws WavesetException
Generate a view given an abstract type name and an object ID. This normally maps to a Type name and repository ID, but I'd like to reserve the right to support pseudo-types if necessary.

The options list is a map of arbitrary name/value pairs, we might want to evolve this to a ViewMaster.Options object?

Specified by:
getView in interface ObjectSource
Overrides:
getView in class LighthouseContextWrapper
Throws:
WavesetException

getForm

public Form getForm(GenericObject view,
                    java.util.Map options)
             throws WavesetException
Description copied from interface: ObjectSource
Get the form to be used with a view.

Specified by:
getForm in interface ObjectSource
Overrides:
getForm in class LighthouseContextWrapper
Throws:
WavesetException

getForm

public Form getForm(GenericObject view,
                    java.lang.String formId,
                    java.util.Map options)
             throws WavesetException
Get an alternate view form. The original signature that supported a formid argument, ObjectSource/LighthouseContext doesn't support that.

Throws:
WavesetException

checkoutView

public GenericObject checkoutView(java.lang.String id,
                                  java.util.Map options)
                           throws WavesetException
Checkout a view for editing. Since all of our views sit on top of one object, we'll usually call up to the normal Session.checkoutObject to handle locking issues.

Specified by:
checkoutView in interface ObjectSource
Overrides:
checkoutView in class LighthouseContextWrapper
Throws:
WavesetException

unlockView

public void unlockView(GenericObject view,
                       java.util.Map options)
                throws WavesetException
Unlock a view.

Specified by:
unlockView in interface ObjectSource
Overrides:
unlockView in class LighthouseContextWrapper
Throws:
WavesetException

checkinView

public WavesetResult checkinView(GenericObject view,
                                 java.util.Map options)
                          throws WavesetException
Apply changes made in a view to the underlying object, and store it back into the repository. Alternately this may pass the view to a workflow and the workflow will later call commitView to store it in the repository.

Specified by:
checkinView in interface ObjectSource
Overrides:
checkinView in class LighthouseContextWrapper
Throws:
WavesetException

commitView

public WavesetResult commitView(GenericObject view,
                                java.util.Map options)
                         throws WavesetException
Apply changes made in a view to the underlying object, and store it back into the repository.

Specified by:
commitView in interface ObjectSource
Overrides:
commitView in class LighthouseContextWrapper
Throws:
WavesetException

refreshView

public GenericObject refreshView(GenericObject view,
                                 java.util.Map options)
                          throws WavesetException
Refresh a view.

Specified by:
refreshView in interface ObjectSource
Overrides:
refreshView in class LighthouseContextWrapper
Throws:
WavesetException

runDerivations

public void runDerivations(FormState fs,
                           GenericObject view)
                    throws WavesetException
Run derivations given an existing FormState.

Throws:
WavesetException

prepareViewSession

public void prepareViewSession(GenericObject view)
                        throws WavesetException
Ensure that a view has a valid display.session attribute before evaluating form expressions. This is often necessary if there are any FormUtil s in Derivation or Expansions. If we're attached to a LocalSession use it, otherwise we must be being used underneath workflow so we have to get one from the pool using the context subject (which must be set). Need to think more about this. I don't really like having to create LocalSessions down here, but since FormUtil is "above" the session it really can't use anything else.

UPDATE: When the dust settles, FormUtil needs to be reimplemented using LighthouseContext rather than Session.

Throws:
WavesetException

releaseViewSession

public void releaseViewSession(GenericObject view)
Must be called after calling prepareViewSession. If we got a session from the pool, return it.


runExpansions

public void runExpansions(FormState fs,
                          GenericObject view,
                          boolean validate)
                   throws WavesetException
Public expansion runner that can be called by ViewHandlers that need more control over when expansion is run, and how the FormState is created. If the validate option is on, also do a validation pass. Note that validation has historically been done before expansion, but I could imagine cases where we want expansion to do things that may affect validation. Now that we've moved it under ViewMaster, ViewHandler can overload isFormHandler and do whatever is necessary.

Throws:
WavesetException

addErrors

public void addErrors(GenericObject view,
                      java.util.List errors)
Add a list of errors to a view.


callRule

public java.lang.Object callRule(ExState state,
                                 java.lang.String name,
                                 java.util.Map args)
                          throws WavesetException
Implement this so we can perform special rule authorization during form processing. Necessary only if we're wrapping a LocalSession. !! Think about having LighthouseContext implement ExResolver?

Specified by:
callRule in interface RuleExecutor
Throws:
WavesetException

getTaskDefinition

public TaskDefinition getTaskDefinition(java.lang.String id)
                                 throws WavesetException
Gets a read-only copy of a TaskDefinition

Parameters:
id - ID of the TaskDefinition to obtain
Returns:
TaskDefinition whose ID is equal to the input parameter
Throws:
WavesetException - if no TaskDefinition exists with an ID equal to the input parameter or if there is a problem obtaining the definition

getTaskDefinition

public TaskDefinition getTaskDefinition(java.lang.String id,
                                        boolean ignoreMissing)
                                 throws WavesetException
Gets a read-only copy of a TaskDefinition. Differs from 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

Parameters:
id - ID of the TaskDefinition to obtain
ignoreMissing - when true suppresses ItemNotFound exception if there is not TaskDefinition with ID id in the repo
Returns:
TaskDefinition whose ID is equal to the input parameter
Throws:
WavesetException - if there is a problem obtaining the definition

getAuthenticatedContext

public LighthouseContext getAuthenticatedContext(java.lang.String user)
                                          throws WavesetException
Description copied from interface: LighthouseContext
Derive a LighthouseContext from this one, that is configured to perform operations on behalf of the named user. An authenticated context does not need to pass the OP_USER option to methods such as checkinObject.

Specified by:
getAuthenticatedContext in interface LighthouseContext
Overrides:
getAuthenticatedContext in class LighthouseContextWrapper
Throws:
WavesetException

getAuthenticatedContext

public LighthouseContext getAuthenticatedContext(Subject subject)
                                          throws WavesetException
Description copied from interface: LighthouseContext
Derive a LighthouseContext from this one, that is configured to perform operations on behalf of a user specified with a Subject.

Specified by:
getAuthenticatedContext in interface LighthouseContext
Overrides:
getAuthenticatedContext in class LighthouseContextWrapper
Throws:
WavesetException

getAuthenticatedContext

public LighthouseContext getAuthenticatedContext(WSUser user)
                                          throws WavesetException
Description copied from interface: LighthouseContext
Derive a LighthouseContext from this one, that is configured to perform operations on behalf of a user specified with a WSUser

Specified by:
getAuthenticatedContext in interface LighthouseContext
Overrides:
getAuthenticatedContext in class LighthouseContextWrapper
Throws:
WavesetException

getAuthenticatedContext

public LighthouseContext getAuthenticatedContext(IDMXUser user)
                                          throws WavesetException
Description copied from interface: LighthouseContext
Derive a LighthouseContext from this one, that is configured to perform operations on behalf of a user specified with an IDMXUser

Specified by:
getAuthenticatedContext in interface LighthouseContext
Overrides:
getAuthenticatedContext in class LighthouseContextWrapper
Throws:
WavesetException

setUser

public void setUser(java.lang.String name)
             throws WavesetException
Description copied from interface: LighthouseContext
Change the effective user for logical locking. This should only be called if you know this is a private context that won't be shared by another thread. Here the user is specified by name.

Specified by:
setUser in interface LighthouseContext
Overrides:
setUser in class LighthouseContextWrapper
Throws:
WavesetException

setSubject

public void setSubject(Subject subject)
                throws WavesetException
Description copied from interface: LighthouseContext
Change the effective user for logical locking. This should only be called if you know this is a private context that won't be shared by another thread. Here the user is specified by Subject.

Specified by:
setSubject in interface LighthouseContext
Overrides:
setSubject in class LighthouseContextWrapper
Throws:
WavesetException

getUser

public java.lang.String getUser()
Description copied from interface: LighthouseContext
Returns the effective user name for an authenticated context. Returns null for an anonymous context.

Specified by:
getUser in interface LighthouseContext
Overrides:
getUser in class LighthouseContextWrapper

getSubject

public Subject getSubject()
If we are associated with a LocalSession, always prefer the Subject from there rather than the one in our LighthouseContext. It is important that the current Subject is always returned, as it may now contain dynamic information such as the application name, locale, and IP address used for loging.

Specified by:
getSubject in interface LighthouseContext
Overrides:
getSubject in class LighthouseContextWrapper

getTopControlledObjectGroups

public ObjectGroup[] getTopControlledObjectGroups(Subject subject)
                                           throws WavesetException
Get Top Controlled Object Groups for a Subject

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.

Specified by:
getTopControlledObjectGroups in interface LighthouseContext
Overrides:
getTopControlledObjectGroups in class LighthouseContextWrapper
Throws:
WavesetException

logSuccess

public void logSuccess(PersistentObject obj,
                       Right action)
                throws WavesetException
Throws:
WavesetException

logSuccess

public void logSuccess(PersistentObject obj,
                       java.lang.String action)
                throws WavesetException
Description copied from interface: LighthouseContext
Log a success event for an object.

Specified by:
logSuccess in interface LighthouseContext
Overrides:
logSuccess in class LighthouseContextWrapper
Throws:
WavesetException

logSuccess

public void logSuccess(PersistentObject obj,
                       java.lang.String action,
                       java.util.Map oldValues,
                       java.util.Map newValues)
                throws WavesetException
Description copied from interface: LighthouseContext
Log a success event for an object, include new and old values that will be stored in the blob of the audit table.

Specified by:
logSuccess in interface LighthouseContext
Overrides:
logSuccess in class LighthouseContextWrapper
Throws:
WavesetException

logResultErrors

public void logResultErrors(PersistentObject obj,
                            Right action,
                            WavesetResult result)
                     throws WavesetException
Throws:
WavesetException

logResultErrors

public void logResultErrors(PersistentObject obj,
                            java.lang.String action,
                            WavesetResult result)
                     throws WavesetException
Description copied from interface: LighthouseContext
Log any errors found within a WavesetResult.

Specified by:
logResultErrors in interface LighthouseContext
Overrides:
logResultErrors in class LighthouseContextWrapper
Throws:
WavesetException

runTask

public TaskInstance runTask(TaskTemplate tt)
                     throws WavesetException
Description copied from interface: LighthouseContext
Launch a task defined by a task template.

Specified by:
runTask in interface LighthouseContext
Overrides:
runTask in class LighthouseContextWrapper
Throws:
WavesetException

setAuthorized

public void setAuthorized(boolean b)
Set the "pre authorized" flag. When set causes some view handlers to bypass authorization checking. Should be set only by other view handlers that want to use a view in its implemenetation.


isAuthorized

public boolean isAuthorized()
Test the "pre authorized" flag.


getViewType

public java.lang.String getViewType(java.lang.String vid)
Extract the "type" from the view id. This is typically the name of a Type class, but it could be something arbitrary. If there is both a type and a name, they will be separated by a colon. If there is no colon, then this is considered to be an unqulaified type name. These are seen during create operations where a name has not yet been assigned.


getViewName

public java.lang.String getViewName(java.lang.String vid)
Extract the "name" from a view id. This is any text that follows the first colon.


getViewName

public java.lang.String getViewName(GenericObject view)
Extract the "name" from a view id within a view.


getOptionString

public java.lang.String getOptionString(java.util.Map options,
                                        java.lang.String name)
Get an option.


checkOption

public boolean checkOption(java.util.Map options,
                           java.lang.String name)
Test a boolean option.


isAdministrator

public boolean isAdministrator()
Returns true if the current subject is an Administrator.


isResetAdministrator

public boolean isResetAdministrator()
Returns true if the subject is the Reset Administrator. We probably should be comparing by repository id rather than name, but I'm not sure we're guaranteed to get that from the Subject. Assume for now that the admin can't be renamed.


isSelf

public boolean isSelf(java.lang.String userName)
Returns true if the subject is the same as the userName passed in


isRealAdministrator

public boolean isRealAdministrator(java.lang.String userName)
We frequently want to know whether this is a "real" administrator so combine the tests. Perhaps this should be the default? But that's kind of confusing.

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.)


getLocale

public java.util.Locale getLocale()
                           throws WavesetException
Get the locale.

Throws:
WavesetException

getAppName

public java.lang.String getAppName()
Returns the name of the "application" that is calling us. Since this is now contained within the Subject, it should be possible to eliminate this, and just pass the Subject around.


listAuthorizedObjects

public QueryResult listAuthorizedObjects(Type type,
                                         java.util.Map attributes)
                                  throws WavesetException
Get an authorized list for a particular type, qualified by attributes. Requires a LocalSession as that is where the filtering is currently implemented.

Throws:
WavesetException

deleteTask

public void deleteTask(java.lang.String id)
                throws WavesetException
Delete a task, presumably one that is finished. This is complicated due to potential dependencies on other objects. !! Delete dependencies should be handled by DeleteVisitor so we can just delete it through our LighthouseContext as usual.

Throws:
WavesetException

logFailure

public void logFailure(PersistentObject obj,
                       Right action)
                throws WavesetException
Log a failure event, since the default reason is almost "database access failed" provide a method for that. For backward compatibility, convert arguments and call the LighthouseContextWrapper method.

Throws:
WavesetException

logFailure

public void logFailure(PersistentObject obj,
                       java.lang.String action)
                throws WavesetException
For backward compatibility, convert arguments and call the LighthouseContextWrapper method.

Throws:
WavesetException

logFailure

public void logFailure(PersistentObject obj,
                       Right action,
                       java.lang.String reason)
                throws WavesetException
For backward compatibility, convert arguments and call the LighthouseContextWrapper method.

Throws:
WavesetException

logAuthorizationFailure

public void logAuthorizationFailure(PersistentObject obj,
                                    java.lang.String action)
                             throws WavesetException
Log an authorization failure event.

Throws:
WavesetException

logAuthorizationFailure

public void logAuthorizationFailure(PersistentObject obj,
                                    Right action)
                             throws WavesetException
Throws:
WavesetException

unlockObject

public void unlockObject(PersistentObject obj)
                  throws WavesetException
Unlock an object. Since view handlers fetch objects before testing authorization, it is usually more convenient to pass the object in if authorization fails rather than the type & id.

Throws:
WavesetException

throwUnsupported

protected void throwUnsupported(java.lang.String methodName)
                         throws WavesetException
Throw the standard "method not supported message.

Throws:
WavesetException