com.arsdigita.portal
Class Portlet

java.lang.Object
  extended bycom.arsdigita.domain.DomainObject
      extended bycom.arsdigita.domain.ObservableDomainObject
          extended bycom.arsdigita.kernel.ACSObject
              extended bycom.arsdigita.kernel.Resource
                  extended bycom.arsdigita.portal.Portlet
Direct Known Subclasses:
AgentPortlet, AppPortlet

public class Portlet
extends Resource

A Portlet is a domain class that provides a window or channel into a content source ( such as a web application, content item, remote content site). The portlet is added, usually along with other portlets, to a Portal which provides a way for multiple sources of content to be agregated on one web page view.

The database object which backs a Portlet contains a sortkey and a cell number which are used by the containing Portal to determine where on the Portal page the Portlet should appear. The Portlet's database object also includes a 'Profile' field. This field may be used by implementors to set a value for a recommended width for a particular portlet.

The contents of a Portlet are rendered via a PortletRenderer.

The Portlet class was designed to be extended for custom implementations.

Version:
$Id: //core-platform/dev/src/com/arsdigita/portal/Portlet.java#17 $
Author:
Justin Ross

Field Summary
static String BASE_DATA_OBJECT_TYPE
           
static String versionId
           
 
Fields inherited from class com.arsdigita.kernel.Resource
CHILD_RESOURCE, DESCRIPTION, PARENT_RESOURCE, RESOURCE_TYPE, TIMESTAMP, TITLE
 
Fields inherited from class com.arsdigita.kernel.ACSObject
CONTAINER, DEFAULT_DOMAIN_CLASS, DISPLAY_NAME, ID, OBJECT_TYPE
 
Constructor Summary
protected Portlet(DataObject dataObject)
           
  Portlet(OID oid)
           
 
Method Summary
 void afterSave()
           
 void beforeSave()
           
static Portlet createPortlet(PortletType portletType, Resource parent)
           
static Portlet createPortlet(String portletObjectType, Resource parent)
           
protected  AbstractPortletRenderer doGetPortletRenderer()
          Get the portlet renderer for this portlet.
protected  String getBaseDataObjectType()
          Returns the base data object type for this domain object class.
 int getCellNumber()
           
protected  ACSObject getContainer()
          Returns the container for this object, or null if there is no container.
 Portal getPortal()
           
 PortletRenderer getPortletRenderer()
           
 PortletType getPortletType()
           
 String getProfile()
           
 int getSortKey()
           
protected  boolean isContainerModified()
          Returns true if this object has been moved to a new container, or null if the container has not changed.
protected  long newExpirationDate()
          Deprecated.  
static Portlet retrievePortlet(BigDecimal id)
          Retrieve a portlet given its portlet ID.
static Portlet retrievePortlet(DataObject dataObject)
          Retrieve a portlet given its data object.
static Portlet retrievePortlet(OID oid)
          Retrieve a portlet given its OID.
 void setCellNumber(int cellNumber)
           
 void setPortal(Portal portal)
           
 void setPortletType(PortletType portletType)
           
 void setSortKey(int sortKey)
           
 
Methods inherited from class com.arsdigita.kernel.Resource
createResource, createResource, getChildResources, getContainingResource, getDescription, getDisplayName, getParentResource, getResourceType, getTimestamp, getTitle, retrieveAllResources, retrieveResource, retrieveResource, retrieveResource, setDescription, setParentResource, setResourceType, setTitle
 
Methods inherited from class com.arsdigita.kernel.ACSObject
assertPrivilege, checkPrivilege, doCreateCheck, doWriteCheck, getDefaultDomainClass, getID, getSpecificObjectType, getSpecificOID, gimmeContainer, initialize, setID, setID
 
Methods inherited from class com.arsdigita.domain.ObservableDomainObject
addObserver, getObservers
 
Methods inherited from class com.arsdigita.domain.DomainObject
add, add, addToAssociation, afterDelete, 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

versionId

public static final String versionId
See Also:
Constant Field Values

BASE_DATA_OBJECT_TYPE

public static final String BASE_DATA_OBJECT_TYPE
See Also:
Constant Field Values
Constructor Detail

Portlet

