com.waveset.object
Class AbstractViewHandler

java.lang.Object
  extended bycom.waveset.object.AbstractViewHandler
All Implemented Interfaces:
ViewConstants, ViewHandler

public abstract class AbstractViewHandler
extends java.lang.Object
implements ViewHandler, ViewConstants

Base implementation of ViewHandler. Throws exceptions for methods, allowing you to implement only those that make sense for the your view.


Field Summary
static java.lang.String code_id
           
protected static Trace trace
           
 
Fields inherited from interface com.waveset.object.ViewConstants
ATT_COMMAND, ATT_DERIVED_FORM, ATT_ERRORS, ATT_FORCE_VALIDATION, ATT_NO_VALIDATION, ATT_PROCESS_INPUTS, ATT_REQUEST_STATE, ATT_RETURNING_FROM_REDIRECT, ATT_SESSION, ATT_SPE_CONTEXT, IDM_RESOURCE, LIGHTHOUSE_RESOURCE, OP_ALLOWED_WORK_ITEM_TRANSITIONS, OP_BACKGROUND, OP_DEFER_COMMIT, OP_FORM, OP_INTERACTIVE, OP_NEED_SPE_CONTEXT, OP_NO_DISABLE_HINT, OP_NO_FETCH, OP_OBJECT_ID, OP_OBJECT_TYPE, OP_ORGANIZATION, OP_PROCESS, OP_RAW, OP_TASK_RESULT, RESULT_ALLOWED_WORK_ITEM_TRANSITIONS, RESULT_CONTINUE, RESULT_KEEP_VIEW, RESULT_REQUIRES_CHALLENGE, RESULT_TASK_STATUS, RESULT_USER, TASK_STATUS_ERROR
 
Constructor Summary
AbstractViewHandler()
           
 
Method Summary
 WavesetResult checkinView(ViewMaster vm, GenericObject view, java.util.Map options)
          Save changes made to the view.
 boolean checkOption(java.util.Map options, java.lang.String name)
           
 GenericObject checkoutView(ViewMaster vm, java.lang.String id, java.util.Map options)
          Get an read/write view of an existing object.
 WavesetResult commitView(ViewMaster vm, GenericObject view, java.util.Map options)
          Save changes made to the view into the repository.
 GenericObject createView(ViewMaster vm, java.util.Map options)
          Create an empty object with an appropriate form.
 WavesetResult deleteView(ViewMaster vm, java.lang.String id, java.util.Map options)
          This is not called for most views.
 Form getForm(ViewMaster vm, GenericObject view, java.lang.String formId, java.util.Map options)
          Get an alternative form for an existing view.
 GenericObject getFormOptions(Form form, java.util.Map options)
          Given an initial options map, combine it with options specified in the form.
 java.util.Map getOptions(GenericObject view, java.util.Map options)
          Utility for view handlers.
 GenericObject getPropertiesView(PersistentObject obj)
          Given a PersistentObject, generate a view of any properties assigned to the view.
 GenericObject getView(ViewMaster vm, java.lang.String id, java.util.Map options)
          Get a read-only view of an existing object.
 boolean isFormHandler()
          By default, we return false here so that the ViewMaster will do form processing.
 GenericObject refreshView(ViewMaster vm, GenericObject view, java.util.Map options)
          Refresh view contents.
 void saveViewOptions(java.util.Map options, GenericObject view, java.lang.String[] exclusions)
          Save options passed through the API in the view for later.
 void setPropertiesView(GenericObject view, PersistentObject obj)
          Convert a properties view back into a PropertyList for a GenericObject.
 void throwUnsupported(java.lang.String methodName)
          Throw the standard "method not supported message.
 void unlockView(ViewMaster vm, GenericObject view, java.util.Map options)
          Unlock all object that underneath a particular view.
 
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 Trace trace
Constructor Detail

AbstractViewHandler

public AbstractViewHandler()
Method Detail

throwUnsupported

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

Throws:
WavesetException

createView

public GenericObject createView(ViewMaster vm,
                                java.util.Map options)
                         throws WavesetException
Description copied from interface: ViewHandler
Create an empty object with an appropriate form. Depending on the view, we might want to initialize the object with values, but this can also be defined in the form. The returned object will have been processed with Derivation and Default expressions defined in the form.

ViewMaster provides access to the repository, server cache, and authenticated session if necessary.

Specified by:
createView in interface ViewHandler
Throws:
WavesetException

getView

public GenericObject getView(ViewMaster vm,
                             java.lang.String id,
                             java.util.Map options)
                      throws WavesetException
Description copied from interface: ViewHandler
Get a read-only view of an existing object. The returned object will have been processed with Derivation and Default expressions defined in the form.

ViewMaster provides access to the repository, server cache, and authenticated session.

Specified by:
getView in interface ViewHandler
Throws:
WavesetException

getForm

public Form getForm(ViewMaster vm,
                    GenericObject view,
                    java.lang.String formId,
                    java.util.Map options)
             throws WavesetException
