com.opencms.template.cache
Class CmsElementVariant

java.lang.Object
  |
  +--com.opencms.template.cache.CmsElementVariant

public class CmsElementVariant
extends Object

An instance of CmsElementVariant stores a single cached variant for an element. This is the generated output (content) of an element. This cache stores all generated strings of this element and all links to other elements.

Author:
Andreas Schouten, Alexander Lucas

Constructor Summary
CmsElementVariant()
          Creates a new empty variant for an element.
 
Method Summary
 void add(byte[] staticContent)
          Adds static content to this variant.
 void add(byte[] staticContent, String encoding)
          Adds static content to this variant.
 void add(CmsElementLink elementLink)
          Adds an element-link to this variant.
 void add(CmsMethodLink methodLink)
          Adds an method-link to this variant.
 void add(String staticContent)
          Adds static content to this variant.
 void addDependencies(Vector depVariant)
          Add a dependencies Vector to this.
 Object get(int i)
          Returns a peace of this variant.
 Vector getDependencies()
          Gets the dependencies Vector of this Variant.
 long getNextTimeout()
          Returns the time when this variant has to be new generated.
 boolean isTimeCritical()
          Returns true if this variant has an expiration date.
 void mergeNextTimeout(long timeout)
          Merges the time when this variant has to be new generated.
 void setDependencies(Vector dependencies)
          Sets the dependencies Vector for this Variant.
 void setExported()
          Sets the marker exported to true.
 int size()
          Get the number of objects in this variant.
 String toString()
          Get a string representation of this variant.
 boolean wasExported()
          Returns true if this variant was allready exported.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CmsElementVariant

public CmsElementVariant()
Creates a new empty variant for an element.

Method Detail

add

public void add(String staticContent)
Adds static content to this variant.

Parameters:
staticContent - - part of the variant. A peace static content of type string.

add

public void add(byte[] staticContent)
Adds static content to this variant.

Parameters:
staticContent - - part of the variant. A peace static content of type byte-array.

add

public void add(byte[] staticContent,
                String encoding)
Adds static content to this variant.

Parameters:
staticContent - - part of the variant. A peace static content of type byte-array.

add

public void add(CmsElementLink elementLink)
Adds an element-link to this variant.

Parameters:
elementLink - - part of the variant. A link to another element.

add

public void add(CmsMethodLink methodLink)
Adds an method-link to this variant.

Parameters:
methodLink - - part of the variant. A link to an method.

size

public int size()
Get the number of objects in this variant.


get

public Object get(int i)
Returns a peace of this variant. It can be of the type String, byte[] or CmsElementLink.

Parameters:
i - - the index to the vector of variant-pieces.

setDependencies

public void setDependencies(Vector dependencies)
Sets the dependencies Vector for this Variant.

Parameters:
dependencies - A Vector of Strings.

wasExported

public boolean wasExported()
Returns true if this variant was allready exported.


setExported

public void setExported()
Sets the marker exported to true. Used when this variant is created in export modus.


getDependencies

public Vector getDependencies()
Gets the dependencies Vector of this Variant.

Returns:
dependencies A Vector of Strings.

addDependencies

public void addDependencies(Vector depVariant)
Add a dependencies Vector to this.

Parameters:
depVariant - The Vector with the dependencies.

toString

public String toString()
Get a string representation of this variant.

Overrides:
toString in class Object
Returns:
String representation.

mergeNextTimeout

public void mergeNextTimeout(long timeout)
Merges the time when this variant has to be new generated. Sets it to the minimum of the old and the new value, whereby 0 don't count.


getNextTimeout

public long getNextTimeout()
Returns the time when this variant has to be new generated.

Returns:
timeout. The date as a long.

isTimeCritical

public boolean isTimeCritical()
Returns true if this variant has an expiration date.