protected Portlet(DataObject dataObject)

Portlet

public Portlet(OID oid)
        throws DataObjectNotFoundException
Method Detail

getBaseDataObjectType

protected String getBaseDataObjectType()
Description copied from class: DomainObject
Returns the base data object type for this domain object class. Intended to be overrided by subclasses whenever the subclass will only work if their primary data object is of a certain base type.

Overrides:
getBaseDataObjectType in class Resource

createPortlet

public static Portlet createPortlet(PortletType portletType,
                                    Resource parent)

createPortlet

public static Portlet createPortlet(String portletObjectType,
                                    Resource parent)

beforeSave

public void beforeSave()
Overrides:
beforeSave in class Resource

afterSave

public void afterSave()
Overrides:
afterSave in class Resource

retrievePortlet

public static Portlet retrievePortlet(BigDecimal id)
Retrieve a portlet given its portlet ID.

Returns:
an existing portlet. Note that if none is found, null is returned.

retrievePortlet

public static Portlet retrievePortlet(OID oid)
Retrieve a portlet given its OID.

Returns:
an existing portlet. Note that if none is found, null is returned.

retrievePortlet

public static Portlet retrievePortlet(DataObject dataObject)
Retrieve a portlet given its data object.

Returns:
an existing portlet. Note that if none is found, null is returned.

getProfile

public String getProfile()

setPortal

public void setPortal(Portal portal)

getPortal

public Portal getPortal()

setPortletType

public void setPortletType(PortletType portletType)

getPortletType

public PortletType getPortletType()

getPortletRenderer

public PortletRenderer getPortletRenderer()

doGetPortletRenderer

protected AbstractPortletRenderer doGetPortletRenderer()
Get the portlet renderer for this portlet. The method getPortletRenderer() uses this method to return a renderer to DefaultPortalModel. Subclasses of Portlet must override this method and must not call super(). The base implementation simply throws an IllegalArgumentException.

Returns:
this portlet's renderer.
See Also:
getPortletRenderer()

newExpirationDate

protected long newExpirationDate()
Deprecated.  

Return the cacheing expiration date for this portlet. DefaultPortalModel uses this method to implement TTL-based cacheing of portlet domain object data. The implementation provided here is the current time plus five minutes.

Returns:
an expiration date in the future in milliseconds.

getContainer

protected ACSObject getContainer()
Description copied from class: ACSObject
Returns the container for this object, or null if there is no container. The container is produced by domain-specific logic based on any properties of the domain object. The resulting container is denormalized internally by ACSObject.save(). The denormalized container hierarchy is currently only used for generically determining what package instance an object belongs to. In the future, other generic services may be introduced that take advantage of the denormalized container hierarchy. While this method is not abstract, the default implementation "guesses" the container based on metadata about the object. If this object's data object type has a composite role property (required, visible property where com.arsdigita.persistence.metadata.Property.isComposite()==true), then we fetch the value of the composite role property, pass it to the DomainObjectFactory, and return the resulting domain object. If no composite role property is found, then the return value is null. Subclasses should provide their own implementations if the metadata driven default implementation is inadequate. For example, in a File Storage application, a "Folder" domain class could provide an implementationof getContainer() that returns the parent folder (if it exists) OR the package instance (if the folder is the root folder of one File Storage application instance).

Overrides:
getContainer in class Resource

isContainerModified

protected boolean isContainerModified()
Description copied from class: ACSObject
Returns true if this object has been moved to a new container, or null if the container has not changed. This methods is used by ACSObject.save() to determine when to denormalize the result of getContainer(). While this method is not abstract, the default implementation "guesses" the container based on metadata about the object. If this object's data object type has a composite role property (required, visible property where com.arsdigita.persistence.metadata.Property.isComposite()==true), then we check whether the composite role property has been modified. If no composite role is found, then the return value is false. Subclasses should provide their own implementations if the metadata driven default implementation is inadequate. See the example mentioned in getContainer().

Overrides:
isContainerModified in class Resource

setCellNumber

public void setCellNumber(int cellNumber)

getCellNumber

public int getCellNumber()

setSortKey

public void setSortKey(int sortKey)

getSortKey

public int getSortKey()


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