Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Issues 997/906 - Remove deprecated DB code from Record. Remove MongoD…

…ateListField and JObjectField.
  • Loading branch information...
commit 94df3305f44434f9f6c95244a25a4e803549505c 1 parent 54a023e
@eltimn eltimn authored
View
3  persistence/mongodb-record/src/main/scala/net/liftweb/mongodb/record/field/JObjectField.scala
@@ -1,5 +1,5 @@
/*
- * Copyright 2010-2011 WorldWide Conferencing, LLC
+ * Copyright 2010-2012 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,6 @@ import net.liftweb.record.{Field, MandatoryTypedField, Record}
import scala.xml.NodeSeq
-@deprecated("Use JsonObjectField instead.")
class JObjectField[OwnerType <: Record[OwnerType]](rec: OwnerType) extends Field[JObject, OwnerType] with MandatoryTypedField[JObject] {
def asJs = Str(toString)
View
10 persistence/mongodb-record/src/main/scala/net/liftweb/mongodb/record/field/MongoListField.scala
@@ -1,5 +1,5 @@
/*
- * Copyright 2010-2011 WorldWide Conferencing, LLC
+ * Copyright 2010-2012 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -135,14 +135,6 @@ class MongoListField[OwnerType <: BsonRecord[OwnerType], ListType: Manifest](rec
}
/*
-* List of Dates. Use MongListField[OwnerType, Date] instead.
-*/
-@deprecated("Use MongListField[OwnerType, Date] instead")
-class MongoDateListField[OwnerType <: BsonRecord[OwnerType]](rec: OwnerType)
- extends MongoListField[OwnerType, Date](rec: OwnerType) {
-}
-
-/*
* List of JsonObject case classes
*/
class MongoJsonObjectListField[OwnerType <: BsonRecord[OwnerType], JObjectType <: JsonObject[JObjectType]]
View
65 persistence/record/src/main/scala/net/liftweb/record/DBMetaRecord.scala
@@ -1,65 +0,0 @@
-/*
- * Copyright 2007-2011 WorldWide Conferencing, LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.liftweb
-package record
-
-import util._
-import common._
-import db.{ConnectionIdentifier, DefaultConnectionIdentifier}
-import scala.xml._
-import java.sql.{ResultSet, Types, PreparedStatement, Statement}
-
-@deprecated("This was never fully implemented. If you're looking for a SQL implementation of Record, please see Squeryl-Record. If you have any questions, please bring them up on the mailing list.")
-trait DBMetaRecord[BaseRecord <: DBRecord[BaseRecord]] extends MetaRecord[BaseRecord] {
- self: BaseRecord =>
-
- /**
- * Save the instance in the appropriate backing store
- */
- def save(inst: BaseRecord): Boolean = {
- foreachCallback(inst, _.beforeSave)
- try {
- true // TODO: implement this
- } finally {
- foreachCallback(inst, _.afterSave)
- }
- }
-
- /**
- * Was this instance saved in backing store?
- */
- def saved_?(inst: BaseRecord): Boolean = true
-
- /**
- * Delete the instance from backing store
- */
- def delete_!(inst: BaseRecord): Boolean = {
- foreachCallback(inst, _.beforeDelete)
- try {
- true // TODO: implement this
- } finally {
- foreachCallback(inst, _.afterDelete)
- }
- }
-
- def dbDefaultConnectionIdentifier: ConnectionIdentifier = DefaultConnectionIdentifier
-
- def afterCommit: List[BaseRecord => Unit] = Nil
-
- // To be continued with DB related stuff
-}
-
View
88 persistence/record/src/main/scala/net/liftweb/record/DBRecord.scala
@@ -1,88 +0,0 @@
-/*
- * Copyright 2007-2011 WorldWide Conferencing, LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.liftweb
-package record
-
-import common._
-import db.{ConnectionIdentifier, DB}
-import util._
-import scala.xml._
-
-@deprecated("This was never fully implemented. If you're looking for a SQL implementation of Record, please see Squeryl-Record. If you have any questions, please bring them up on the mailing list.")
-trait DBRecord[MyType <: DBRecord[MyType]] extends Record[MyType] {
- self: MyType =>
-
- /**
- * Was this instance deleted from backing store?
- */
- private var was_deleted_? = false
-
- /**
- * The meta record (the object that contains the meta result for this type)
- */
- def meta: DBMetaRecord[MyType]
-
- /**
- * Save the instance and return the instance
- */
- def save(): MyType = {
- runSafe {
- meta.save(this)
- }
- this
- }
-
-
- /**
- * Save the instance and return the instance
- */
- override def saveTheRecord(): Box[MyType] = {save(); Full(this)}
-
- /**
- * Delete the instance from backing store
- */
- def delete_! : Boolean = {
- if (!can_delete_?) false else
- runSafe {
- was_deleted_? = meta.delete_!(this)
- was_deleted_?
- }
- }
-
- /**
- * Can this model object be deleted?
- */
- def can_delete_? : Boolean = meta.saved_?(this) && !was_deleted_?
-
- private var dbConnectionIdentifier: Box[ConnectionIdentifier] = Empty
-
- def connectionIdentifier = dbConnectionIdentifier openOr calcDbId
-
- def dbCalculateConnectionIdentifier: PartialFunction[MyType, ConnectionIdentifier] = Map.empty
-
- private def calcDbId = if (dbCalculateConnectionIdentifier.isDefinedAt(this)) dbCalculateConnectionIdentifier(this)
- else meta.dbDefaultConnectionIdentifier
-
- /**
- * Append a function to perform after the commit happens
- * @param func - the function to perform after the commit happens
- */
- def doPostCommit(func: () => Unit) {
- DB.appendPostFunc(connectionIdentifier, func)
- }
-}
-
View
36 persistence/record/src/main/scala/net/liftweb/record/Field.scala
@@ -152,7 +152,7 @@ trait TypedField[ThisType] extends BaseField {
private[record] var data: Box[MyType] = Empty
private[record] var needsDefault: Boolean = true
-
+
/**
* Helper for implementing asJValue for a conversion to an encoded JString
*
@@ -259,7 +259,7 @@ trait TypedField[ThisType] extends BaseField {
* - null|None|Empty => setBox(defaultValueBox)
* - f: Failure => setBox(f)
* And usually convert the input to a string and uses setFromString as a last resort.
- *
+ *
* Note that setFromAny should _always_ call setBox, even if the conversion fails. This is so that validation
* properly notes the error.
*
@@ -279,17 +279,17 @@ trait TypedField[ThisType] extends BaseField {
case (value: String)::_ => setFromString(value)
case null|None|Empty => setBox(defaultValueBox)
case (failure: Failure) => setBox(failure)
- case Some(other) => setFromString(String.valueOf(other))
+ case Some(other) => setFromString(String.valueOf(other))
case Full(other) => setFromString(String.valueOf(other))
case other => setFromString(String.valueOf(other))
}
-
+
/**
* Set the value of the field using some kind of type-specific conversion from a String.
* By convention, if the field is optional_?, then the empty string should be treated as no-value (Empty).
* Note that setFromString should _always_ call setBox, even if the conversion fails. This is so that validation
* properly notes the error.
- *
+ *
* @return Full(convertedValue) if the conversion succeeds (the field value will be set by side-effect)
* Empty or Failure if the conversion does not succeed
*/
@@ -317,7 +317,7 @@ trait MandatoryTypedField[ThisType] extends TypedField[ThisType] with Product1[T
//TODO: fullfil the contract of Product1[ThisType]
def canEqual(a:Any) = false
-
+
def _1 = value
override def optional_? = false
@@ -352,13 +352,13 @@ trait MandatoryTypedField[ThisType] extends TypedField[ThisType] with Product1[T
case _ => defaultValueBox.map(v => if (v != null) v.toString else "null") openOr ""
}
}
-
+
trait OptionalTypedField[ThisType] extends TypedField[ThisType] with Product1[Box[ThisType]] {
type ValueType = Option[ThisType] // For util.BaseField
//TODO: fullfil the contract of Product1[ThisType]
def canEqual(a:Any) = false
-
+
def _1 = value
final override def optional_? = true
@@ -426,26 +426,6 @@ trait DisplayWithLabel[OwnerType <: Record[OwnerType]] extends OwnedField[OwnerT
</div>
}
-
-import java.sql.{ResultSet, Types}
-import net.liftweb.db.{DriverType}
-
-/**
- * Desribes common aspects related with JDBC
- */
-@deprecated("This was never fully implemented. If you're looking for a SQL implementation of Record, please see Squeryl-Record. If you have any questions, please bring them up on the mailing list.")
-trait JDBCFieldFlavor[MyType] {
-
- def jdbcFriendly(field : String) : AnyRef
-
- def targetSQLType : Int
-
- /**
- * Given the driver type, return the string required to create the column in the database
- */
- def fieldCreatorString(dbType: DriverType, colName: String): String
-}
-
trait KeyField[MyType, OwnerType <: Record[OwnerType] with KeyedRecord[OwnerType, MyType]] extends Field[MyType, OwnerType] {
def ===(other: KeyField[MyType, OwnerType]): Boolean = this.valueBox == other.valueBox
}
View
2  project/Build.scala
@@ -133,7 +133,7 @@ object BuildDef extends Build {
lazy val record =
persistenceProject("record")
- .dependsOn(proto, db)
+ .dependsOn(proto)
lazy val couchdb =
persistenceProject("couchdb")
Please sign in to comment.
Something went wrong with that request. Please try again.