org.melati.poem
Class SettingTable

Package class diagram package SettingTable
java.lang.Object
  extended by org.melati.poem.JdbcTable
      extended by org.melati.poem.PoemTable
          extended by org.melati.poem.generated.ValueInfoTableBase
              extended by org.melati.poem.ValueInfoTable
                  extended by org.melati.poem.generated.SettingTableBase
                      extended by org.melati.poem.SettingTable
All Implemented Interfaces:
Selectable, Table

public class SettingTable
extends SettingTableBase

A Table which is used like a properties file. Every Melati DB has one. Extended from a Melati POEM generated stub.

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

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

Nested Class Summary
static class SettingTable.UnsetException
          Thrown when a Setting requested has not been set.
 
Constructor Summary
SettingTable(Database database, String name, DefinitionSource definitionSource)
          Constructor.
 
Method Summary
 Setting ensure(String name, boolean value, String displayname, String description)
          Convenience method.
 Setting ensure(String name, int value, String displayname, String description)
          Convenience method.
 Setting ensure(String name, PoemTypeFactory typefactory, Object value, String displayname, String description)
          Make sure that a setting with this name exists, if not then create it.
 Setting ensure(String name, String value, String displayname, String description)
          Convenience method.
 String get(String name)
          Get the String representation of the setting.
 Object getCooked(String name)
          Get an object of the appropriate type by name.
 Object getOrDie(String name)
          Get a set value.
 
Methods inherited from class org.melati.poem.generated.SettingTableBase
_newPersistent, defaultCacheLimit, defaultCategory, defaultDescription, defaultDisplayOrder, defaultRememberAllTroids, getIdColumn, getNameColumn, getPoemDatabaseTables, getSettingObject, getSettingObject, getValueColumn, init
 
Methods inherited from class org.melati.poem.generated.ValueInfoTableBase
getDescriptionColumn, getDisplaynameColumn, getHeightColumn, getNullableColumn, getPrecisionColumn, getRangelimit_stringColumn, getRangelow_stringColumn, getRenderinfoColumn, getScaleColumn, getSizeColumn, getTypefactoryColumn, getUsereditableColumn, getValueInfoObject, getValueInfoObject, getWidthColumn
 
Methods inherited from class org.melati.poem.PoemTable
postInitialise
 
Methods inherited from class org.melati.poem.JdbcTable
_getColumn, addColumnAndCommit, addListener, appendWhereClause, cachedCount, cachedCount, cachedCount, cachedCount, cachedCount, cachedExists, cachedSelection, cachedSelectionField, cachedSelectionType, canDeleteColumn, canReadColumn, canSelectColumn, canWriteColumn, clearColumnInfoCaches, cnfWhereClause, cnfWhereClause, columns, columnWithColumnInfoID, count, count, count, count, countSQL, countSQL, create, create, createTableInfo, dbAddConstraints, dbModifyStructure, defaultDisplayName, defaultOrderByClause, defineColumn, delete_unsafe, delete, deleteColumnAndCommit, deletedColumn, displayColumn, displayColumns, displayColumnsCount, dump, dump, dumpCacheAnalysis, equals, exists, exists, extrasCount, firstSelection, getCacheInfo, getCanCreate, getCategory, getColumn, getColumnsCount, getDatabase, getDbmsTableType, getDefaultCanDelete, getDefaultCanRead, getDefaultCanWrite, getDescription, getDetailDisplayColumns, getDetailDisplayColumnsCount, getDisplayName, getDsdName, getInfo, getMostRecentTroid, getName, getNextExtrasIndex, getObject, getObject, getRecordDisplayColumns, getRecordDisplayColumnsCount, getSearchCriterionColumns, getSearchCriterionColumnsCount, getSummaryDisplayColumns, getSummaryDisplayColumnsCount, getTableInfo, hashCode, invalidateTransactionStuffs, load, newPersistent, notifyColumnInfo, notifyTouched, primaryCriterionColumn, quotedName, readLock, referencesTo, referencesTo, rememberAllTroids, selection, selection, selection, selection, selection, selection, selectionSQL, serial, setCacheLimit, setDisplayColumn, setSearchColumn, setTableInfo, tableInfoID, toString, trimCache, troidColumn, troidFor, troidSelection, troidSelection, troidSelection, uncache, unifyWithColumnInfo, unifyWithDB, whereClause, whereClause, writeDown
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SettingTable

public SettingTable(Database database,
                    String name,
                    DefinitionSource definitionSource)
             throws PoemException
Constructor.

Parameters:
database - the POEM database we are using
name - the name of this Table
definitionSource - which definition is being used
Throws:
PoemException - if anything goes wrong
Generator
org.melati.poem.prepro.TableDef#generateTableMainJava
Method Detail

getCooked

public Object getCooked(String name)
Get an object of the appropriate type by name. Note this has not worked prior to 25/10/2006, a new cache was created every time. Transactions are so fine grained that it is not clear that this cache serves any purpose.

Parameters:
name - the name field of this Setting object
Returns:
its value, cast to the appropriate type.

get

public String get(String name)
Get the String representation of the setting.

Parameters:
name - the name field of the Setting object
Returns:
the value as a String or null

getOrDie

public Object getOrDie(String name)
Get a set value.

Parameters:
name - the Setting's name field
Returns:
the Setting's value as an appropriate Object

ensure

public Setting ensure(String name,
                      PoemTypeFactory typefactory,
                      Object value,
                      String displayname,
                      String description)
Make sure that a setting with this name exists, if not then create it. Note that only the name is checked for existence, the other parameters are only used for creation, so enabling the setting to be manually changed.

Parameters:
name - the name of the Setting to ensure
typefactory - what type to use
value - the value of this setting
displayname - a human readable name
description - the purpose of the setting
Returns:
the existing or newly created Setting

ensure

public Setting ensure(String name,
                      String value,
                      String displayname,
                      String description)
Convenience method.

Parameters:
name - the name of the Setting to ensure
value - the value of this setting
displayname - a human readable name
description - the purpose of the setting
Returns:
the existing or newly created Setting
See Also:
ensure(String, PoemTypeFactory, Object, String, String)

ensure

public Setting ensure(String name,
                      int value,
                      String displayname,
                      String description)
Convenience method.

Parameters:
name - the name of the Setting to ensure
value - the value of this setting
displayname - a human readable name
description - the purpose of the setting
Returns:
the existing or newly created Setting
See Also:
ensure(String, PoemTypeFactory, Object, String, String)

ensure

public Setting ensure(String name,
                      boolean value,
                      String displayname,
                      String description)
Convenience method.

Parameters:
name - the name of the Setting to ensure
value - the value of this setting
displayname - a human readable name
description - the purpose of the setting
Returns:
the existing or newly created Setting
See Also:
ensure(String, PoemTypeFactory, Object, String, String)


Copyright © 2000-2010 PanEris. All Rights Reserved.