org.jasig.portal.layout
Class LayoutStructure

java.lang.Object
  extended by org.jasig.portal.layout.LayoutStructure

public final class LayoutStructure
extends java.lang.Object

LayoutStructure represents a channel or folder in a layout.

Since:
uPortal 2.5 - before 2.5 this class existed as a public inner class of RDBMUserLayoutStore.
Version:
$Revision: 1.2 $ $Date: 2005/05/16 17:27:27 $

Field Summary
private  int chanId
          The ID of any channel that this LayoutStructure instance is representing.
private  int childId
          The ID of the LayoutStructure that is the child of this LayoutStructure.
private  boolean hidden
          True if this LayoutStructure is hidden, false otherwise.
private  boolean immutable
          True if this LayoutStructure cannot be changed, false otherwise.
private  java.lang.String locale
           
private static org.apache.commons.logging.Log LOG
           
private  java.lang.String name
          When this LayoutStructure represents a folder, the name of that folder.
private  int nextId
          The ID of the LayoutStructure that is the next sibling of this LayoutStructure.
private  java.util.List parameters
          A List of StructureParameter instances representing parameters to this LayoutStructure.
private  int structId
          The ID of this LayoutStructure.
private  java.lang.String type
          When this LayoutStructure represents a folder, the type of that folder.
private  boolean unremovable
          True if this LayoutStructure cannot be removed, false otherwise.
 
Constructor Summary
LayoutStructure(int structId, int nextId, int childId, int chanId, java.lang.String hidden, java.lang.String unremovable, java.lang.String immutable)
          Instantiate a new LayoutStructure with the given configuration.
LayoutStructure(int structId, int nextId, int childId, int chanId, java.lang.String hidden, java.lang.String unremovable, java.lang.String immutable, java.lang.String locale)
          Instantiate a new LayoutStructure with the given configuration.
 
Method Summary
 void addFolderData(java.lang.String folderName, java.lang.String folderType)
          Add information about the folder represented by this LayoutStructure.
 void addParameter(java.lang.String paramName, java.lang.String paramValue)
          Add a parameter to this LayoutStructure.
 int getChanId()
          Get the id of the channel represented by this LayoutStructure instance, or zero if we do not represent a channel.
 int getChildId()
          Get the id of the child of this LayoutStructure, or zero if we do not have a child.
 java.lang.String getLocale()
          Get the locale of this LayoutStructure.
 java.lang.String getName()
          Get the name of the folder that this LayoutStructure represents, or null if this LayoutStructure does not represent a folder.
 int getNextId()
          Get the id of the next LayoutStructure or zero if there is no next LayoutStructure.
 java.util.List getParameters()
          Get a List of StructureParameter instances representing parameters of this LayoutStructure instance.
 int getStructId()
          Get the id of this LayoutStructure.
 java.lang.String getType()
          Get the String representing the type of the folder that this LayoutStructure represents, or null if this LayoutStructure does not represent a folder.
 boolean isChannel()
          Returns true if this LayoutStructure represents a channel, false otherwise.
 boolean isHidden()
          Return true if this LayoutStructure is hidden, false otherwise.
 boolean isImmutable()
          Returns true if this LayoutStructure is immutable, false otherwise.
 boolean isUnremovable()
          Return true if this structure is unremovable, false otherwise.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOG

private static final org.apache.commons.logging.Log LOG

structId

private final int structId
The ID of this LayoutStructure.


nextId

private final int nextId
The ID of the LayoutStructure that is the next sibling of this LayoutStructure.


childId

private final int childId
The ID of the LayoutStructure that is the child of this LayoutStructure.


chanId

private final int chanId
The ID of any channel that this LayoutStructure instance is representing. Zero if this LayoutStructure instance does not represent a channel.


name

private java.lang.String name
When this LayoutStructure represents a folder, the name of that folder. Null otherwise.


type

private java.lang.String type
When this LayoutStructure represents a folder, the type of that folder. Null otherwise.


hidden

private boolean hidden
True if this LayoutStructure is hidden, false otherwise.


unremovable

private boolean unremovable
True if this LayoutStructure cannot be removed, false otherwise.


immutable

private boolean immutable
True if this LayoutStructure cannot be changed, false otherwise.


parameters

private final java.util.List parameters
A List of StructureParameter instances representing parameters to this LayoutStructure. Prior to uPortal 2.5, this field was null when there were no parameters. Now this field is never null and no parameters are repreesented by an empty list.


