com.arsdigita.cms.contenttypes
Class Link

java.lang.Object
  extended bycom.arsdigita.domain.DomainObject
      extended bycom.arsdigita.domain.ObservableDomainObject
          extended bycom.arsdigita.kernel.ACSObject
              extended bycom.arsdigita.cms.contenttypes.Link

public class Link
extends com.arsdigita.kernel.ACSObject

This content type represents a Link content type for linking ContentItems and external links.

Version:
$Revision: #6 $ $Date: 2004/04/07 $
Author:
Nobuko Asakai (nasakai@redhat.com)

Field Summary
static String BASE_DATA_OBJECT_TYPE
          Data object type for this domain object
static String DESCRIPTION
          PDL property "description"
static String EXTERNAL_LINK
          Values for TARGET_TYPE
static String INTERNAL_LINK
           
static String ORDER
          PDL property "order"
static String TARGET_ITEM
          PDL property "targetItem"
static String TARGET_TYPE
          PDL property targetType
static String TARGET_URI
          PDL property "targetURI"
static String TARGET_WINDOW
          PDL property "targetWindow"
static String TITLE
          PDL properties cms_links.title
 
Fields inherited from class com.arsdigita.kernel.ACSObject
CONTAINER, DEFAULT_DOMAIN_CLASS, DISPLAY_NAME, ID, OBJECT_TYPE, versionId
 
Constructor Summary
Link()
          Default constructor.
Link(BigDecimal id)
          Constructor.
Link(com.arsdigita.persistence.DataObject obj)
          Constructor.
Link(com.arsdigita.persistence.OID id)
          Constructor.
Link(String type)
          Constructor.
 
Method Summary
protected  void alphabetize()
          This method is only used for setting initial sort keys for links which exist without them.
 String getDescription()
          Returns the description for this Link
 String getInternalOrExternalURI(com.arsdigita.bebop.PageState state)
          Returns the link URI as a String whether it is internal or external.
 Integer getOrder()
          Returns the link order for this Link
static com.arsdigita.persistence.DataCollection getReferringLinks(ContentItem item)
          Returns a DataCollection of links which refer to the given item.
protected  com.arsdigita.persistence.DataOperation getSwapOperation(String operationName)
          Given a data operation name, returns the DataOperation for use in swapKeys.
protected  com.arsdigita.persistence.DataQuery getSwapQuery(String queryName)
          Given a dataquery name, returns the (possibly filtered) DataQuery for use in swapKeys.
 ContentItem getTargetItem()
          Returns the target ContentItem of this Link
 String getTargetType()
          Returns the target type of this Link
 String getTargetURI()
          Returns the target URI of this Link
 String getTargetWindow()
          Returns the target Window of this Link
 String getTitle()
          Returns the title of this Link
 void setDescription(String description)
          sets the description for this Link
 void setOrder(int order)
          Sets the link order for this Link
 void setOrder(Integer order)
          Sets the link order for this Link
 void setTargetItem(ContentItem item)
          Sets the target ContentItem of this Link
 void setTargetType(String type)
          Sets the Target Type for this Link
 void setTargetURI(String uri)
          Sets the target URI of this Link
 void setTargetWindow(String window)
          Sets the target Window of this Link
 void setTitle(String title)
          Sets the title of this Link
protected  void swapKeys(boolean swapNext, String queryName, String operationName)
          This swaps the sort keys.
 void swapWithNext()
          no arg swapWithNext is not implemented for the base Link class.
 void swapWithNext(String queryName, String operationName)
          Swaps this Link with the next Link according to the specified ORDER attribute.
 void swapWithPrevious()
          no arg swapWithPrevious is not implemented for the base Link class.
 void swapWithPrevious(String queryName, String operationName)
          Swaps this Link with the previous Link according to the specified ORDER attribute.
 
Methods inherited from class com.arsdigita.kernel.ACSObject
assertPrivilege, beforeSave, checkPrivilege, doCreateCheck, doWriteCheck, getBaseDataObjectType, getContainer, getDefaultDomainClass, getDisplayName, getID, getSpecificObjectType, getSpecificOID, gimmeContainer, initialize, isContainerModified, setID, setID
 
Methods inherited from class com.arsdigita.domain.ObservableDomainObject
addObserver, getObservers
 
Methods inherited from class com.arsdigita.domain.DomainObject
add, add, addToAssociation, afterDelete, afterSave, beforeDelete, clear, delete, disconnect, equals, get, getObjectType, getOID, getSession, hashCode, isDeleted, isDisconnected, isModified, isNew, isPropertyModified, isValid, remove, remove, remove, removeFromAssociation, save, set, setAssociation, setAssociation, specializeDataObject, specializeDataObject, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TITLE

public static final String TITLE
PDL properties cms_links.title

See Also:
Constant Field Values

TARGET_TYPE

public static final String TARGET_TYPE
PDL property targetType

See Also:
Constant Field Values

EXTERNAL_LINK

public static final String EXTERNAL_LINK
Values for TARGET_TYPE

See Also:
Constant Field Values

INTERNAL_LINK

public static final String INTERNAL_LINK
See Also:
Constant Field Values

TARGET_URI

public static final String TARGET_URI
PDL property "targetURI"

See Also:
Constant Field Values

TARGET_ITEM

public static final String TARGET_ITEM
PDL property "targetItem"

See Also:
Constant Field Values

TARGET_WINDOW

public static final String TARGET_WINDOW
PDL property "targetWindow"

See Also:
Constant Field Values

DESCRIPTION

public static final String DESCRIPTION
PDL property "description"

See Also:
Constant Field Values

ORDER

public static final String ORDER
PDL property "order"

See Also:
Constant Field Values

BASE_DATA_OBJECT_TYPE

