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

java.lang.Object
  extended byorg.apache.turbine.services.intake.model.Group

public class Group
extends java.lang.Object

Holds a group of Fields

Version:
$Id: Group.java 538811 2007-05-17 05:55:42Z seade $
Author:
John McNally, Henning P. Schmiedehausen, Quinton McCombs, Jürgen Hoffmann

Nested Class Summary
static class Group.GroupFactory
           
 
Field Summary
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
protected  ValueParser pp
          The object containing the request data
 
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.
 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(ValueParser pp)
          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(java.lang.String key, ValueParser pp)
          Initializes the Group with parameters from RunData corresponding to key.
 Group init(ValueParser pp)
          Initializes the default Group using parameters.
 boolean isAllValid()
          Performs an AND between all the fields in this group.
 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.
 void setValidProperties(java.lang.Object obj)
          Calls a setter methods on obj, for fields which pass validity tests.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY

public static final java.lang.String EMPTY
See Also:
Constant Field Values

NEW

public static final java.lang.String NEW
See Also:
Constant Field Values

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.


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


pp

protected ValueParser pp
The object containing the request data


isDeclared

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

Constructor Detail

Group

public Group(XmlGroup group)
      throws IntakeException
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:
IntakeException - if an error occurs in other classes
Method Detail

init

public Group init(ValueParser pp)
           throws TurbineException
Initializes the default Group using parameters.

Parameters:
pp - a ValueParser value
Returns:
this Group
Throws:
TurbineException

init

public Group init(java.lang.String key,
                  ValueParser pp)
           throws IntakeException
Initializes the Group with parameters from RunData corresponding to key.

Parameters:
pp - a ValueParser value
Returns:
this Group
Throws:
IntakeException

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(ValueParser pp)
                               throws IntakeException
Describe getObjects method here.

Parameters:
pp - a ValueParser value
Returns:
an ArrayList value
Throws:
IntakeException - if an error occurs

get

public Field get(java.lang.String fieldName)
          throws IntakeException
Get the Field .

Returns:
Field.
Throws:
IntakeException - indicates the field could not be found.

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 IntakeException
Calls a setter methods on obj, for fields which have been set.

Parameters:
obj - Object to be set with the values from the group.
Throws:
IntakeException - indicates that a failure occurred while executing the setter methods of the mapped object.

setValidProperties

public void setValidProperties(java.lang.Object obj)
Calls a setter methods on obj, for fields which pass validity tests. In most cases one should call Intake.isAllValid() and then if that test passes call setProperties. Use this method when some data is known to be invalid, but you still want to set the object properties that are valid.


getProperties

public void getProperties(java.lang.Object obj)
                   throws IntakeException
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.

Parameters:
obj - Object that will be used to as a source of data for setting the values of the fields within the group.
Throws:
IntakeException - indicates that a failure occurred while executing the setter methods of the mapped object.

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.



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