Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.RuntimeCollective.content.bean
Class ComplexContent  view ComplexContent download ComplexContent.java

java.lang.Object
  extended bycom.RuntimeCollective.content.bean.SimpleContent
      extended bycom.RuntimeCollective.content.bean.ComplexContent
All Implemented Interfaces:
Content, com.RuntimeCollective.webapps.bean.Duplicable, com.RuntimeCollective.webapps.bean.EntityBean, java.io.Serializable

public class ComplexContent
extends SimpleContent

A piece of content made up of one or more pieces of subcontent.

Version:
$Id: ComplexContent.java,v 1.11 2003/09/30 15:12:46 joe Exp $

Field Summary
static java.lang.String DATABASE_TABLE
          The name of the database table for this bean type.
private static int DEFAULT_ARRAY_SIZE
          The default size of the subcontent arrays
protected  java.util.HashMap iSubContents
          The SubContents
 
Fields inherited from class com.RuntimeCollective.content.bean.SimpleContent
Author_id, CreationDate, id, LastModifiedDate, LastModifierUser_id
 
Fields inherited from interface com.RuntimeCollective.webapps.bean.EntityBean
INTERFACE_BEAN, NULL_ID
 
Constructor Summary
ComplexContent()
          Construct a new blank ComplexContent, giving it a new unique ID.
ComplexContent(int id)
          Get a current ComplexContent from the RuntimeDataSource, given an id.
 
Method Summary
 void addSubContent(java.lang.String role, Content content)
          Add a SubContent to this ComplexContent under a given role, at the current max position + 1
 void delete()
          Delete this bean from the database.
 int getPositionOfSubContent(java.lang.String role, Content content)
          Get the position of this subcontent.
 java.util.Iterator getRoles()
          Get all Roles for which SubContents are defined at the moment.
 Content getSubContent(java.lang.String role, int position)
          Get one SubContent from this ComplexContent
 java.util.Iterator getSubContents(java.lang.String role)
          Get all the SubContents from this ComplexContent for a given role, and without their positions
private  java.util.Vector getSubContentsVector(java.lang.String role)
          Get the subcontents for the given role.
 void insertSubContent(java.lang.String role, int position, Content subContent)
          Insert one SubContent in this ComplexContent, under a given role and position.
 void removeSubContent(java.lang.String role, Content content)
          Remove a SubContent from this ComplexContent under a given role, and in all its positions (if more than one)
 void save()
          Save this bean to the database.
 void setSubContent(java.lang.String role, int position, Content subContent)
          Set one SubContent in this ComplexContent, under a given role and position
 
Methods inherited from class com.RuntimeCollective.content.bean.SimpleContent
customiseDuplicate, getAuthor, getCreationDate, getDescription, getId, getLastModifiedDate, getLastModifierUser, getTitle, makeDuplicate, makeDuplicate, setAuthor, setCreationDate, setDescription, setId, setLastModifiedDate, setLastModifierUser, setTitle, viewFormat
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_ARRAY_SIZE

private static final int DEFAULT_ARRAY_SIZE
The default size of the subcontent arrays

See Also:
Constant Field Values

DATABASE_TABLE

public static final java.lang.String DATABASE_TABLE
The name of the database table for this bean type.

See Also:
Constant Field Values

iSubContents

protected java.util.HashMap iSubContents
The SubContents

Constructor Detail

ComplexContent

public ComplexContent()
               throws java.sql.SQLException
Construct a new blank ComplexContent, giving it a new unique ID.


ComplexContent

public ComplexContent(int id)
               throws java.sql.SQLException
Get a current ComplexContent from the RuntimeDataSource, given an id.

Method Detail

save

public void save()
Save this bean to the database.

Specified by:
save in interface com.RuntimeCollective.webapps.bean.EntityBean
Overrides:
save in class SimpleContent

delete

public void delete()
Delete this bean from the database.

Specified by:
delete in interface com.RuntimeCollective.webapps.bean.EntityBean
Overrides:
delete in class SimpleContent

getRoles

public java.util.Iterator getRoles()
Get all Roles for which SubContents are defined at the moment.


setSubContent

public void setSubContent(java.lang.String role,
                          int position,
                          Content subContent)
Set one SubContent in this ComplexContent, under a given role and position


insertSubContent

public void insertSubContent(java.lang.String role,
                             int position,
                             Content subContent)
Insert one SubContent in this ComplexContent, under a given role and position. If there is already a subcontent in this position then its position will be incremented recursively. If this position is greater than the current length of the subcontents in this role, then the new sub content will be added to the end.


getSubContent

public Content getSubContent(java.lang.String role,
                             int position)
Get one SubContent from this ComplexContent


getSubContents

public java.util.Iterator getSubContents(java.lang.String role)
Get all the SubContents from this ComplexContent for a given role, and without their positions


removeSubContent

public void removeSubContent(java.lang.String role,
                             Content content)
Remove a SubContent from this ComplexContent under a given role, and in all its positions (if more than one)


addSubContent

public void addSubContent(java.lang.String role,
                          Content content)
Add a SubContent to this ComplexContent under a given role, at the current max position + 1


getPositionOfSubContent

public int getPositionOfSubContent(java.lang.String role,
                                   Content content)
Get the position of this subcontent. If there is more than one occurence then return the first. If this content does not contain this subcontent, then -1 is return.


getSubContentsVector

private java.util.Vector getSubContentsVector(java.lang.String role)
Get the subcontents for the given role. If none is found then a new one is constructed.