net.liftweb.mapper.MetaMapper

trait MetaMapper

trait MetaMapper[A <: Mapper[A]]

 extends BaseMetaMapper with Mapper[A]




Source: MetaMapper.scala(138)

Direct Known Subclasses

KeyedMetaMapper,

Nested Classes

FieldHolder,

 Fields

_dbTableNameLC.. final def _dbTableNameLC
The table name, to lower case [details]
.. ensures that it works on all DBs
String
addlQueryParams.. object addlQueryParams

 extends RequestVar[List[QueryParam[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
columnQueriesForInsert.. val columnQueriesForInsert String
connectionIdentifier.. def connectionIdentifier ConnectionIdentifier Mapper
count.. def count Long
countryField.. def countryField Box[MappedCountry[A]] Mapper
create.. def create A
createInstance.. def createInstance A
dbCalculateConnectionIdentifier.. def dbCalculateConnectionIdentifier PartialFunction[A, ConnectionIdentifier] Mapper
dbDefaultConnectionIdentifier.. def dbDefaultConnectionIdentifier ConnectionIdentifier
dbIndexes.. def dbIndexes List[BaseIndex[A]]
dbName.. override def dbName
The name of the mapped object
String
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
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
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
elemName.. val elemName String
fieldMatcher.. lazy val fieldMatcher PartialFunction[(A, String), MappedField[Any, A]]
fieldOrder.. def fieldOrder List[BaseOwnedMappedField[A]]
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
getSingleton.. abstract def getSingleton MetaMapper[A] Mapper
htmlHeaders.. def htmlHeaders NodeSeq
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]
mappedFieldsForModel.. lazy val mappedFieldsForModel List[MappedField[Any, A]]
rootClass.. protected val rootClass Class[Any]
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

 Methods

!=.. final def !=(arg0 : Object) Boolean AnyRef
!=.. final def !=(arg0 : Any) Boolean Any
==.. final def ==(arg0 : Any) Boolean Any
==.. final def ==(arg0 : Object) Boolean AnyRef
addEndStuffs.. protected def addEndStuffs(in : String, params : List[QueryParam[A]], conn : SuperConnection) (String, Box[Long], Box[Long])
afterCommit.. def afterCommit List[(A) => Unit]
afterCreate.. def afterCreate List[(A) => Unit]
afterDelete.. def afterDelete List[(A) => Unit]
afterSave.. def afterSave List[(A) => Unit]
afterSchemifier.. def afterSchemifier Unit
afterUpdate.. def afterUpdate List[(A) => Unit]
afterValidation.. def afterValidation List[(A) => Unit]
afterValidationOnCreate.. def afterValidationOnCreate List[(A) => Unit]
afterValidationOnUpdate.. def afterValidationOnUpdate List[(A) => Unit]
appendField.. def appendField(pf : PartialFunction) Unit Mapper
appendFieldToStrings.. def appendFieldToStrings(in : A) String
asHtml.. def asHtml(toLine : A) NodeSeq
asInstanceOf.. final def asInstanceOf[T0] T0 Any
asJs.. def asJs(actual : A) JsExp
beforeCreate.. def beforeCreate List[(A) => Unit]
beforeDelete.. def beforeDelete List[(A) => Unit]
beforeSave.. def beforeSave List[(A) => Unit]
beforeSchemifier.. def beforeSchemifier Unit
beforeUpdate.. def beforeUpdate List[(A) => Unit]
beforeValidation.. def beforeValidation List[(A) => Unit]
beforeValidationOnCreate.. def beforeValidationOnCreate List[(A) => Unit]
beforeValidationOnUpdate.. def beforeValidationOnUpdate List[(A) => Unit]
boundedFieldToItem.. implicit def boundedFieldToItem(in : (MappedField[String, A], Int)) BoundedIndexField[A]
buildMapper.. def buildMapper(rs : ResultSet) List[Box[(ResultSet, Int, A) => Unit]]
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]])
bulkDelete_!!.. def bulkDelete_!!(dbId : ConnectionIdentifier, by : QueryParam[A]*) Boolean
bulkDelete_!!.. def bulkDelete_!!(by : QueryParam[A]*) Boolean
checkFieldNames.. def checkFieldNames(in : A) Unit
checkNames.. def checkNames Unit Mapper
clean_?.. def clean_?(toCheck : A)
Returns true if none of the fields are dirty
Boolean
clone.. protected def clone Object AnyRef
columnPrimaryKey_?.. def columnPrimaryKey_?(name : String) Boolean
comparePrimaryKeys.. def comparePrimaryKeys(other : A) Boolean Mapper
connectionIdentifier.. def connectionIdentifier(id : ConnectionIdentifier) A Mapper
count.. def count(by : QueryParam[A]*) Long
countByInsecureSql.. def countByInsecureSql(query : String, checkedBy : IHaveValidatedThisSQL) Long
countByInsecureSqlDb.. def countByInsecureSqlDb(dbId : ConnectionIdentifier, query : String, checkedBy : IHaveValidatedThisSQL) Long
countDb.. def countDb(dbId : ConnectionIdentifier, by : QueryParam[A]*) Long
createInstance.. def createInstance(dbId : ConnectionIdentifier, rs : ResultSet, mapFuncs : List[Box[(ResultSet, Int, A) => Unit]]) A
createInstances.. def createInstances(dbId : ConnectionIdentifier, rs : ResultSet, start : Box[Long], omax : Box[Long]) List[A]
createInstances.. def createInstances[T](dbId : ConnectionIdentifier, rs : ResultSet, start : Box[Long], omax : Box[Long], f : (A) => Box[T]) List[T]
dbAddTable.. def dbAddTable Box[() => Unit]
decodeFromJSON_!.. protected def decodeFromJSON_!(json : JObject, markFieldsAsDirty : Boolean)
Decode the fields from a JSON Object [details]
Should the fields be marked as dirty?
A
delete_!.. def delete_!(toDelete : A) Boolean
dirty_?.. def dirty_?(toTest : A) Boolean
doHtmlLine.. def doHtmlLine(toLine : A) NodeSeq
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
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
eq.. final def eq(arg0 : Object) Boolean AnyRef
equals.. def equals(arg0 : Any) Boolean AnyRef
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]]
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
fieldMapperPF.. def fieldMapperPF(transform : (BaseOwnedMappedField[A]) => NodeSeq, actual : A) PartialFunction[String, (NodeSeq) => NodeSeq]
fieldMapperPF.. def fieldMapperPF(transform : (BaseOwnedMappedField[A]) => NodeSeq) PartialFunction Mapper
fieldToItem.. implicit def fieldToItem[T](in : MappedField[T, A]) IndexItem[A]
finalize.. protected def finalize Unit AnyRef
findAll.. def findAll List[A]
findAll.. def findAll(by : QueryParam[A]*) List[A]
findAllByInsecureSql.. def findAllByInsecureSql(query : String, checkedBy : IHaveValidatedThisSQL) List[A]
findAllByInsecureSqlDb.. def findAllByInsecureSqlDb(dbId : ConnectionIdentifier, query : String, checkedBy : IHaveValidatedThisSQL) List[A]
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]
findAllByPreparedStatement.. def findAllByPreparedStatement(dbId : ConnectionIdentifier, stmt : PreparedStatement) List[A]
findAllByPreparedStatementDb.. def findAllByPreparedStatementDb[T](dbId : ConnectionIdentifier, stmt : PreparedStatement)(f : (A) => Box[T]) List[T]
findAllDb.. def findAllDb(dbId : ConnectionIdentifier) List[A]
findAllDb.. def findAllDb(dbId : ConnectionIdentifier, by : QueryParam[A]*) List[A]
findAllFields.. def findAllFields(fields : Seq[SelectableField], by : QueryParam[A]*) List[A]
findAllFieldsDb.. def findAllFieldsDb(dbId : ConnectionIdentifier, fields : Seq[SelectableField], by : QueryParam[A]*) List[A]
findApplier.. protected def findApplier(name : String, inst : Object) Box[(A, Object) => Unit]
findMap.. def findMap[T](by : QueryParam[A]*)(f : (A) => Box[T]) List[T]
findMapByInsecureSql.. def findMapByInsecureSql[T](query : String, checkedBy : IHaveValidatedThisSQL)(f : (A) => Box[T]) List[T]
findMapByInsecureSqlDb.. def findMapByInsecureSqlDb[T](dbId : ConnectionIdentifier, query : String, checkedBy : IHaveValidatedThisSQL)(f : (A) => Box[T]) List[T]
findMapDb.. def findMapDb[T](dbId : ConnectionIdentifier, by : QueryParam[A]*)(f : (A) => Box[T]) List[T]
findMapFieldDb.. def findMapFieldDb[T](dbId : ConnectionIdentifier, fields : Seq[SelectableField], by : QueryParam[A]*)(f : (A) => Box[T]) List[T]
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
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]
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]
formFields.. def formFields(toMap : A)
Get the fields (in order) for displaying a form
List[MappedField[Any, A]]
formatFormLine.. def formatFormLine(displayName : NodeSeq, form : NodeSeq) NodeSeq
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]
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]
getClass.. final def getClass Class[Any] AnyRef
hashCode.. def hashCode Int AnyRef
indexedField.. def indexedField(toSave : A) Box[MappedField[Any, A]]
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]
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]
save.. def save(toSave : A) Boolean
save.. def save Boolean Mapper
saveMe.. def saveMe
Save the instance and return the instance
A Mapper
saved_?.. def saved_?(toSave : A) Boolean
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(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], 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
toForm.. def toForm(button : Box[String], redoSnippet : (NodeSeq) => NodeSeq, onSuccess : (A) => Unit) NodeSeq Mapper
toForm.. def toForm(toMap : A) NodeSeq
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
toString.. override def toString String Mapper
toXml.. def toXml(what : A) Elem
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
validate.. final def validate(toValidate : A) List[FieldError]
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]]
wait.. final def wait(arg0 : Long, arg1 : Int) Unit AnyRef
wait.. final def wait(arg0 : Long) Unit AnyRef
wait.. final def wait Unit AnyRef
whatToSet.. def whatToSet(toSave : A) String
Copyright (c) 2006-2010 WorldWide Conferencing, LLC. All Rights Reserved.