com.tonbeller.jpivot.olap.model
Class OlapModelDecorator

java.lang.Object
  extended by com.tonbeller.jpivot.core.ExtensionSupport
      extended by com.tonbeller.jpivot.olap.model.OlapModelDecorator
All Implemented Interfaces:
Extension, Model, OlapModel, com.tonbeller.wcf.bookmarks.Bookmarkable
Direct Known Subclasses:
CachingOlapModel, OlapModelProxy

public class OlapModelDecorator
extends ExtensionSupport
implements OlapModel

a default decorator that delegates everything

Author:
av

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.tonbeller.jpivot.olap.model.OlapModel
OlapModel.EmptyCubeException, OlapModel.ResultTooLargeException
 
Field Summary
protected  OlapModel delegate
           
 
Fields inherited from interface com.tonbeller.wcf.bookmarks.Bookmarkable
EXTENSIONAL, INTENSIONAL
 
Constructor Summary
OlapModelDecorator()
          default ctor
OlapModelDecorator(OlapModel delegate)
           
 
Method Summary
 void addExtension(Extension extension)
          adds an extension to this model.
 void addModelChangeListener(ModelChangeListener l)
          adds a model change listener
 Model decorate(Model modelToDecorate)
          decorates the modelToDecorate with this
 void destroy()
          called once when the not used any longer.
 java.lang.Object getBookmarkState(int levelOfDetail)
           
 OlapModel getDelegate()
          gets the decorated model.
 Dimension[] getDimensions()
           
 Extension getExtension(java.lang.String id)
          returns the extension if this model instance supports it.
 java.util.Map getExtensions()
          returns a Map containing all extensions JSP scripting.
 java.lang.String getID()
           
 Member[] getMeasures()
           
 Result getResult()
          runs the query and returns the result
 Model getRootModel()
          Returns the bottom element of the decorator chain.
 Model getTopDecorator()
          returns the top of the decorator chain
 void initialize()
          called once after creation.
 void removeModelChangeListener(ModelChangeListener l)
          removes a model change listener
 void setBookmarkState(java.lang.Object state)
           
 void setDelegate(OlapModel modelToDecorate)
          sets the decorated model
 void setID(java.lang.String ID)
          sets an ID string for this model
 void setLocale(java.util.Locale locale)
          sets the locale for messages, data display etc
 void setServletContext(javax.servlet.ServletContext servletContext)
          store a servlet context to the model
 
Methods inherited from class com.tonbeller.jpivot.core.ExtensionSupport
getId, getModel, modelInitialized, setId, setModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

delegate

protected OlapModel delegate
Constructor Detail

OlapModelDecorator

public OlapModelDecorator()
default ctor

See Also:
setDelegate(com.tonbeller.jpivot.olap.model.OlapModel), decorate(com.tonbeller.jpivot.core.Model)

OlapModelDecorator

public OlapModelDecorator(OlapModel delegate)
Method Detail

getID

public java.lang.String getID()
Specified by:
getID in interface OlapModel
Returns:
an ID string for this model

setID

public void setID(java.lang.String ID)
Description copied from interface: OlapModel
sets an ID string for this model

Specified by:
setID in interface OlapModel

getResult

public Result getResult()
                 throws OlapException
Description copied from interface: OlapModel
runs the query and returns the result

Specified by:
getResult in interface OlapModel
Throws:
OlapException

getDimensions

public Dimension[] getDimensions()
Specified by:
getDimensions in interface OlapModel
Returns:
all dimensions of the cube for navigation

getMeasures

public Member[] getMeasures()
Specified by:
getMeasures in interface OlapModel
Returns:
all measures of the cube for navigation

getExtension

public Extension getExtension(java.lang.String id)
Description copied from interface: Model
returns the extension if this model instance supports it. Returns null if the extension is not supported.

Specified by:
getExtension in interface Model

getExtensions

public java.util.Map getExtensions()
Description copied from interface: Model
returns a Map containing all extensions JSP scripting. Key is the extension id, value is the extension.

Specified by:
getExtensions in interface Model

setLocale

public void setLocale(java.util.Locale locale)
Description copied from interface: Model
sets the locale for messages, data display etc

Specified by:
setLocale in interface Model

addExtension

public void addExtension(Extension extension)
Description copied from interface: Model
adds an extension to this model. Must call extension.setModel(this) to set the model reference.

Specified by:
addExtension in interface Model

addModelChangeListener

public void addModelChangeListener(ModelChangeListener l)
Description copied from interface: Model
adds a model change listener

Specified by:
addModelChangeListener in interface Model

removeModelChangeListener

public void removeModelChangeListener(ModelChangeListener l)
Description copied from interface: Model
removes a model change listener

Specified by:
removeModelChangeListener in interface Model

getBookmarkState

public java.lang.Object getBookmarkState(int levelOfDetail)
Specified by:
getBookmarkState in interface com.tonbeller.wcf.bookmarks.Bookmarkable

setBookmarkState

public void setBookmarkState(java.lang.Object state)
Specified by:
setBookmarkState in interface com.tonbeller.wcf.bookmarks.Bookmarkable

getTopDecorator

public Model getTopDecorator()
returns the top of the decorator chain

Specified by:
getTopDecorator in interface Model

getRootModel

public Model getRootModel()
Description copied from interface: Model
Returns the bottom element of the decorator chain. The returned model does not decorate any other model, its the end of the chain.

Specified by:
getRootModel in interface Model

decorate

public Model decorate(Model modelToDecorate)
decorates the modelToDecorate with this

Specified by:
decorate in interface Extension
Overrides:
decorate in class ExtensionSupport
Parameters:
modelToDecorate - the model to decorate. It may be different from the model passed to setModel() because other extensions may already have decorated modelToDecorate.

setDelegate

public void setDelegate(OlapModel modelToDecorate)
                 throws OlapException
sets the decorated model

Throws:
OlapException

getDelegate

public OlapModel getDelegate()
gets the decorated model. This is the immediate child in the decorator chain

See Also:
#getRootDecoree, getTopDecorator()

initialize

public void initialize()
                throws OlapException
Description copied from interface: OlapModel
called once after creation. E.g. open DB connection

Specified by:
initialize in interface OlapModel
Throws:
OlapException

destroy

public void destroy()
Description copied from interface: OlapModel
called once when the not used any longer. E.g. close DB connection

Specified by:
destroy in interface OlapModel

setServletContext

public void setServletContext(javax.servlet.ServletContext servletContext)
Description copied from interface: OlapModel
store a servlet context to the model

Specified by:
setServletContext in interface OlapModel