org.apache.turbine.services.intake.model
Class Group

java.lang.Object
  |
  +--org.apache.turbine.services.intake.model.Group
All Implemented Interfaces:
Recyclable

public class Group
extends java.lang.Object
implements Recyclable

Holds a group of Fields


Field Summary
protected  RunData data
          The object containing the request data
private  boolean disposed
           
static java.lang.String EMPTY
           
protected  java.util.Map fields
          A map of the fields in this group mapped by field name.
protected  Field[] fieldsArray
          An array of fields in this group.
protected  java.lang.String gid
          The key used to represent this group in a parameter.
protected  boolean isDeclared
          A flag to help prevent duplicate hidden fields declaring this group.
protected  java.util.Map mapToObjectFields
          Map of the fields by mapToObject
protected  java.lang.String name
          The name used in templates and java code to refer to this group.
static java.lang.String NEW
           
protected  java.lang.String oid
          The object id used to associate this group to a bean for one request cycle
private  int poolCapacity
          The number of Groups with the same name that will be pooled.
 
Constructor Summary
Group(XmlGroup group)
          Constructs a new Group based on the xml specification.
 
Method Summary
 void appendHtmlFormInput(java.lang.StringBuffer sb)
          A xhtml valid hidden input field that notifies intake of the group's presence.
 void dispose()
          Disposes the object after use.
 Field get(java.lang.String fieldName)
          Get the Field .
 java.lang.String[] getFieldNames()
          Gets a list of the names of the fields stored in this object.
 java.lang.String getGID()
          Get the part of the key used to specify the group.
 java.lang.String getHtmlFormInput()
          A xhtml valid hidden input field that notifies intake of the group's presence.
 java.lang.String getIntakeGroupName()
          Return the name given to this group.
 java.lang.String getObjectKey()
          Concatenation of gid and oid.
 java.util.ArrayList getObjects(RunData data)
          Describe getObjects method here.
 java.lang.String getOID()
          Get the part of the key that distinguishes a group from others of the same name.
 int getPoolCapacity()
          Get the number of Group objects that will be pooled.
 void getProperties(java.lang.Object obj)
          Calls getter methods on objects that are known to Intake so that field values in forms can be initialized from the values contained in the intake tool.
 Group init(Retrievable obj)
          Initializes the group with properties from an object.
 Group init(RunData data)
          Initializes the default Group with parameters from RunData.
 Group init(java.lang.String key, RunData data)
          Initializes the Group with parameters from RunData corresponding to key.
 boolean isAllValid()
          Performs an AND between all the fields in this group.
 boolean isDisposed()
          Checks whether the recyclable has been disposed.
 void recycle()
          Recycles the object for a new client.
 void removeFromRequest()
          Removes references to this group and its fields from the query parameters
 void resetDeclared()
          To be used in the event this group is used within multiple forms within the same template.
 void setProperties(java.lang.Object obj)
          Calls a setter methods on obj, for fields which have been set.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

EMPTY

public static final java.lang.String EMPTY

NEW

public static final java.lang.String NEW

gid

protected final java.lang.String gid
The key used to represent this group in a parameter. This key is usually a prefix as part of a field key.

name

protected final java.lang.String name
The name used in templates and java code to refer to this group.

poolCapacity

private final int poolCapacity
The number of Groups with the same name that will be pooled.

fields

protected java.util.Map fields
A map of the fields in this group mapped by field name.

mapToObjectFields

protected java.util.Map mapToObjectFields
Map of the fields by mapToObject

fieldsArray

protected Field[] fieldsArray
An array of fields in this group.

oid

protected java.lang.String oid
The object id used to associate this group to a bean for one request cycle

data

protected RunData data
The object containing the request data

isDeclared

protected boolean isDeclared
A flag to help prevent duplicate hidden fields declaring this group.

disposed

private boolean disposed
Constructor Detail

Group

public Group(XmlGroup group)
      throws java.lang.Exception
Constructs a new Group based on the xml specification. Groups are instantiated and pooled by the IntakeService and should not be instantiated otherwise.
Parameters:
group - a XmlGroup value
Throws:
java.lang.Exception - if an error occurs in other classes
Method Detail

init

public Group init(RunData data)
           throws TurbineException
Initializes the default Group with parameters from RunData.
Parameters:
data - a RunData value
Returns:
this Group

init

public Group init(java.lang.String key,
                  RunData data)
           throws TurbineException
Initializes the Group with parameters from RunData corresponding to key.
Parameters:
data - a RunData value
Returns:
this Group

init

public Group init(Retrievable obj)
Initializes the group with properties from an object.
Parameters:
obj - a Persistent value
Returns:
a Group value

getFieldNames

public java.lang.String[] getFieldNames()
Gets a list of the names of the fields stored in this object.
Returns:
A String array containing the list of names.

getIntakeGroupName

public java.lang.String getIntakeGroupName()
Return the name given to this group. The long name is to avoid conflicts with the get(String key) method.
Returns:
a String value

getPoolCapacity

public int getPoolCapacity()
Get the number of Group objects that will be pooled.
Returns:
an int value

getGID

public java.lang.String getGID()
Get the part of the key used to specify the group. This is specified in the key attribute in the xml file.
Returns:
a String value

getOID

public java.lang.String getOID()
Get the part of the key that distinguishes a group from others of the same name.
Returns:
a String value

getObjectKey

public java.lang.String getObjectKey()
Concatenation of gid and oid.
Returns:
a String value

getObjects

public java.util.ArrayList getObjects(RunData data)
                               throws TurbineException
Describe getObjects method here.
Parameters:
pp - a ParameterParser value
Returns:
an ArrayList value
Throws:
TurbineException - if an error occurs

get

public Field get(java.lang.String fieldName)
          throws TurbineException
Get the Field .
Returns:
Field.

isAllValid

public boolean isAllValid()
Performs an AND between all the fields in this group.
Returns:
a boolean value

setProperties

public void setProperties(java.lang.Object obj)
                   throws TurbineException
Calls a setter methods on obj, for fields which have been set.
Throws:
throws - up any exceptions resulting from failure to check input validity.

getProperties

public void getProperties(java.lang.Object obj)
                   throws java.lang.Exception
Calls getter methods on objects that are known to Intake so that field values in forms can be initialized from the values contained in the intake tool.

removeFromRequest

public void removeFromRequest()
Removes references to this group and its fields from the query parameters

resetDeclared

public void resetDeclared()
To be used in the event this group is used within multiple forms within the same template.

getHtmlFormInput

public java.lang.String getHtmlFormInput()
A xhtml valid hidden input field that notifies intake of the group's presence.
Returns:
a String value

appendHtmlFormInput

public void appendHtmlFormInput(java.lang.StringBuffer sb)
A xhtml valid hidden input field that notifies intake of the group's presence.

recycle

public void recycle()
Recycles the object for a new client. Recycle methods with parameters must be added to implementing object and they will be automatically called by pool implementations when the object is taken from the pool for a new client. The parameters must correspond to the parameters of the constructors of the object. For new objects, constructors can call their corresponding recycle methods whenever applicable. The recycle methods must call their super.
Specified by:
recycle in interface Recyclable

dispose

public void dispose()
Disposes the object after use. The method is called when the object is returned to its pool. The dispose method must call its super.
Specified by:
dispose in interface Recyclable

isDisposed

public boolean isDisposed()
Checks whether the recyclable has been disposed.
Specified by:
isDisposed in interface Recyclable
Returns:
true, if the recyclable is disposed.


Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.