org.tigris.scarab.om
Class AttributeValue

java.lang.Object
  extended byorg.apache.torque.om.BaseObject
      extended byorg.tigris.scarab.om.BaseAttributeValue
          extended byorg.tigris.scarab.om.AttributeValue
All Implemented Interfaces:
org.apache.torque.om.Persistent, org.apache.fulcrum.intake.Retrievable, java.io.Serializable
Direct Known Subclasses:
FreeFormAttribute, OptionAttribute, TotalVotesAttribute, UserAttribute

public abstract class AttributeValue
extends BaseAttributeValue
implements org.apache.torque.om.Persistent

This class is for dealing with Issue Attribute Values

Version:
$Id: AttributeValue.java 10131 2006-06-01 13:50:56Z dabbous $
Author:
John McNally, Jon S. Stevens, Elicia David
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.torque.om.BaseObject
NEW_ID
 
Constructor Summary
protected AttributeValue()
          Creates a new attribute.
 
Method Summary
 AttributeValue copy()
          Makes a copy of this object.
 boolean equals(java.lang.Object obj)
           
 Activity getActivity()
          Gets the Activity record associated with this AttributeValue It can only be retrieved after the save() method has been called since that is when it is generated.
 AttributeOption getAttributeOption()
          Returns the associated AttributeOption object.
 AttributeValue getChainedValue()
          Get the value of chainedValue.
static AttributeValue getNewInstance(Attribute attribute, Issue issue)
          Creates, initializes and returns a new AttributeValue.
static AttributeValue getNewInstance(java.lang.Integer attId, Issue issue)
          Creates, initializes and returns a new AttributeValue.
static AttributeValue getNewInstance(RModuleAttribute rma, Issue issue)
          Creates, initializes and returns a new AttributeValue.
 java.lang.String getOptionIdAsString()
          Get the OptionId
 java.lang.Integer[] getOptionIds()
          Not implemented always throws an exception
 java.lang.String getQueryKey()
          get an id that differentiates this object from others of its class.
 RModuleAttribute getRModuleAttribute()
           
 java.lang.Integer[] getUserIds()
          Not implemented always throws an exception
 java.util.List getValueList()
          This method returns a flat List of all AttributeValues that might be chained to this one.
 int hashCode()
           
abstract  void init()
          Override this method if you need any initialization for this attr.
 boolean isQuickSearchAttribute()
          if the Attribute related to this value is marked as relevant to quick search in the module related to the Issue related to this value.
 boolean isRequired()
           
 boolean isSet()
           
protected abstract  java.lang.Object loadResources()
          Loads from database data specific for this Attribute including Name.
 void save(java.sql.Connection dbcon)
          Stores the object in the database.
 void setActivity(Activity activity)
           
 void setActivityDescription(java.lang.String string)
          Allows you to override the description for the activity that is generated when this attributevalue is saved.
 void setAttributeId(java.lang.Integer nk)
          sets the AttributeId for this as well as any chained values.
 void setChainedValue(AttributeValue v)
          Set the value of chainedValue.
 void setIssueId(java.lang.Long nk)
          sets the IssueId for this as well as any chained values.
 void setNumericValue(java.lang.Integer v)
          Makes sure to set the Value as well
 void setOptionId(java.lang.Integer optionId)
          Makes sure to set the Value as well, to make display of the option easier
protected  void setOptionIdOnly(java.lang.Integer optionId)
           
 void setOptionIds(java.lang.Integer[] ids)
           
 void setProperties(AttributeValue attVal1)
          Sets the properties of one attribute value based on another NOTE: Does not copy the deleted field
protected abstract  void setResources(java.lang.Object resources)
          This method is used by an Attribute instance to obtain specific resources such as option list for SelectOneAttribute.
 void setUserId(java.lang.Integer userId)
          Makes sure to set the Value as well, to make display of the user easier
protected  void setUserIdOnly(java.lang.Integer value)
           
 void setUserIds(java.lang.Integer[] ids)
           
 void setValue(java.lang.String value)
          Set the value of Value
protected  void setValueOnly(java.lang.String value)
           
 void startActivitySet(ActivitySet activitySet)
          Enters this attribute value into a activitySet.
 boolean supportsVoting()
           
 java.lang.String toString()
           
 
Methods inherited from class org.tigris.scarab.om.BaseAttributeValue
copyInto, getAttribute, getAttribute, getAttributeId, getAttributeOption, getByName, getByPeerName, getByPosition, getDeleted, getFieldNames, getIssue, getIssue, getIssueId, getNumericValue, getOptionId, getPeer, getPrimaryKey, getScarabUser, getScarabUser, getUserId, getValue, getValueId, isCacheOnSave, save, save, setAttribute, setAttributeKey, setAttributeOption, setAttributeOptionKey, setDeleted, setIssue, setIssueKey, setPrimaryKey, setPrimaryKey, setQueryKey, setScarabUser, setScarabUserKey, setValueId
 
Methods inherited from class org.apache.torque.om.BaseObject
equals, getLog, isModified, isNew, resetModified, setModified, setNew, setPrimaryKey
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.torque.om.Persistent
getPrimaryKey, isModified, isNew, save, save, setModified, setNew, setPrimaryKey, setPrimaryKey
 

Constructor Detail

AttributeValue

protected AttributeValue()
Creates a new attribute. Do not do anything here. All initialization should be performed in init().

Method Detail

getChainedValue

public AttributeValue getChainedValue()
Get the value of chainedValue.

Returns:
value of chainedValue.

setChainedValue

public void setChainedValue(AttributeValue v)
                     throws org.apache.torque.TorqueException,
                            ScarabException
Set the value of chainedValue.

Parameters:
v - Value to assign to chainedValue.
Throws:
org.apache.torque.TorqueException
ScarabException

getValueList

public java.util.List getValueList()
This method returns a flat List of all AttributeValues that might be chained to this one. This AttributeValue will be first in the List.

Returns:
a List of AttributeValue's

setAttributeId

public void setAttributeId(java.lang.Integer nk)
                    throws org.apache.torque.TorqueException
sets the AttributeId for this as well as any chained values.

Overrides:
setAttributeId in class BaseAttributeValue
Parameters:
nk - new value
Throws:
org.apache.torque.TorqueException

setIssueId

public void setIssueId(java.lang.Long nk)
                throws org.apache.torque.TorqueException
sets the IssueId for this as well as any chained values.

Overrides:
setIssueId in class BaseAttributeValue
Parameters:
nk - new value
Throws:
org.apache.torque.TorqueException

startActivitySet

public void startActivitySet(ActivitySet activitySet)
                      throws ScarabException,
                             org.apache.torque.TorqueException
Enters this attribute value into a activitySet. All changes to a value must occur within a activitySet. The activitySet is cleared once the attribute value is saved.

Parameters:
activitySet - a ActivitySet value
Throws:
ScarabException - if a new activitySet is set before the value is saved.
org.apache.torque.TorqueException

getQueryKey

public java.lang.String getQueryKey()
Description copied from class: BaseAttributeValue
get an id that differentiates this object from others of its class.

Specified by:
getQueryKey in interface org.apache.fulcrum.intake.Retrievable
Overrides:
getQueryKey in class BaseAttributeValue

equals

public boolean equals(java.lang.Object obj)

hashCode

public int hashCode()

toString

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

getOptionIdAsString

public java.lang.String getOptionIdAsString()
Get the OptionId

Returns:
String

setOptionId

public void setOptionId(java.lang.Integer optionId)
                 throws org.apache.torque.TorqueException
Makes sure to set the Value as well, to make display of the option easier

Overrides:
setOptionId in class BaseAttributeValue
Parameters:
optionId - a Integer value
Throws:
org.apache.torque.TorqueException

setNumericValue

public void setNumericValue(java.lang.Integer v)
Makes sure to set the Value as well

Overrides:
setNumericValue in class BaseAttributeValue
Parameters:
v -

setOptionIdOnly

protected void setOptionIdOnly(java.lang.Integer optionId)
                        throws org.apache.torque.TorqueException
Throws:
org.apache.torque.TorqueException

setUserId

public void setUserId(java.lang.Integer userId)
               throws org.apache.torque.TorqueException
Makes sure to set the Value as well, to make display of the user easier

Overrides:
setUserId in class BaseAttributeValue
Parameters:
userId - a Integer value
Throws:
org.apache.torque.TorqueException

setUserIdOnly

protected void setUserIdOnly(java.lang.Integer value)
                      throws org.apache.torque.TorqueException
Throws:
org.apache.torque.TorqueException

getOptionIds

public java.lang.Integer[] getOptionIds()
                                 throws org.apache.torque.TorqueException
Not implemented always throws an exception

Returns:
a Integer[] value
Throws:
java.lang.Exception - if an error occurs
org.apache.torque.TorqueException

setOptionIds

public void setOptionIds(java.lang.Integer[] ids)
                  throws org.apache.torque.TorqueException,
                         ScarabException
Throws:
org.apache.torque.TorqueException
ScarabException

getUserIds

public java.lang.Integer[] getUserIds()
                               throws org.apache.torque.TorqueException,
                                      ScarabException
Not implemented always throws an exception

Returns:
a Integer[] value
Throws:
java.lang.Exception - if an error occurs
org.apache.torque.TorqueException
ScarabException

setUserIds

public void setUserIds(java.lang.Integer[] ids)
                throws org.apache.torque.TorqueException,
                       ScarabException
Throws:
org.apache.torque.TorqueException
ScarabException

setValue

public void setValue(java.lang.String value)
Description copied from class: BaseAttributeValue
Set the value of Value