Description copied from interface: ViewHandler
Get an alternative form for an existing view. Also used when views use very large forms (e.g. the user form) and are not serialized with the view on the HttpSession, requiring the GUI to ask for it again when the form is posted.

Specified by:
getForm in interface ViewHandler
Throws:
WavesetException

checkoutView

public GenericObject checkoutView(ViewMaster vm,
                                  java.lang.String id,
                                  java.util.Map options)
                           throws WavesetException
Description copied from interface: ViewHandler
Get an read/write view of an existing object. Lock the underlying object(s) so they cannot be edited by someone other than the current session owner. The returned object will have been processed with Derivation and Default expressions defined in the form.

ViewMaster provides access to the repository, server cache, and authenticated session.

Specified by:
checkoutView in interface ViewHandler
Throws:
WavesetException

unlockView

public void unlockView(ViewMaster vm,
                       GenericObject view,
                       java.util.Map options)
                throws WavesetException
Description copied from interface: ViewHandler
Unlock all object that underneath a particular view.

Specified by:
unlockView in interface ViewHandler
Throws:
WavesetException

checkinView

public WavesetResult checkinView(ViewMaster vm,
                                 GenericObject view,
                                 java.util.Map options)
                          throws WavesetException
Description copied from interface: ViewHandler
Save changes made to the view. The view will be processed with Expansion expressions defined in the form prior to saving. This may have two side effects depending on the view handler. Some view handlers will immediately save the changes in the view into the corresponding repository objects. Others will pass the view into a workflow process. The workflow process may perform approvals or allow further editing of the view. When a workflow is used, the workflow process will eventually call the commit() method when it is ready to permanently store the view changes in the repository.

Specified by:
checkinView in interface ViewHandler
Throws:
WavesetException

commitView

public WavesetResult commitView(ViewMaster vm,
                                GenericObject view,
                                java.util.Map options)
                         throws WavesetException
Description copied from interface: ViewHandler
Save changes made to the view into the repository. This is intended to be called only by the workflow process that the view handler launches with checkinView. If the view handler does not launch a workflow process, then this method should throw an exception

Specified by:
commitView in interface ViewHandler
Throws:
WavesetException

refreshView

public GenericObject refreshView(ViewMaster vm,
                                 GenericObject view,
                                 java.util.Map options)
                          throws WavesetException
Description copied from interface: ViewHandler
Refresh view contents. In addition to handler specific operations, the view will also be processed with Expansion expressions, then Derivation expressions as defined in the form.

Specified by:
refreshView in interface ViewHandler
Throws:
WavesetException

isFormHandler

public boolean isFormHandler()
By default, we return false here so that the ViewMaster will do form processing.

Specified by:
isFormHandler in interface ViewHandler

getFormOptions

public GenericObject getFormOptions(Form form,
                                    java.util.Map options)
                             throws WavesetException
Given an initial options map, combine it with options specified in the form. This is generally used only in createView methods to establish the initial set of options. Thereafter options can be stored in the view under the viewOptions attribute. Always return a GenericObject so this can be saved in the view.

Throws:
WavesetException

saveViewOptions

public void saveViewOptions(java.util.Map options,
                            GenericObject view,
                            java.lang.String[] exclusions)
Save options passed through the API in the view for later. An exclusion list may be passed to prevent options from being saved. This was originally an inclusion list, now it's a rather long exclusion list. Consider using a HashTable for searching, though we generally don't have many options.


getOptions

public java.util.Map getOptions(GenericObject view,
                                java.util.Map options)
Utility for view handlers. Combine an options map specified in the method call with options that may be specified in the view. This makes it possible to specify view options in forms, all views should support this eventually. If an option exists in both the view and in the options map passed to the method, the view wins. This is important so that Forms can override JSPs.


checkOption

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

getPropertiesView

public GenericObject getPropertiesView(PersistentObject obj)
                                throws WavesetException
Given a PersistentObject, generate a view of any properties assigned to the view. Any persistent object may have set set of arbitrary properties, though they are usually restricted to user objects and more recently role objects. We don't have any semantic awareness of the properties, with the exception of the "tasks" property of the user object which we now have support for in WorkflowServices. Prior to 4.1SP2, user properties were not exposed in the view so the only to modify them was to use WorkflowServices methods. Where this view ends up in the parent view will be view specific. For simple views, it may just be in a top level attribute named "properties". For the user view it will be in waveset.properties and accounts[Lighthouse].properties. The duplication allows us to display a table of changes before the view is checked in. Though perhaps not a requirement, it is expected of extended attributes so we should try to support this for properties as well.

Throws:
WavesetException

setPropertiesView

public void setPropertiesView(GenericObject view,
                              PersistentObject obj)
Convert a properties view back into a PropertyList for a GenericObject. If the view is null, we'll assume that the property list should be left alone if it already exists. You have to pass an empty view if you want to clear the existing properties.


deleteView

public WavesetResult deleteView(ViewMaster vm,
                                java.lang.String id,
                                java.util.Map options)
                         throws WavesetException
This is not called for most views.

Specified by:
deleteView in interface ViewHandler
Throws:
WavesetException