com.ibm.commerce.context.previewimpl

Class PreviewContextImpl

    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM copyright notice field.
        See Also:
        Constant Field Values
    • Constructor Detail

      • PreviewContextImpl

        public PreviewContextImpl()
        Creates the preview context.
    • Method Detail

      • getContextName

        public java.lang.String getContextName()
        Returns the name of the context which is the PreviewContext interface name.
        Specified by:
        getContextName in interface Context
        Returns:
        The name of the context.
        See Also:
        Context.getContextName()
      • toString

        public java.lang.String toString()
        Returns the string representation of the object.
        Overrides:
        toString in class AbstractContextImpl
        Returns:
        The string representation of the object.
      • getTimestamp

        public java.sql.Timestamp getTimestamp()
        Returns the appropriate timestamp to the caller to use when performing an operation. If the timestamp has not been adjusted by one of the setTimestamp() methods then the actual timestamp returns. If the timestamp has been adjusted, then the adjusted version of the timestamp returns.
        Specified by:
        getTimestamp in interface PreviewContext
        Returns:
        The appropriate timestamp to use for the operation.
      • setTimestamp

        public void setTimestamp(java.sql.Timestamp timeStamp)
        Sets the time to be used by the session. When the timestamp is set, time will still move forward but based on the specified timestamp and not the current timestamp.
        Specified by:
        setTimestamp in interface PreviewContext
        Parameters:
        timeStamp - The new time of the session.
      • setTimestamp

        public void setTimestamp(java.sql.Timestamp timeStamp,
                                 boolean isStat)
        Sets the time to be used by the session. When the timestamp is set and time is not static, time will still elapse but based on the specified timestamp and not the current timestamp. If time is static then this time will always return.
        Specified by:
        setTimestamp in interface PreviewContext
        Parameters:
        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.
      • setProperty

        public void setProperty(java.lang.String key,
                                java.lang.String value)
        Sets a property to associate with preview. These properties will be used by particular components and they can react accordingly whether the property is specified and what value the property contains.
        Specified by:
        setProperty in interface PreviewContext
        Parameters:
        key - The property name.
        value - The property value.
      • getProperties

        public java.util.Map<java.lang.String,java.lang.String> getProperties()
        Returns the preview properties.
        Returns:
        The preview properties.
      • getProperty

        public java.lang.String getProperty(java.lang.String key)
        Returns the property value based on the specified property name.
        Specified by:
        getProperty in interface PreviewContext
        Parameters:
        key - The property name.
        Returns:
        The value associated with the specified key. If the key does not exist then null is returned.
      • getPropertyNames

        public java.util.Iterator getPropertyNames()
        Returns an iterator of property names (set using setProperty) currently contained in the preview context.
        Specified by:
        getPropertyNames in interface PreviewContext
        Returns:
        The available property names.
      • initializeContext

        public void initializeContext(com.ibm.commerce.component.contextservice.ActivityData initData,
                                      Context ctx)
                               throws BusinessContextException
        Initializes the context based on the context passed in as the argument and updates it using the initData.
        Overrides:
        initializeContext in class AbstractContextImpl
        Parameters:
        initData - The set of attributes that are passed by the request
        ctx - The particular context of the token being copied
        Throws:
        BusinessContextException - on any error
      • clearContext

        public void clearContext()
        This method is called when the ContextSPI object is returned to their respective object pool. The purpose of this object is to reset the instance variables to its uninitialized values.
        Specified by:
        clearContext in class AbstractContextImpl
        See Also:
        AbstractContextImpl.clear()
      • copyContext

        public void copyContext(Context ctx)
        Copy the content of the specified context to this context.
        Specified by:
        copyContext in interface Context
        Parameters:
        ctx - The context to be copied from.