public class PreviewContextImpl extends AbstractContextImpl implements PreviewContext, PreviewConstants
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT
IBM copyright notice field.
|
SER_VALUE_SEP
ACTIVITY_DATA_PARAM_SERIALIZED_PREVIEW_CONTEXT, CONTEXT_NAME
INVENTORY_EVAL_FALSE, INVENTORY_EVAL_REAL, INVENTORY_EVAL_TRUE, PREVIEW_CTXT_DATA, PREVIEW_HOST, PREVIEW_INVENTORY, PREVIEW_MEMBER_GROUP_IDS_INCLUDED, PREVIEW_PATH, PREVIEW_PROP_POSITION, PREVIEW_REST_URI, PREVIEW_START_TIME, PREVIEW_STATIC, PREVIEW_TOKEN, REST_ATTRIBUTE_IN_PREVIEW
Constructor and Description |
---|
PreviewContextImpl()
Creates the preview context.
|
Modifier and Type | Method and Description |
---|---|
void |
clearContext()
This method is called when the ContextSPI object is returned to their respective object pool.
|
void |
copyContext(Context ctx)
Copy the content of the specified context to this context.
|
java.lang.Object[] |
getContextAttributes()
Returns an array of context attributes to be serialized and persisted.
|
java.lang.String |
getContextName()
Returns the name of the context which is the PreviewContext interface name.
|
java.util.Map<java.lang.String,java.lang.String> |
getProperties()
Returns the preview properties.
|
java.lang.String |
getProperty(java.lang.String key)
Returns the property value based on the specified property name.
|
java.util.Iterator |
getPropertyNames()
Returns an iterator of property names (set using setProperty) currently contained in the preview context.
|
java.sql.Timestamp |
getTimestamp()
Returns the appropriate timestamp to the caller to use when performing an operation.
|
void |
initializeContext(com.ibm.commerce.component.contextservice.ActivityData initData)
Initializes the context with the initialization data.
|
void |
initializeContext(com.ibm.commerce.component.contextservice.ActivityData initData,
Context ctx)
Initializes the context based on the context passed in as the argument
and updates it using the initData.
|
void |
preInvokeContext(com.ibm.commerce.component.contextservice.ActivityData sessionData)
Operation to perform at the beginning of each request.
|
void |
setContextAttributes(java.lang.String[] ctxAttrs)
Initializes the context from the specified list of attributes.
|
void |
setProperty(java.lang.String key,
java.lang.String value)
Sets a property to associate with preview.
|
void |
setTimestamp(java.sql.Timestamp timeStamp)
Sets the time to be used by the session.
|
void |
setTimestamp(java.sql.Timestamp timeStamp,
boolean isStat)
Sets the time to be used by the session.
|
java.lang.String |
toString()
Returns the string representation of the object.
|
boolean |
validate()
Validates the current context.
|
clear, getActivityToken, getContextSerializedString, initialize, initialize, isDirty, postInvoke, postInvokeContext, preInvoke, recalibrate, recalibrateContext, reset, resetContext, setContextSerializedString, setDirty
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
getActivityToken
public static final java.lang.String COPYRIGHT
public java.lang.String getContextName()
getContextName
in interface Context
Context.getContextName()
public java.lang.String toString()
toString
in class AbstractContextImpl
public boolean validate() throws BusinessContextException
validate
in interface Context
BusinessContextException
- if any one of the attributes is not validContext.validate()
public java.sql.Timestamp getTimestamp()
getTimestamp
in interface PreviewContext
public void setTimestamp(java.sql.Timestamp timeStamp)
setTimestamp
in interface PreviewContext
timeStamp
- The new time of the session.public void setTimestamp(java.sql.Timestamp timeStamp, boolean isStat)
setTimestamp
in interface PreviewContext
timeStamp
- The new time of the session.isStat
- Whether the time should be static. If the time is static, then this time will always
return.public void setProperty(java.lang.String key, java.lang.String value)
setProperty
in interface PreviewContext
key
- The property name.value
- The property value.public java.util.Map<java.lang.String,java.lang.String> getProperties()
public java.lang.String getProperty(java.lang.String key)
getProperty
in interface PreviewContext
key
- The property name.public java.util.Iterator getPropertyNames()
getPropertyNames
in interface PreviewContext
public void preInvokeContext(com.ibm.commerce.component.contextservice.ActivityData sessionData) throws BusinessContextException
preInvokeContext
in class AbstractContextImpl
sessionData
- The session data of the request.java.lang.Exception
- should never happen since no operation is performed.BusinessContextException
- on any error encounteredContextSPI.preInvoke(com.ibm.commerce.component.contextservice.ActivityData)
public void initializeContext(com.ibm.commerce.component.contextservice.ActivityData initData) throws BusinessContextException
initializeContext
in class AbstractContextImpl
initData
- The set of attributes that are passed in from the request.BusinessContextException
- on any errorAbstractContextImpl.initializeContext(ActivityData)
public java.lang.Object[] getContextAttributes() throws BusinessContextException
getContextAttributes
in class AbstractContextImpl
BusinessContextException
AbstractContextImpl.getContextSerializedString()
public void setContextAttributes(java.lang.String[] ctxAttrs) throws BusinessContextException
setContextAttributes
in class AbstractContextImpl
ctxAttrs
- An array of attributes of the contextBusinessContextException
public void initializeContext(com.ibm.commerce.component.contextservice.ActivityData initData, Context ctx) throws BusinessContextException
initializeContext
in class AbstractContextImpl
initData
- The set of attributes that are passed by the requestctx
- The particular context of the token being copiedBusinessContextException
- on any errorpublic void clearContext()
clearContext
in class AbstractContextImpl
AbstractContextImpl.clear()
public void copyContext(Context ctx)
copyContext
in interface Context
ctx
- The context to be copied from.