locale

private java.lang.String locale
Constructor Detail

LayoutStructure

public LayoutStructure(int structId,
                       int nextId,
                       int childId,
                       int chanId,
                       java.lang.String hidden,
                       java.lang.String unremovable,
                       java.lang.String immutable)
Instantiate a new LayoutStructure with the given configuration.

Parameters:
structId - the id of this LayoutStructure
nextId - the id of the next sibling of this LayoutStructure
childId - the id of the first child of this LayoutStructure
chanId - the id of the channel represented by this LayoutStructure, or zero if we do not represent a channel
hidden - "T" or "Y" if this LayoutStructure is hidden
unremovable - "T" or "Y" if this LayoutStructure is unremovable
immutable - "T" or "Y" if this LayoutStructure is unchangeable

LayoutStructure

public LayoutStructure(int structId,
                       int nextId,
                       int childId,
                       int chanId,
                       java.lang.String hidden,
                       java.lang.String unremovable,
                       java.lang.String immutable,
                       java.lang.String locale)
Instantiate a new LayoutStructure with the given configuration.

Parameters:
structId - the id of this LayoutStructure
nextId - the id of the next sibling of this LayoutStructure
childId - the id of the first child of this LayoutStructure
chanId - the id of the channel represented by this LayoutStructure, or zero if we do not represent a channel
hidden - "T" or "Y" if this LayoutStructure is hidden
unremovable - "T" or "Y" if this LayoutStructure is unremovable
immutable - "T" or "Y" if this LayoutStructure is unchangeable
locale - the locale of this LayoutStructure
Method Detail

addFolderData

public void addFolderData(java.lang.String folderName,
                          java.lang.String folderType)
Add information about the folder represented by this LayoutStructure.

Parameters:
folderName - the name of the folder
folderType - the type of the folder

isChannel

public boolean isChannel()
Returns true if this LayoutStructure represents a channel, false otherwise. Otherwise is the case where this LayoutStructure represents a folder.

Returns:
true if a channel, false if a folder.

addParameter

public void addParameter(java.lang.String paramName,
                         java.lang.String paramValue)
Add a parameter to this LayoutStructure.

Parameters:
paramName - the name of the parameter
paramValue - the value of the parameter

getNextId

public int getNextId()
Get the id of the next LayoutStructure or zero if there is no next LayoutStructure.

Returns:
0 or the id of the next layout structure.

getChildId

public int getChildId()
Get the id of the child of this LayoutStructure, or zero if we do not have a child.

Returns:
0 or the id of our child.

getChanId

public int getChanId()
Get the id of the channel represented by this LayoutStructure instance, or zero if we do not represent a channel.

Returns:
0 or the id of the channel

getStructId

public int getStructId()
Get the id of this LayoutStructure.

Returns:
the id of this LayoutStructure.

isHidden

public boolean isHidden()
Return true if this LayoutStructure is hidden, false otherwise.

Returns:
true if this LayoutStructure is hidden, false otherwise.

isImmutable

public boolean isImmutable()
Returns true if this LayoutStructure is immutable, false otherwise.

Returns:
false if this LayoutStructure can be changed, true otherwise.

getLocale

public java.lang.String getLocale()
Get the locale of this LayoutStructure.

Returns:
the locale of this LayoutStructure.

getName

public java.lang.String getName()
Get the name of the folder that this LayoutStructure represents, or null if this LayoutStructure does not represent a folder.

Returns:
the name of this LayoutStructure.

getParameters

public java.util.List getParameters()
Get a List of StructureParameter instances representing parameters of this LayoutStructure instance. Prior to uPortal 2.5, this method would return null when there were no parameters. Now we return an empty list when there are no parameters. This simplifies consumers of this class, who can simply blithely iterate over the empty list and no longer have to check for null.

Returns:
a List of StructureParameter instances.

getType

public java.lang.String getType()
Get the String representing the type of the folder that this LayoutStructure represents, or null if this LayoutStructure does not represent a folder. Different layout management approaches may define differing types of folders for their own purposes. The core types typically used by all are: header, footer, and regular. The value returned is the value found in the up_layout_struct table's type column. For instances of LayoutStructure that represent a channel this method will return a value of null.

Returns:
a String representing the type of this layout structure.

isUnremovable

public boolean isUnremovable()
Return true if this structure is unremovable, false otherwise.

Returns:
false if this structure can be removed, true otherwise.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object