Skip to content
This repository
Browse code

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

…ateListField and JObjectField.
  • Loading branch information...
commit 94df3305f44434f9f6c95244a25a4e803549505c 1 parent 54a023e
Tim Nelson authored April 19, 2012
3  persistence/mongodb-record/src/main/scala/net/liftweb/mongodb/record/field/JObjectField.scala
... ...
@@ -1,5 +1,5 @@
1 1
 /*
2  
- * Copyright 2010-2011 WorldWide Conferencing, LLC
  2
+ * Copyright 2010-2012 WorldWide Conferencing, LLC
3 3
  *
4 4
  * Licensed under the Apache License, Version 2.0 (the "License");
5 5
  * you may not use this file except in compliance with the License.
@@ -27,7 +27,6 @@ import net.liftweb.record.{Field, MandatoryTypedField, Record}
27 27
 
28 28
 import scala.xml.NodeSeq
29 29
 
30  
-@deprecated("Use JsonObjectField instead.")
31 30
 class JObjectField[OwnerType <: Record[OwnerType]](rec: OwnerType) extends Field[JObject, OwnerType] with MandatoryTypedField[JObject] {
32 31
 
33 32
   def asJs = Str(toString)
10  persistence/mongodb-record/src/main/scala/net/liftweb/mongodb/record/field/MongoListField.scala
... ...
@@ -1,5 +1,5 @@
1 1
 /*
2  
- * Copyright 2010-2011 WorldWide Conferencing, LLC
  2
+ * Copyright 2010-2012 WorldWide Conferencing, LLC
3 3
  *
4 4
  * Licensed under the Apache License, Version 2.0 (the "License");
5 5
  * you may not use this file except in compliance with the License.
@@ -135,14 +135,6 @@ class MongoListField[OwnerType <: BsonRecord[OwnerType], ListType: Manifest](rec
135 135
 }
136 136
 
137 137
 /*
138  
-* List of Dates. Use MongListField[OwnerType, Date] instead.
139  
-*/
140  
-@deprecated("Use MongListField[OwnerType, Date] instead")
141  
-class MongoDateListField[OwnerType <: BsonRecord[OwnerType]](rec: OwnerType)
142  
-  extends MongoListField[OwnerType, Date](rec: OwnerType) {
143  
-}
144  
-
145  
-/*
146 138
 * List of JsonObject case classes
147 139
 */
148 140
 class MongoJsonObjectListField[OwnerType <: BsonRecord[OwnerType], JObjectType <: JsonObject[JObjectType]]
