org.liquidsite.core.content
Class ContentTranslator

java.lang.Object
  extended byorg.liquidsite.core.content.PersistentObject
      extended byorg.liquidsite.core.content.Content
          extended byorg.liquidsite.core.content.ContentTranslator

public class ContentTranslator
extends Content

A web site URL translator.


Field Summary
static int ALIAS_TYPE
          The alias translator type.
static int ERROR_TYPE
          The error translator type.
static int REDIRECT_TYPE
          The redirect translator type.
static int SECTION_TYPE
          The section translator type.
 
Fields inherited from class org.liquidsite.core.content.Content
DOCUMENT_CATEGORY, FILE_CATEGORY, FOLDER_CATEGORY, FORUM_CATEGORY, NAME_CHARS, PAGE_CATEGORY, POST_CATEGORY, SECTION_CATEGORY, SITE_CATEGORY, TEMPLATE_CATEGORY, TOPIC_CATEGORY, TRANSLATOR_CATEGORY
 
Fields inherited from class org.liquidsite.core.content.PersistentObject
BINDERS, LOWER_CASE, NUMBERS, UPPER_CASE
 
Constructor Summary
  ContentTranslator(ContentManager manager, Content parent)
          Creates a new translator with default values.
protected ContentTranslator(ContentManager manager, ContentData data, DataSource src)
          Creates a new translator.
 
Method Summary
protected  void doValidate()
          Validates the object data before writing to the database.
 Content getAlias(User user)
          Returns the translator alias content.
 int getAliasId()
          Returns the translator alias content identifier.
 java.lang.String getRedirectUrl()
          Returns the translator redirect URL.
 ContentSection getSection(User user)
          Returns the translator section.
 int getSectionId()
          Returns the translator section content identifier.
 int getType()
          Returns the translator type.
 void setAlias(Content alias)
          Sets the translator alias content.
 void setAliasId(int alias)
          Sets the translation alias content identifier.
 void setRedirectUrl(java.lang.String url)
          Sets the translation alias redirect URL.
 void setSection(ContentSection section)
          Sets the translator section.
 void setSectionId(int section)
          Sets the translation section content identifier.
 void setType(int type)
          Sets the translator type.
 
Methods inherited from class org.liquidsite.core.content.Content
deleteRevision, doDelete, doInsert, doUpdate, equals, equals, getAllRevisions, getAttribute, getAttributeNames, getAuthor, getAuthorName, getCategory, getComment, getDomain, getDomainName, getId, getLock, getMaxRevisionNumber, getModifiedDate, getName, getOfflineDate, getOnlineDate, getParent, getParent, getParentId, getPermissions, getRevision, getRevisionNumber, isLatestRevision, isOnline, isPublishedRevision, setAttribute, setAuthorName, setComment, setId, setModifiedDate, setName, setOfflineDate, setOnlineDate, setParent, setParentId, setRevisionNumber, toString
 
Methods inherited from class org.liquidsite.core.content.PersistentObject
decodeMap, delete, delete, encodeMap, getContentManager, hasAdminAccess, hasPublishAccess, hasReadAccess, hasWriteAccess, isPersistent, restore, restore, save, save, validateChars, validateSize
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ERROR_TYPE

public static final int ERROR_TYPE
The error translator type. Translators of this type have no additional link information, but may have pages or files with HTTP error code names. A page "404" would then match any "HTTP 404 Not Found" error.

See Also:
Constant Field Values

ALIAS_TYPE

public static final int ALIAS_TYPE
The alias translator type. Alias translators are linked to a site content object (in the same domain).

See Also:
getAlias(org.liquidsite.core.content.User), setAlias(org.liquidsite.core.content.Content), getAliasId(), setAliasId(int), Constant Field Values

REDIRECT_TYPE

public static final int REDIRECT_TYPE
The redirect translator type. Redirect translators sends a "HTTP 304 Moved Permanently" response with a base URL prepended to the request path.

See Also:
getRedirectUrl(), setRedirectUrl(java.lang.String), Constant Field Values

SECTION_TYPE

public static final int SECTION_TYPE
The section translator type. Section translators are linked to a content section object (in the same domain). It performs directory matches to child objects in the section.

See Also:
getSection(org.liquidsite.core.content.User), setSection(org.liquidsite.core.content.ContentSection), getSectionId(), setSectionId(int), Constant Field Values
Constructor Detail

ContentTranslator

public ContentTranslator(ContentManager manager,
                         Content parent)
                  throws ContentException
Creates a new translator with default values.

Parameters:
manager - the content manager to use
parent - the parent content object
Throws:
ContentException - if the database couldn't be accessed properly

ContentTranslator

protected ContentTranslator(ContentManager manager,
                            ContentData data,
                            DataSource src)
                     throws ContentException
Creates a new translator.

Parameters:
manager - the content manager to use
data - the content data object
src - the data source to use
Throws:
ContentException - if the database couldn't be accessed properly
Method Detail

getType

public int getType()
Returns the translator type.

Returns:
the translator type

setType

public void setType(int type)
Sets the translator type.

Parameters:
type - the new translator type

getAlias

public Content getAlias(User user)
                 throws ContentException,
                        ContentSecurityException
Returns the translator alias content. If the translator isn't of alias type, this method will return null.

Parameters:
user - the user performing the operation
Returns:
the translator alias content, or null for none
Throws:
ContentException - if the database couldn't be accessed properly
ContentSecurityException - if the user didn't have read access to the content

setAlias

public void setAlias(Content alias)
Sets the translator alias content. This method also sets the translator type.

Parameters:
alias - the new alias content, or null for none

getAliasId

public int getAliasId()
Returns the translator alias content identifier.

Returns:
the alias content identifier, or zero (0) if the translator isn't of alias type

setAliasId

public void setAliasId(int alias)
Sets the translation alias content identifier. This method also sets the translator type.

Parameters:
alias - the new alias content identifier

getRedirectUrl

public java.lang.String getRedirectUrl()
Returns the translator redirect URL.

Returns:
the redirect URL, or null if the translator isn't of redirect type

setRedirectUrl

public void setRedirectUrl(java.lang.String url)
Sets the translation alias redirect URL. This method also sets the translator type.

Parameters:
url - the new redirect URL

getSection

public ContentSection getSection(User user)
                          throws ContentException,
                                 ContentSecurityException
Returns the translator section. If the translator isn't of section type, this method will return null.

Parameters:
user - the user performing the operation
Returns:
the translator section, or null for none
Throws:
ContentException - if the database couldn't be accessed properly
ContentSecurityException - if the user didn't have read access to the section

setSection

public void setSection(ContentSection section)
Sets the translator section. This method also sets the translator type.

Parameters:
section - the new section, or null for none

getSectionId

public int getSectionId()
Returns the translator section content identifier.

Returns:
the section content identifier, or zero (0) if the translator isn't of section type

setSectionId

public void setSectionId(int section)
Sets the translation section content identifier. This method also sets the translator type.

Parameters:
section - the new section identifier

doValidate

protected void doValidate()
                   throws ContentException
Validates the object data before writing to the database.

Overrides:
doValidate in class Content
Throws:
ContentException - if the object data wasn't valid