net.liftweb.mapper.KeyedMetaMapper

trait KeyedMetaMapper

trait KeyedMetaMapper[Type, A <: KeyedMapper[Type, A]]

 extends MetaMapper[A] with KeyedMapper[Type, A]




Source: MetaMapper.scala(1782)

Direct Known Subclasses

MetaProtoExtendedSession, LongKeyedMetaMapper, MetaMegaProtoUser, MetaProtoTag,

 Fields

_dbTableNameLC.. final def _dbTableNameLC
The table name, to lower case [details]
.. ensures that it works on all DBs
String MetaMapper
addSnippetSetup.. def addSnippetSetup
Default setup behavior for the add snippet [details]
Creates a new mapped object.
return
- new mapped object
A
allFields.. def allFields Seq[BaseField] Mapper
asHtml.. def asHtml NodeSeq Mapper
asJs.. def asJs
Convert the model to a JavaScript object
JsExp Mapper
asValid.. def asValid
Returns the instance in a Full Box if the instance is valid, otherwise returns a Failure with the validation errors
Box[A] Mapper
columnNamesForInsert.. val columnNamesForInsert String MetaMapper
columnQueriesForInsert.. val columnQueriesForInsert String MetaMapper
connectionIdentifier.. def connectionIdentifier ConnectionIdentifier Mapper
count.. def count Long MetaMapper
countryField.. def countryField Box[MappedCountry[A]] Mapper
create.. def create A MetaMapper
createInstance.. def createInstance A MetaMapper
crudSnippets.. def crudSnippets
Defines the default CRUD snippets [details]
Override if you want to change the names of the snippets. Defaults are "add", "edit", and "view". (No, there's no D in CRUD.)
PartialFunction
crudSnippets_?.. def crudSnippets_?
Override this definition in your model to enable CRUD snippets for that model [details]
Set to false by default. Remember to override editSnippetSetup and viewSnippetSetup as well, as the defaults are broken.
return
- false
Boolean
dbCalculateConnectionIdentifier.. def dbCalculateConnectionIdentifier PartialFunction[A, ConnectionIdentifier] Mapper
dbDefaultConnectionIdentifier.. def dbDefaultConnectionIdentifier ConnectionIdentifier MetaMapper
dbIndexes.. def dbIndexes List[BaseIndex[A]] MetaMapper
dbName.. override def dbName
The name of the mapped object
String MetaMapper
dbSelectDBConnectionForFind.. def dbSelectDBConnectionForFind PartialFunction[Type, ConnectionIdentifier]
dbTableName.. def dbTableName
The name of the database table [details]
Override this method if you want to change the table to something other than the name of the Mapper class
String MetaMapper
db_can_delete_?.. def db_can_delete_?
Can this model object be deleted?
Boolean Mapper
delete_!.. def delete_!
Delete the model from the RDBMS
Boolean Mapper
dirty_?.. def dirty_? Boolean Mapper
displayFieldAsLineElement.. var displayFieldAsLineElement
This function converts an element into the appropriate XHTML format for displaying across a line formatted block [details]
The default is <td> for use in XHTML tables. If you change this function, the change will be used for this MetaMapper unless you override the doHtmlLine method.
(NodeSeq) => NodeSeq MetaMapper
displayNameToHeaderElement.. var displayNameToHeaderElement
This function converts a header name into the appropriate XHTML format for displaying across the headers of a formatted block [details]
The default is <th> for use in XHTML tables. If you change this function, the change will be used for this MetaMapper unless you override the htmlHeades method
(String) => NodeSeq MetaMapper
editSnippetSetup.. def editSnippetSetup
Default setup behavior for the edit snippet [details]
BROKEN! MUST OVERRIDE IF USING CRUD SNIPPETS!
return
- a mapped object of this metamapper's type
A
elemName.. val elemName String MetaMapper
fieldMatcher.. lazy val fieldMatcher PartialFunction[(A, String), MappedField[Any, A]] MetaMapper
fieldOrder.. def fieldOrder List[BaseOwnedMappedField[A]] MetaMapper
fieldPF.. def fieldPF PartialFunction Mapper
formFields.. def formFields
Get the fields (in order) for displaying a form
List[MappedField[Any, A]] Mapper
formatFormElement.. var formatFormElement
This function converts a name and form for a given field in the model to XHTML for presentation in the browser [details]
By default, a table row ( <tr> ) is presented, but you can change the function to display something else.
(NodeSeq, NodeSeq) => NodeSeq MetaMapper
getSingleton.. abstract def getSingleton KeyedMetaMapper[KeyType, OwnerType] KeyedMapper
htmlHeaders.. def htmlHeaders NodeSeq MetaMapper
htmlLine.. def htmlLine NodeSeq Mapper
localeField.. def localeField
If there's a field in this record that defines the locale, return it
Box[MappedLocale[A]] Mapper
mappedFields.. lazy val mappedFields Seq[BaseMappedField] MetaMapper
mappedFieldsForModel.. lazy val mappedFieldsForModel List[MappedField[Any, A]] MetaMapper
objFromIndexedParam.. def objFromIndexedParam
Lame attempt at automatically getting an object from the HTTP parameters [details]
BROKEN! DO NOT USE! Only here so that existing sub-classes KeyedMetaMapper don't have to implement new methods when I commit the CRUD snippets code.
Box[A]
primaryKeyField.. abstract def primaryKeyField MappedField[KeyType, OwnerType] with IndexedField[KeyType] KeyedMapper
reload.. def reload OwnerType KeyedMapper
rootClass.. protected val rootClass Class[Any] MetaMapper
safe_?.. final def safe_? Boolean Mapper
saved_?.. def saved_? Boolean Mapper
timeZoneField.. def timeZoneField Box[MappedTimeZone[A]] Mapper
toHtml.. def toHtml
Present the model as a HTML using the same formatting as toForm [details]
return
- the html view of the model
NodeSeq Mapper
toXml.. def toXml Elem Mapper
validate.. def validate List[FieldError] Mapper
viewSnippetSetup.. def viewSnippetSetup
Default setup behavior for the view snippet [details]
BROKEN! MUST OVERRIDE IF USING CRUD SNIPPETS!
return
- a mapped object of this metamapper's type
A

 Methods

!=.. final def !=(arg0 : Any) Boolean Any
!=.. final def !=(arg0 : Object) Boolean AnyRef
==.. final def ==(arg0 : Object) Boolean AnyRef
==.. final def ==(arg0 : Any) Boolean Any
addEndStuffs.. protected def addEndStuffs(in : String, params : List[QueryParam[A]], conn : SuperConnection) (String, Box[Long], Box[Long]) MetaMapper
addSnippet.. def addSnippet(xhtml : NodeSeq)
Default add snippet [details]
Override to change behavior of the add snippet.
NodeSeq
addSnippetCallback.. def addSnippetCallback(obj : A)
Default callback behavior of the add snippet [details]
Called when the user presses submit. Saves the passed in object.
param
obj - mapped object of this metamapper's type
Unit
afterCommit.. def afterCommit List[(A) => Unit] MetaMapper
afterCreate.. def afterCreate List[(A) => Unit] MetaMapper
afterDelete.. def afterDelete List[(A) => Unit] MetaMapper
afterSave.. def afterSave List[(A) => Unit] MetaMapper
afterSchemifier.. override def afterSchemifier Unit
afterUpdate.. def afterUpdate List[(A) => Unit] MetaMapper
afterValidation.. def afterValidation List[(A) => Unit] MetaMapper
afterValidationOnCreate.. def afterValidationOnCreate List[(A) => Unit] MetaMapper
afterValidationOnUpdate.. def afterValidationOnUpdate List[(A) => Unit] MetaMapper
appendField.. def appendField(pf : PartialFunction) Unit Mapper
appendFieldToStrings.. def appendFieldToStrings(in : A) String MetaMapper
asHtml.. def asHtml(toLine : A) NodeSeq MetaMapper
asInstanceOf.. final def asInstanceOf[T0] T0 Any
asJs.. def asJs(actual : A) JsExp MetaMapper
asSafeJs.. def asSafeJs(f : KeyObfuscator) JsExp KeyedMapper
asSafeJs.. def asSafeJs(actual : A, f : KeyObfuscator) JsExp
beforeCreate.. def beforeCreate List[(A) => Unit] MetaMapper
beforeDelete.. def beforeDelete List[(A) => Unit] MetaMapper
beforeSave.. def beforeSave List[(A) => Unit] MetaMapper
beforeSchemifier.. def beforeSchemifier Unit MetaMapper
beforeUpdate.. def beforeUpdate List[(A) => Unit] MetaMapper
beforeValidation.. def beforeValidation List[(A) => Unit] MetaMapper
beforeValidationOnCreate.. def beforeValidationOnCreate List[(A) => Unit] MetaMapper
beforeValidationOnUpdate.. def beforeValidationOnUpdate List[(A) => Unit] MetaMapper
boundedFieldToItem.. implicit def boundedFieldToItem(in : (MappedField[String, A], Int)) BoundedIndexField[A] MetaMapper
buildMapper.. def buildMapper(rs : ResultSet) List[Box[(ResultSet, Int, A) => Unit]] MetaMapper
buildSelectString.. def buildSelectString(fields : Seq[SelectableField], conn : SuperConnection, by : QueryParam[A]*)
Given fields, a connection and the query parameters, build a query and return the query String, and Start or MaxRows values (depending on whether the driver supports LIMIT and OFFSET) and the complete List of QueryParams based on any synthetic query parameters calculated during the query creation [details]
param
conn - -- the SuperConnection to be used for calculating the query
by - -- the varg of QueryParams
fields - -- a Seq of the fields to be selected
return
- s a Tuple of the Query String, Start (offset), MaxRows (limit), and the list of all query parameters including and synthetic query parameters
(String, Box[Long], Box[Long], List[QueryParam[A]]) MetaMapper
bulkDelete_!!.. def bulkDelete_!!(by : QueryParam[A]*) Boolean MetaMapper
bulkDelete_!!.. def bulkDelete_!!(dbId : ConnectionIdentifier, by : QueryParam[A]*) Boolean MetaMapper
checkFieldNames.. def checkFieldNames(in : A) Unit MetaMapper
checkNames.. def checkNames Unit Mapper
clean_?.. def clean_?(toCheck : A)
Returns true if none of the fields are dirty
Boolean MetaMapper
clone.. protected def clone Object AnyRef
columnPrimaryKey_?.. def columnPrimaryKey_?(name : String)
This method returns true if the named column is the primary key and it is autogenerated
Boolean MetaMapper
comparePrimaryKeys.. override def comparePrimaryKeys(other : OwnerType) Boolean KeyedMapper
connectionIdentifier.. def connectionIdentifier(id : ConnectionIdentifier) A Mapper
count.. def count(by : QueryParam[A]*) Long MetaMapper
countByInsecureSql.. def countByInsecureSql(query : String, checkedBy : IHaveValidatedThisSQL) Long MetaMapper
countByInsecureSqlDb.. def countByInsecureSqlDb(dbId : ConnectionIdentifier, query : String, checkedBy : IHaveValidatedThisSQL) Long MetaMapper
countDb.. def countDb(dbId : ConnectionIdentifier, by : QueryParam[A]*) Long MetaMapper
createInstance.. def createInstance(dbId : ConnectionIdentifier, rs : ResultSet, mapFuncs : List[Box[(ResultSet, Int, A) => Unit]]) A MetaMapper
createInstances.. def createInstances[T](dbId : ConnectionIdentifier, rs : ResultSet, start : Box[Long], omax : Box[Long], f : (A) => Box[T]) List[T] MetaMapper
createInstances.. def createInstances(dbId : ConnectionIdentifier, rs : ResultSet, start : Box[Long], omax : Box[Long]) List[A] MetaMapper
dbAddTable.. def dbAddTable Box[() => Unit] MetaMapper
dbStringToKey.. def dbStringToKey(in : String) Box[Type]
decodeFromJSON_!.. protected def decodeFromJSON_!(json : JObject, markFieldsAsDirty : Boolean)
Decode the fields from a JSON Object [details]
Should the fields be marked as dirty?
A MetaMapper
delete_!.. def delete_!(toDelete : A) Boolean MetaMapper
dirty_?.. def dirty_?(toTest : A) Boolean MetaMapper
doHtmlLine.. def doHtmlLine(toLine : A) NodeSeq MetaMapper
doPostCommit.. def doPostCommit(func : () => Unit)
Append a function to perform after the commit happens [details]
param
func - - the function to perform after the commit happens
A Mapper
editSnippet.. def editSnippet(xhtml : NodeSeq)
Default edit snippet [details]
Override to change behavior of the edit snippet.
NodeSeq
editSnippetCallback.. def editSnippetCallback(obj : A)
Default callback behavior of the edit snippet [details]
Called when the user presses submit. Saves the passed in object.
param
obj - mapped object of this metamapper's type
Unit
encodeAsJSON_!.. protected def encodeAsJSON_!(toEncode : A)
This method will encode the instance as JSON [details]
It may reveal data in fields that might otherwise be proprietary. It should be used with caution and only exposed as a public method after a security review.
JObject MetaMapper
eq.. final def eq(arg0 : Object) Boolean AnyRef
equals.. override def equals(other : Any) Boolean KeyedMapper
fieldByName.. def fieldByName[T](fieldName : String)
Find the field by name [details]
param
fieldName - -- the name of the field to find
return
- Box[MappedField]
Box[MappedField[T, A]] Mapper
fieldByName.. def fieldByName[T](fieldName : String, actual : A)
Get a field by the field name [details]
param
actual - -- the instance to get the field on
fieldName - -- the name of the field to get
return
- Box[The Field] (Empty if the field is not found)
Box[MappedField[T, A]] MetaMapper
fieldMapperPF.. def fieldMapperPF(transform : (BaseOwnedMappedField[A]) => NodeSeq) PartialFunction Mapper
fieldMapperPF.. def fieldMapperPF(transform : (BaseOwnedMappedField[A]) => NodeSeq, actual : A) PartialFunction[String, (NodeSeq) => NodeSeq] MetaMapper
fieldToItem.. implicit def fieldToItem[T](in : MappedField[T, A]) IndexItem[A] MetaMapper
finalize.. protected def finalize Unit AnyRef
find.. def find(key : String) Box[A]
find.. def find(by : QueryParam[A]*) Box[A]
find.. def find(key : Any) Box[A]
find.. def find(key : List[String])
Find the element based on the first element of the List
Box[A]
find.. def find(dbId : ConnectionIdentifier, key : String) Box[A]
findAll.. def findAll(by : QueryParam[A]*) List[A] MetaMapper
findAll.. def findAll List[A] MetaMapper
findAllByInsecureSql.. def findAllByInsecureSql(query : String, checkedBy : IHaveValidatedThisSQL) List[A] MetaMapper
findAllByInsecureSqlDb.. def findAllByInsecureSqlDb(dbId : ConnectionIdentifier, query : String, checkedBy : IHaveValidatedThisSQL) List[A] MetaMapper
findAllByPreparedStatement.. def findAllByPreparedStatement(dbId : ConnectionIdentifier, stmt : PreparedStatement) List[A] MetaMapper
findAllByPreparedStatement.. def findAllByPreparedStatement(f : (SuperConnection) => PreparedStatement)
Execute a PreparedStatement and return a List of Mapper instances [details]
{@code f} is where the user will do the work of creating the PreparedStatement and preparing it for execution.
param
f - A function that takes a SuperConnection and returns a PreparedStatement.
return
- A List of Mapper instances.
List[A] MetaMapper
findAllByPreparedStatementDb.. def findAllByPreparedStatementDb[T](dbId : ConnectionIdentifier, stmt : PreparedStatement)(f : (A) => Box[T]) List[T] MetaMapper
findAllDb.. def findAllDb(dbId : ConnectionIdentifier, by : QueryParam[A]*) List[A] MetaMapper
findAllDb.. def findAllDb(dbId : ConnectionIdentifier) List[A] MetaMapper
findAllFields.. def findAllFields(fields : Seq[SelectableField], by : QueryParam[A]*) List[A] MetaMapper
findAllFieldsDb.. def findAllFieldsDb(dbId : ConnectionIdentifier, fields : Seq[SelectableField], by : QueryParam[A]*) List[A] MetaMapper
findApplier.. protected def findApplier(name : String, inst : Object) Box[(A, Object) => Unit] MetaMapper
findByKey.. def findByKey(key : Type) Box[A]
findDb.. def findDb(dbId : ConnectionIdentifier, fields : Seq[SelectableField], by : QueryParam[A]*) Box[A]
findDb.. def findDb(dbId : ConnectionIdentifier, key : Any) Box[A]
findDb.. def findDb(dbId : ConnectionIdentifier, by : QueryParam[A]*) Box[A]
findDbByKey.. def findDbByKey(dbId : ConnectionIdentifier, key : Type) Box[A]
findDbByKey.. def findDbByKey(dbId : ConnectionIdentifier, fields : Seq[SelectableField], key : Type) Box[A]
findMap.. def findMap[T](by : QueryParam[A]*)(f : (A) => Box[T]) List[T] MetaMapper
findMapByInsecureSql.. def findMapByInsecureSql[T](query : String, checkedBy : IHaveValidatedThisSQL)(f : (A) => Box[T]) List[T] MetaMapper
findMapByInsecureSqlDb.. def findMapByInsecureSqlDb[T](dbId : ConnectionIdentifier, query : String, checkedBy : IHaveValidatedThisSQL)(f : (A) => Box[T]) List[T] MetaMapper
findMapDb.. def findMapDb[T](dbId : ConnectionIdentifier, by : QueryParam[A]*)(f : (A) => Box[T]) List[T] MetaMapper
findMapFieldDb.. def findMapFieldDb[T](dbId : ConnectionIdentifier, fields : Seq[SelectableField], by : QueryParam[A]*)(f : (A) => Box[T]) List[T] MetaMapper
findOrCreate.. def findOrCreate(key : Any)
Find an element by primary key or create a new one
A
findOrCreate.. def findOrCreate(key : List[String])
Find an element by primary key or create a new one
A
flatMapFieldTitleForm.. def flatMapFieldTitleForm[T](toMap : A, func : (NodeSeq, Box[NodeSeq], NodeSeq) => Seq[T])
flat map the fields titles and forms to generate a list [details]
param
func - called with displayHtml, fieldId, form
List[T] MetaMapper
flatMapFieldTitleForm.. def flatMapFieldTitleForm[T](func : (NodeSeq, Box[NodeSeq], NodeSeq) => Seq[T])
flat map the fields titles and forms to generate a list [details]
param
func - called with displayHtml, fieldId, form
List[T] Mapper
flatMapFieldTitleForm2.. def flatMapFieldTitleForm2[T](func : (NodeSeq, MappedField[Any, A], NodeSeq) => Seq[T])
flat map the fields titles and forms to generate a list [details]
param
func - called with displayHtml, fieldId, form
List[T] Mapper
flatMapFieldTitleForm2.. def flatMapFieldTitleForm2[T](toMap : A, func : (NodeSeq, MappedField[Any, A], NodeSeq) => Seq[T])
flat map the fields titles and forms to generate a list [details]
param
func - called with displayHtml, fieldId, form
List[T] MetaMapper
formFields.. def formFields(toMap : A)
Get the fields (in order) for displaying a form
List[MappedField[Any, A]] MetaMapper
formatFormLine.. def formatFormLine(displayName : NodeSeq, form : NodeSeq) NodeSeq MetaMapper
getActualBaseField.. def getActualBaseField(actual : A, protoField : BaseOwnedMappedField[A])
Given the prototype field (the field on the Singleton), get the field from the instance [details]
param
protoField - -- the field from the MetaMapper (Singleton)
actual - -- the Mapper instance
return
- the field from the actual object
BaseOwnedMappedField[A] MetaMapper
getActualField.. def getActualField[T](actual : A, protoField : MappedField[T, A])
Given the prototype field (the field on the Singleton), get the field from the instance [details]
param
protoField - -- the field from the MetaMapper (Singleton)
actual - -- the Mapper instance
return
- the field from the actual object
MappedField[T, A] MetaMapper
getClass.. final def getClass Class[Any] AnyRef
hashCode.. override def hashCode Int KeyedMapper
indexedField.. def indexedField(toSave : A) Box[MappedField[Any, A]] MetaMapper
isInstanceOf.. final def isInstanceOf[T0] Boolean Any
mapFieldTitleForm.. def mapFieldTitleForm[T](func : (NodeSeq, Box[NodeSeq], NodeSeq) => T)
map the fields titles and forms to generate a list [details]
param
func - called with displayHtml, fieldId, form
List[T] Mapper
mapFieldTitleForm.. def mapFieldTitleForm[T](toMap : A, func : (NodeSeq, Box[NodeSeq], NodeSeq) => T)
map the fields titles and forms to generate a list [details]
param
func - called with displayHtml, fieldId, form
List[T] MetaMapper
modSnippet.. def modSnippet(xhtml : NodeSeq, obj : A, cleanup : (A) => Unit)
Default snippet for modification [details]
Used by the default add and edit snippets.
NodeSeq
ne.. final def ne(arg0 : Object) Boolean AnyRef
notify.. final def notify Unit AnyRef
notifyAll.. final def notifyAll Unit AnyRef
prependField.. def prependField(pf : PartialFunction) Unit Mapper
runSafe.. def runSafe[T](f : => T) T Mapper
runValidationList.. protected def runValidationList(toValidate : A)
Run the list of field validations, etc [details]
This is the raw validation, without the notifications. This method can be over-ridden.
List[FieldError] MetaMapper
save.. def save Boolean Mapper
save.. def save(toSave : A) Boolean MetaMapper
saveMe.. def saveMe
Save the instance and return the instance
A Mapper
saved_?.. def saved_?(toSave : A) Boolean MetaMapper
suplementalJs.. def suplementalJs(ob : Box[KeyObfuscator])
If the instance calculates any additional fields for JSON object, put the calculated fields here
List[(String, JsExp)] Mapper
synchronized.. final def synchronized[T0](arg0 : T0) T0 AnyRef
thisToMappee.. implicit def thisToMappee(in : Mapper[A]) A Mapper
toForm.. def toForm(toMap : A) NodeSeq MetaMapper
toForm.. def toForm(button : Box[String], f : (A) => Any)
Present the model as a form and execute the function on submission of the form [details]
param
f - - the function to execute on form submission
button - - If it's Full, put a submit button on the form with the value of the parameter
return
- the form
NodeSeq Mapper
toForm.. def toForm(button : Box[String], redoSnippet : (NodeSeq) => NodeSeq, onSuccess : (A) => Unit) NodeSeq Mapper
toForm.. def toForm(button : Box[String], onSuccess : String)
Present the model as a form and execute the function on submission of the form [details]
param
onSuccess - - redirect to the URL if the model validates, otherwise display the errors
button - - If it's Full, put a submit button on the form with the value of the parameter
return
- the form
NodeSeq Mapper
toHtml.. def toHtml(toMap : A)
Present the model as a HTML using the same formatting as toForm [details]
param
toMap - the instance to generate the HTML for
return
- the html view of the model
NodeSeq MetaMapper
toString.. override def toString String Mapper
toXml.. def toXml(what : A) Elem MetaMapper
unapply.. def unapply(key : Any) Option[A]
updateFromJSON_!.. protected def updateFromJSON_!(toUpdate : A, json : JObject)
This method will update the instance from JSON [details]
It allows for attacks from untrusted JSON as it bypasses normal security. By default, the method is protected. You can write a proxy method to expose the functionality.
A MetaMapper
validate.. final def validate(toValidate : A) List[FieldError] MetaMapper
validation.. def validation
If there are model-specific validations to perform, override this method and return an additional list of validations to perform
List[(A) => List[FieldError]] MetaMapper
viewSnippet.. def viewSnippet(xhtml : NodeSeq)
Default view snippet [details]
Override to change behavior of the view snippet.
NodeSeq
wait.. final def wait Unit AnyRef
wait.. final def wait(arg0 : Long) Unit AnyRef
wait.. final def wait(arg0 : Long, arg1 : Int) Unit AnyRef
whatToSet.. def whatToSet(toSave : A) String MetaMapper
Copyright (c) 2006-2011 WorldWide Conferencing, LLC. All Rights Reserved.