src/main/scala/radview/model/Syslog.scala
changeset 2 cf829ec742b3
equal deleted inserted replaced
1:69e26359f2c8 2:cf829ec742b3
       
     1 /*
       
     2  * Copyright 2011 Tomas Zeman <tzeman@volny.cz>
       
     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 package radview.model
       
    17 
       
    18 import net.liftweb.common._
       
    19 import net.liftweb.mapper._
       
    20 import radview.snippet._
       
    21 import scala.xml.{Node, NodeSeq, Text}
       
    22 
       
    23 trait LoginStatus { self: MappedInt[_] =>
       
    24   override def asHtml = Text(is match {
       
    25     case 0 => "login failure (0)"
       
    26     case 1 => "login success (1)"
       
    27     case x => x.toString
       
    28   })
       
    29 }
       
    30 
       
    31 /*
       
    32   Table: AAA_SYSLOG
       
    33 */
       
    34 object Syslog extends Syslog with MetaMapper[Syslog] {
       
    35   override def dbTableName = "AAA_SYSLOG"
       
    36   override def dbDefaultConnectionIdentifier = SyslogConnectionIdentifier
       
    37   def fieldsForList = List(ts, source, loginStatus, username)
       
    38 }
       
    39 
       
    40 class Syslog extends Mapper[Syslog] {
       
    41   def getSingleton = Syslog
       
    42   object ts extends MappedDateTime(this) {
       
    43     override def dbColumnName = "TIMESTAMP"
       
    44     override def displayName = "Timestamp"
       
    45   }
       
    46   object source extends MappedPoliteStringColName(this, 22, "FROMHOST",
       
    47     "Source host")
       
    48   object loginStatus extends MappedIntColName(this, "LOGIN_STATUS",
       
    49     "Login status") with LoginStatus
       
    50   object username extends MappedPoliteStringColName(this, 22, "USERNAME",
       
    51     "Username")
       
    52   object imsi extends MappedLongColName(this, "IMSI", "Imsi")
       
    53 }
       
    54 
       
    55 // vim: set ts=2 sw=2 et: