org.melati.poem
Class Setting

Package class diagram package Setting
java.lang.Object
  extended by org.melati.poem.transaction.Transactioned
      extended by org.melati.poem.JdbcPersistent
          extended by org.melati.poem.generated.ValueInfoBase
              extended by org.melati.poem.ValueInfo
                  extended by org.melati.poem.generated.SettingBase
                      extended by org.melati.poem.Setting
All Implemented Interfaces:
Cloneable, Persistable, Persistent, Treeable

public class Setting
extends SettingBase

A setting, analageous to a Property.

NOTE While the underlying value is held as a String that is converted to any type.

Melati POEM generated, modified definition of a Persistent Setting object.

Description: A configurable setting for the application.

Field summary for SQL table Setting
NameTypeDescription
id Integer The Table Row Object ID
name String A code name for this setting
value String The value of this setting

Author:
WilliamC@paneris.org
Generator
org.melati.poem.prepro.TableDef#generateMainJava

Nested Class Summary
static class Setting.SettingTypeMismatchException
          Thrown when a Setting's type does not match the type required.
static class Setting.SettingValidationException
          Thrown when a Setting value fails validation.
 
Field Summary
 
Fields inherited from class org.melati.poem.generated.SettingBase
id, name, value
 
Fields inherited from class org.melati.poem.generated.ValueInfoBase
description, displayname, height, nullable, precision, rangelimit_string, rangelow_string, renderinfo, scale, size, typefactory, usereditable, width
 
Fields inherited from class org.melati.poem.transaction.Transactioned
valid
 
Constructor Summary
Setting()
          Constructor for a Persistent Setting object.
Setting(Integer typefactory, String name, String value, String displayname, String description)
          Constructor with reasonable defaults for a String setting Use SettingTable.create to persist this.
 
Method Summary
 Boolean getBooleanCooked()
           
 Object getCooked()
           
 Integer getIntegerCooked()
           
 Object getRaw()
           
 String getStringCooked()
           
 Field getValueField()
          Override the normal field attributes for the Value field, use the attribute values set in this setting.
 void postEdit(boolean creating)
          Slight overkill, force recreation of value field attributes even if it is the value that has been changed.
 void setRaw(Object raw)
          Set from a raw value; checking that the value is of the correct type first.
 void setValue(String value)
          Check that value is of correct type before setting.
 
Methods inherited from class org.melati.poem.generated.SettingBase
getId_unsafe, getId, getIdField, getName_unsafe, getName, getNameField, getPoemDatabaseTables, getSettingTable, getValue_unsafe, getValue, setId_unsafe, setId, setId, setName_unsafe, setName, setValue_unsafe
 
Methods inherited from class org.melati.poem.ValueInfo
fieldAttributesRenamedAs, getRangelimit_stringField, getRangelow_stringField, getType, setRangelimit_string, setRangelow_string, toTypeParameter
 
Methods inherited from class org.melati.poem.generated.ValueInfoBase
getDescription_unsafe, getDescription, getDescriptionField, getDisplayname_unsafe, getDisplayname, getDisplaynameField, getHeight_unsafe, getHeight, getHeightField, getNullable_unsafe, getNullable, getNullableField, getPrecision_unsafe, getPrecision, getPrecisionField, getRangelimit_string_unsafe, getRangelimit_string, getRangelow_string_unsafe, getRangelow_string, getRenderinfo_unsafe, getRenderinfo, getRenderinfoField, getScale_unsafe, getScale, getScaleField, getSize_unsafe, getSize, getSizeField, getTypefactory_unsafe, getTypefactory, getTypefactoryCode, getTypefactoryField, getUsereditable_unsafe, getUsereditable, getUsereditableField, getValueInfoTable, getWidth_unsafe, getWidth, getWidthField, setDescription_unsafe, setDescription, setDisplayname_unsafe, setDisplayname, setHeight_unsafe, setHeight, setHeight, setNullable_unsafe, setNullable, setNullable, setPrecision_unsafe, setPrecision, setPrecision, setRangelimit_string_unsafe, setRangelow_string_unsafe, setRenderinfo_unsafe, setRenderinfo, setScale_unsafe, setScale, setScale, setSize_unsafe, setSize, setSize, setTypefactory_unsafe, setTypefactory, setTypefactoryCode, setUsereditable_unsafe, setUsereditable, setUsereditable, setWidth_unsafe, setWidth, setWidth
 
Methods inherited from class org.melati.poem.JdbcPersistent
assertCanCreate, assertCanCreate, assertCanDelete, assertCanDelete, assertCanRead, assertCanRead, assertCanWrite, assertCanWrite, clone, commit, countMatchSQL, delete_unsafe, delete, delete, deleteAndCommit, deleteAndCommit, deleteLock, displayString, displayString, displayString, dump, dump, duplicated, duplicatedFloating, equals, existenceLock, existenceLock, fieldsOfColumns, fromClause, getCanDelete, getCanRead, getCanSelect, getCanWrite, getChildren, getCooked, getCookedString, getDatabase, getDetailDisplayFields, getField, getFields, getPrimaryDisplayField, getRaw, getRawString, getReadable, getRecordDisplayFields, getSearchCriterionFields, getSummaryDisplayFields, getTable, getTroid, hashCode, invalidate, isDirty, load, makePersistent, postInsert, postModify, postWrite, preEdit, readLock, readLock, readLock, rollback, setCooked, setDirty, setRaw, setRawString, statusExistent, statusNonexistent, toString, troid, upToDate, writeDown, writeLock, writeLock, writeLock
 
Methods inherited from class org.melati.poem.transaction.Transactioned
markValid, reset, setTransactionPool, transactionPool, unSee
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Setting

public Setting()
Constructor for a Persistent Setting object.

Description: A configurable setting for the application.

Generator
org.melati.poem.prepro.TableDef#generateMainJava

Setting

public Setting(Integer typefactory,
               String name,
               String value,
               String displayname,
               String description)
Constructor with reasonable defaults for a String setting Use SettingTable.create to persist this.

Parameters:
typefactory -
name -
value -
displayname -
description -
Method Detail

setValue

public void setValue(String value)
Check that value is of correct type before setting. Sets the Value value, with checking, for this Setting Persistent. Field description: The value of this setting

Overrides:
setValue in class SettingBase
Parameters:
value - a validated int
See Also:
SettingBase.setValue(java.lang.String)

setRaw

public void setRaw(Object raw)
Set from a raw value; checking that the value is of the correct type first.

Parameters:
raw - the raw to set

getRaw

public Object getRaw()
Returns:
the raw value

getCooked

public Object getCooked()
Returns:
the cooked, ie typed, Object

getIntegerCooked

public Integer getIntegerCooked()
Returns:
value as an Integer

getStringCooked

public String getStringCooked()
Returns:
value as a String

getBooleanCooked

public Boolean getBooleanCooked()
Returns:
value as a Boolean

getValueField

public Field getValueField()
Override the normal field attributes for the Value field, use the attribute values set in this setting.

Overrides:
getValueField in class SettingBase
Returns:
the String value
See Also:
SettingBase.getValueField()

postEdit

public void postEdit(boolean creating)
Slight overkill, force recreation of value field attributes even if it is the value that has been changed. Optionally called after this instance is edited by a user.

Unlike Persistent.postModify() and Persistent.postInsert() this is not called during write down but can be called by applications after individual field edits by the user have been reflected in the instance.

It can be be overridden to enforce data model constraints such as validity of columns relative to other columns. These will be enforced when the admin system is used.

This is a higher level method than Persistent.postModify() so is less likely to lead to infinite recursion or other such problems.

Sorry for the lack of signature consistency with the lower level methods but I got tired of having to call my own application specific common method.

Specified by:
postEdit in interface Persistent
Overrides:
postEdit in class JdbcPersistent
Parameters:
creating - Are we in the process of creating a new record?
See Also:
JdbcPersistent.postEdit(boolean)


Copyright © 2000-2010 PanEris. All Rights Reserved.