65  persistence/record/src/main/scala/net/liftweb/record/DBMetaRecord.scala
... ...
@@ -1,65 +0,0 @@
1  
-/*
2  
- * Copyright 2007-2011 WorldWide Conferencing, LLC
3  
- *
4  
- * Licensed under the Apache License, Version 2.0 (the "License");
5  
- * you may not use this file except in compliance with the License.
6  
- * You may obtain a copy of the License at
7  
- *
8  
- *     http://www.apache.org/licenses/LICENSE-2.0
9  
- *
10  
- * Unless required by applicable law or agreed to in writing, software
11  
- * distributed under the License is distributed on an "AS IS" BASIS,
12  
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  
- * See the License for the specific language governing permissions and
14  
- * limitations under the License.
15  
- */
16  
-
17  
-package net.liftweb
18  
-package record
19  
-
20  
-import util._
21  
-import common._
22  
-import db.{ConnectionIdentifier, DefaultConnectionIdentifier}
23  
-import scala.xml._
24  
-import java.sql.{ResultSet, Types, PreparedStatement, Statement}
25  
-
26  
-@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.")
27  
-trait DBMetaRecord[BaseRecord <: DBRecord[BaseRecord]] extends MetaRecord[BaseRecord] {
28  
-  self: BaseRecord =>
29  
-
30  
-  /**
31  
-   * Save the instance in the appropriate backing store
32  
-   */
33  
-  def save(inst: BaseRecord): Boolean = {
34  
-    foreachCallback(inst, _.beforeSave)
35  
-    try {
36  
-      true // TODO: implement this
37  
-    } finally {
38  
-      foreachCallback(inst, _.afterSave)
39  
-    }
40  
-  }
41  
-
42  
-  /**
43  
-   * Was this instance saved in backing store?
44  
-   */
45  
-  def saved_?(inst: BaseRecord): Boolean = true
46  
-
47  
-  /**
48  
-   * Delete the instance from backing store
49  
-   */
50  
-  def delete_!(inst: BaseRecord): Boolean = {
51  
-    foreachCallback(inst, _.beforeDelete)
52  
-    try {
53  
-      true // TODO: implement this
54  
-    } finally {
55  
-      foreachCallback(inst, _.afterDelete)
56  
-    }
57  
-  }
58  
-
59  
-  def dbDefaultConnectionIdentifier: ConnectionIdentifier = DefaultConnectionIdentifier
60  
-
61  
-  def afterCommit: List[BaseRecord => Unit] = Nil
62  
-
63  
-  // To be continued with DB related stuff
64  
-}
65  
-
88  persistence/record/src/main/scala/net/liftweb/record/DBRecord.scala
... ...
@@ -1,88 +0,0 @@
1  
-/*
2  
- * Copyright 2007-2011 WorldWide Conferencing, LLC
3  
- *
4  
- * Licensed under the Apache License, Version 2.0 (the "License");
5  
- * you may not use this file except in compliance with the License.
6  
- * You may obtain a copy of the License at
7  
- *
8  
- *     http://www.apache.org/licenses/LICENSE-2.0
9  
- *
10  
- * Unless required by applicable law or agreed to in writing, software
11  
- * distributed under the License is distributed on an "AS IS" BASIS,
12  
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  
- * See the License for the specific language governing permissions and
14  
- * limitations under the License.
15  
- */
16  
-
17  
-package net.liftweb 
18  
-package record 
19  
-
20  
-import common._
21  
-import db.{ConnectionIdentifier, DB}
22  
-import util._
23  
-import scala.xml._
24  
-
25  
-@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.")
26  
-trait DBRecord[MyType <: DBRecord[MyType]] extends Record[MyType] {
27  
-  self: MyType =>
28  
-
29  
-  /**
30  
-   * Was this instance deleted from backing store?
31  
-   */
32  
-  private var was_deleted_? = false
33  
-
34  
-  /**
35  
-   * The meta record (the object that contains the meta result for this type)
36  
-   */
37  
-  def meta: DBMetaRecord[MyType]
38  
-
39  
-  /**
40  
-   * Save the instance and return the instance
41  
-   */
42  
-  def save(): MyType = {
43  
-    runSafe {
44  
-      meta.save(this)
45  
-    }
46  
-    this
47  
-  }
48  
-
49  
-
50  
- /**
51  
-  * Save the instance and return the instance
52  
-  */
53  
-  override def saveTheRecord(): Box[MyType] = {save(); Full(this)}
54  
-
55  
-  /**
56  
-   * Delete the instance from backing store
57  
-   */
58  
-  def delete_! : Boolean = {
59  
-    if (!can_delete_?) false else
60  
-    runSafe {
61  
-      was_deleted_? = meta.delete_!(this)
62  
-      was_deleted_?
63  
-    }
64  
-  }
65  
-
66  
-  /**
67  
-   * Can this model object be deleted?
68  
-   */
69  
-  def can_delete_? : Boolean =  meta.saved_?(this) && !was_deleted_?
70  
-
71  
-  private var dbConnectionIdentifier: Box[ConnectionIdentifier] = Empty
72  
-
73  
-  def connectionIdentifier = dbConnectionIdentifier openOr calcDbId
74  
-
75  
-  def dbCalculateConnectionIdentifier: PartialFunction[MyType, ConnectionIdentifier] = Map.empty
76  
-
77  
-  private def calcDbId = if (dbCalculateConnectionIdentifier.isDefinedAt(this)) dbCalculateConnectionIdentifier(this)
78  
-                         else meta.dbDefaultConnectionIdentifier
79  
-
80  
-  /**
81  
-   * Append a function to perform after the commit happens
82  
-   * @param func - the function to perform after the commit happens
83  
-   */
84  
-  def doPostCommit(func: () => Unit) {
85  
-    DB.appendPostFunc(connectionIdentifier, func)
86  
-  }
87  
-}
88  
-
36  persistence/record/src/main/scala/net/liftweb/record/Field.scala
@@ -152,7 +152,7 @@ trait TypedField[ThisType] extends BaseField {
152 152
 
153 153
   private[record] var data: Box[MyType] = Empty
154 154
   private[record] var needsDefault: Boolean = true
155  
-  
  155
+
156 156
   /**
157 157
    * Helper for implementing asJValue for a conversion to an encoded JString
158 158
    *
@@ -259,7 +259,7 @@ trait TypedField[ThisType] extends BaseField {
259 259
    *   - null|None|Empty     => setBox(defaultValueBox)
260 260
    *   - f: Failure          => setBox(f)
261 261
    * And usually convert the input to a string and uses setFromString as a last resort.
262  
-   * 
  262
+   *
263 263
    * Note that setFromAny should _always_ call setBox, even if the conversion fails. This is so that validation
264 264
    * properly notes the error.
265 265
    *
@@ -279,17 +279,17 @@ trait TypedField[ThisType] extends BaseField {
279 279
     case (value: String)::_  => setFromString(value)
280 280
     case null|None|Empty     => setBox(defaultValueBox)
281 281
     case (failure: Failure)  => setBox(failure)
282  
-    case Some(other)         => setFromString(String.valueOf(other)) 
  282
+    case Some(other)         => setFromString(String.valueOf(other))
283 283
     case Full(other)         => setFromString(String.valueOf(other))
284 284
     case other               => setFromString(String.valueOf(other))
285 285
   }
286  
-  
  286
+
287 287
   /**
288 288
    * Set the value of the field using some kind of type-specific conversion from a String.
289 289
    * By convention, if the field is optional_?, then the empty string should be treated as no-value (Empty).
290 290
    * Note that setFromString should _always_ call setBox, even if the conversion fails. This is so that validation
291 291
    * properly notes the error.
292  
-   * 
  292
+   *
293 293
    * @return Full(convertedValue) if the conversion succeeds (the field value will be set by side-effect)
294 294
    *         Empty or Failure if the conversion does not succeed
295 295
    */
@@ -317,7 +317,7 @@ trait MandatoryTypedField[ThisType] extends TypedField[ThisType] with Product1[T
317 317
 
318 318
   //TODO: fullfil the contract of Product1[ThisType]
319 319
   def canEqual(a:Any) = false
320  
-  
  320
+
321 321
   def _1 = value
322 322
 
323 323
   override def optional_? = false
@@ -352,13 +352,13 @@ trait MandatoryTypedField[ThisType] extends TypedField[ThisType] with Product1[T
352 352
     case _ => defaultValueBox.map(v => if (v != null) v.toString else "null") openOr ""
353 353
   }
354 354
 }
355  
-  
  355
+
356 356
 trait OptionalTypedField[ThisType] extends TypedField[ThisType] with Product1[Box[ThisType]] {
357 357
   type ValueType = Option[ThisType] // For util.BaseField
358 358
 
359 359
   //TODO: fullfil the contract of Product1[ThisType]
360 360
   def canEqual(a:Any) = false
361  
-  
  361
+
362 362
   def _1 = value
363 363
 
364 364
   final override def optional_? = true
@@ -426,26 +426,6 @@ trait DisplayWithLabel[OwnerType <: Record[OwnerType]] extends OwnedField[OwnerT
426 426
       </div>
427 427
 }
428 428
 
429  
-
430  
-import java.sql.{ResultSet, Types}
431  
-import net.liftweb.db.{DriverType}
432  
-
433  
-/**
434  
- * Desribes common aspects related with JDBC
435  
- */
436  
-@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.")
437  
-trait JDBCFieldFlavor[MyType] {
438  
-
439  
-  def jdbcFriendly(field : String) : AnyRef
440  
-
441  
-  def targetSQLType : Int
442  
-
443  
-  /**
444  
-   * Given the driver type, return the string required to create the column in the database
445  
-   */
446  
-  def fieldCreatorString(dbType: DriverType, colName: String): String
447  
-}
448  
-
449 429
 trait KeyField[MyType, OwnerType <: Record[OwnerType] with KeyedRecord[OwnerType, MyType]] extends Field[MyType, OwnerType] {
450 430
   def ===(other: KeyField[MyType, OwnerType]): Boolean = this.valueBox == other.valueBox
451 431
 }
2  project/Build.scala
@@ -133,7 +133,7 @@ object BuildDef extends Build {
133 133
 
134 134
   lazy val record =
135 135
     persistenceProject("record")
136  
-        .dependsOn(proto, db)
  136
+        .dependsOn(proto)
137 137
 
138 138
   lazy val couchdb =
139 139
     persistenceProject("couchdb")

0 notes on commit 94df330

Please sign in to comment.
Something went wrong with that request. Please try again.