Overrides:
setValue in class BaseAttributeValue
Parameters:
value - new value

setValueOnly

protected void setValueOnly(java.lang.String value)

isSet

public boolean isSet()

isRequired

public boolean isRequired()
                   throws org.apache.torque.TorqueException,
                          ScarabException
Throws:
org.apache.torque.TorqueException
ScarabException

getRModuleAttribute

public RModuleAttribute getRModuleAttribute()
                                     throws org.apache.torque.TorqueException,
                                            ScarabException
Throws:
org.apache.torque.TorqueException
ScarabException

getAttributeOption

public AttributeOption getAttributeOption()
                                   throws org.apache.torque.TorqueException
Description copied from class: BaseAttributeValue
Returns the associated AttributeOption object. If it was not retrieved before, the object is retrieved from the database

Overrides:
getAttributeOption in class BaseAttributeValue
Returns:
the associated AttributeOption object
Throws:
org.apache.torque.TorqueException

isQuickSearchAttribute

public boolean isQuickSearchAttribute()
                               throws org.apache.torque.TorqueException
if the Attribute related to this value is marked as relevant to quick search in the module related to the Issue related to this value.

Returns:
a boolean value
Throws:
org.apache.torque.TorqueException

getNewInstance

public static AttributeValue getNewInstance(RModuleAttribute rma,
                                            Issue issue)
                                     throws org.apache.torque.TorqueException
Creates, initializes and returns a new AttributeValue.

Parameters:
rma - the Attribute's rma
issue - Issue object which this attribute is associated with
Returns:
new Attribute instance
Throws:
org.apache.torque.TorqueException

getNewInstance

public static AttributeValue getNewInstance(java.lang.Integer attId,
                                            Issue issue)
                                     throws org.apache.torque.TorqueException
Creates, initializes and returns a new AttributeValue.

Parameters:
issue - Issue object which this attributeValue is associated
attId - the Attribute's Id
Returns:
new AttributeValue instance
Throws:
org.apache.torque.TorqueException

getNewInstance

public static AttributeValue getNewInstance(Attribute attribute,
                                            Issue issue)
                                     throws org.apache.torque.TorqueException
Creates, initializes and returns a new AttributeValue.

Parameters:
attribute - the Attribute
issue - Issue object which this attributeValue is associated
Returns:
new AttributeValue instance
Throws:
org.apache.torque.TorqueException

loadResources

protected abstract java.lang.Object loadResources()
                                           throws org.apache.torque.TorqueException
Loads from database data specific for this Attribute including Name. These are data common to all Attribute instances with same id. Data retrieved here will then be used in setResources.

Returns:
Object containing Attribute resources which will be used in setResources.
Throws:
org.apache.torque.TorqueException

setResources

protected abstract void setResources(java.lang.Object resources)
This method is used by an Attribute instance to obtain specific resources such as option list for SelectOneAttribute. It may, for example put them into instance variables. Attributes may use common resources as-is or create it's own resources based on common, it should not, however, modify common resources since they will be used by other Attribute instances.

Parameters:
resources - Resources common for Attributes with the specified id.

init

public abstract void init()
                   throws org.apache.torque.TorqueException
Override this method if you need any initialization for this attr.

Throws:
org.apache.torque.TorqueException - Generic Exception

supportsVoting

public boolean supportsVoting()

copy

public AttributeValue copy()
                    throws org.apache.torque.TorqueException
Description copied from class: BaseAttributeValue
Makes a copy of this object. It creates a new object filling in the simple attributes. It then fills all the association collections and sets the related objects to isNew=true.

Specified by:
copy in class BaseAttributeValue
Throws:
org.apache.torque.TorqueException

save

public void save(java.sql.Connection dbcon)
          throws org.apache.torque.TorqueException
Description copied from class: BaseAttributeValue
Stores the object in the database. If the object is new, it inserts it; otherwise an update is performed. This method is meant to be used as part of a transaction, otherwise use the save() method and the connection details will be handled internally

Specified by:
save in interface org.apache.torque.om.Persistent
Overrides:
save in class BaseAttributeValue
Parameters:
dbcon -
Throws:
org.apache.torque.TorqueException

getActivity

public Activity getActivity()
Gets the Activity record associated with this AttributeValue It can only be retrieved after the save() method has been called since that is when it is generated.


setActivity

public void setActivity(Activity activity)

setActivityDescription

public void setActivityDescription(java.lang.String string)
Allows you to override the description for the activity that is generated when this attributevalue is saved.


setProperties

public void setProperties(AttributeValue attVal1)
                   throws org.apache.torque.TorqueException
Sets the properties of one attribute value based on another NOTE: Does not copy the deleted field

Throws:
org.apache.torque.TorqueException


Copyright © 2000-2004 Tigris.org. All Rights Reserved.