public static final String BASE_DATA_OBJECT_TYPE
Data object type for this domain object

See Also:
Constant Field Values
Constructor Detail

Link

public Link()
Default constructor. This creates a new Link.


Link

public Link(BigDecimal id)
     throws com.arsdigita.domain.DataObjectNotFoundException
Constructor. The contained DataObject is retrieved from the persistent storage mechanism with an OID specified by id and Link.BASE_DATA_OBJECT_TYPE.

Parameters:
id - The id for the retrieved DataObject

Link

public Link(com.arsdigita.persistence.OID id)
     throws com.arsdigita.domain.DataObjectNotFoundException
Constructor. The contained DataObject is retrieved from the persistent storage mechanism with an OID specified by oid.


Link

public Link(com.arsdigita.persistence.DataObject obj)
Constructor. Retrieves or creates a content item using the DataObject argument.

Parameters:
obj - The DataObject with which to create or load a content item

Link

public Link(String type)
Constructor. Creates a new Link using the given data object type.

Parameters:
type - The String data object type of the item to create
Method Detail

getTitle

public String getTitle()
Returns the title of this Link

Returns:
The Link title

setTitle

public void setTitle(String title)
Sets the title of this Link

Parameters:
title - The Link title

getTargetType

public String getTargetType()
Returns the target type of this Link

Returns:
The Target Type

setTargetType

public void setTargetType(String type)
Sets the Target Type for this Link

Parameters:
type - must be either Link.EXTERNAL_LINK or Link.INTERNAL_LINK

getTargetURI

public String getTargetURI()
Returns the target URI of this Link

Returns:
The Target Type

setTargetURI

public void setTargetURI(String uri)
Sets the target URI of this Link

Parameters:
uri - The Target URI

getTargetItem

public ContentItem getTargetItem()
Returns the target ContentItem of this Link

Returns:
The Target Type

setTargetItem

public void setTargetItem(ContentItem item)
Sets the target ContentItem of this Link


getTargetWindow

public String getTargetWindow()
Returns the target Window of this Link

Returns:
The Target Window

setTargetWindow

public void setTargetWindow(String window)
Sets the target Window of this Link

Parameters:
window - The Target Window

getDescription

public String getDescription()
Returns the description for this Link

Returns:
the description

setDescription

public void setDescription(String description)
sets the description for this Link

Parameters:
description - the description

getOrder

public Integer getOrder()
Returns the link order for this Link

Returns:
the link order

setOrder

public void setOrder(Integer order)
Sets the link order for this Link

Parameters:
order - the link order

setOrder

public void setOrder(int order)
Sets the link order for this Link

Parameters:
order - the link order

getInternalOrExternalURI

public String getInternalOrExternalURI(com.arsdigita.bebop.PageState state)
Returns the link URI as a String whether it is internal or external. Returns the empty string if no target item exists.

Parameters:
state - current PageState
Returns:
the Link URI

getReferringLinks

public static com.arsdigita.persistence.DataCollection getReferringLinks(ContentItem item)
Returns a DataCollection of links which refer to the given item. This method returns all links regardless of context (i.e. RelatedLinks and other links would all be included)

Parameters:
item - The target Item to return links for
Returns:
DataCollection of referring Links

swapWithNext

public void swapWithNext()
no arg swapWithNext is not implemented for the base Link class. Provide required implementation in a subclass, or use swapWithNext(String queryName) with a valid query name.

Throws:
UnsupportedOperationException

swapWithPrevious

public void swapWithPrevious()
no arg swapWithPrevious is not implemented for the base Link class. Provide required implementation in a subclass, or use swapWithPrevious(String queryName) with a valid query name.

Throws:
UnsupportedOperationException

swapWithNext

public void swapWithNext(String queryName,
                         String operationName)
Swaps this Link with the next Link according to the specified ORDER attribute. No filters are applied to the query, unless getSwapQuery() is overridden, applying relevant filters (such as link owner, etc. depending on the subclass implementation).

Parameters:
queryName - name of the DataQuery to use
operationName - name of the DataOperation to use

swapWithPrevious

public void swapWithPrevious(String queryName,
                             String operationName)
Swaps this Link with the previous Link according to the specified ORDER attribute. No filters are applied to the query, unless getSwapQuery() is overridden, applying relevant filters (such as link owner, etc. depending on the subclass implementation).

Parameters:
queryName - name of the DataQuery to use
operationName - name of the DataOperation to use

getSwapQuery

protected com.arsdigita.persistence.DataQuery getSwapQuery(String queryName)
Given a dataquery name, returns the (possibly filtered) DataQuery for use in swapKeys. This implementation does no additional filtering, so if this is required by a specific implementation, this method should be overridden to provide the filtering

Parameters:
queryName - name of the DataQuery to use
Returns:
the DataQuery

getSwapOperation

protected com.arsdigita.persistence.DataOperation getSwapOperation(String operationName)
Given a data operation name, returns the DataOperation for use in swapKeys. This implementation sets the "linkOrder" and "nextLinkOrder" parameters. If any other parameters are needed (such as ownerID, etc.), this method will need to be overridden

Parameters:
operationName - name of the DataOperation to use
Returns:
the DataOperation

swapKeys

protected void swapKeys(boolean swapNext,
                        String queryName,
                        String operationName)
This swaps the sort keys.

Parameters:
swapNext - This indicates if we are swapping with the next or the previous
queryName - This is used to find the key with which to swap

alphabetize

protected void alphabetize()
This method is only used for setting initial sort keys for links which exist without them. This is called by swapKeys instead of attempting to swap if the key found is null. Implementations which rely on using swapKeys should define something useful here based on the appropriate subset of Links to operate upon. This implementation simply returns without doing anything useful.



Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 21 2004:2352 UTC