--- a/src/main/scala/radview/model/Cdr.scala Tue Apr 12 19:10:45 2011 +0200
+++ b/src/main/scala/radview/model/Cdr.scala Tue Apr 12 19:10:46 2011 +0200
@@ -173,7 +173,9 @@
}
object releaseInd extends MappedIntColName(this, "3GPP2_Release_Indicator",
- "3GPP2 Release Indicator")
+ "3GPP2 Release Indicator") {
+ override def asHtml = Text(ReleaseIndicator.lookup(is).openOr(is.toString))
+ }
object activeTime extends MappedIntColName(this, "3GPP2_Active_Time",
"3GPP2 Active Time")
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/radview/model/ReleaseIndicator.scala Tue Apr 12 19:10:46 2011 +0200
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2011 Tomas Zeman <tzeman@volny.cz>
+ *
+ * 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 radview.model
+
+import net.liftweb.common._
+import net.liftweb.mapper._
+import net.liftweb.util.LRU
+
+object ReleaseIndicator extends ReleaseIndicator with
+ LongKeyedMetaMapper[ReleaseIndicator] {
+
+ override def dbTableName = "release_indicator"
+ override def dbDefaultConnectionIdentifier = RadAcctConnectionIdentifier
+
+ def lookup(id: Long): Box[String] = cache.get(id) match {
+ case Full(s) => Full(s)
+ case _ => findByKey(id) match {
+ case Full(r) =>
+ cache.update(r.id, r.desc.is)
+ Full(r.desc.is)
+ case _ => Empty
+ }
+ }
+
+ private object cache extends LRU[Long, String](20)
+}
+
+class ReleaseIndicator extends LongKeyedMapper[ReleaseIndicator] {
+
+ def getSingleton = ReleaseIndicator
+ def primaryKeyField = id
+
+ object id extends MappedLongIndex(this) {
+ override def dbColumnName = "value"
+ }
+
+ object desc extends MappedPoliteStringColName(this, 1024, "description",
+ "Description")
+}
+
+// vim: set ts=2 sw=2 et: