diff -r 69e26359f2c8 -r cf829ec742b3 src/main/scala/radview/model/Syslog.scala --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/scala/radview/model/Syslog.scala Sun Apr 03 15:55:02 2011 +0200 @@ -0,0 +1,55 @@ +/* + * Copyright 2011 Tomas Zeman + * + * 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 radview.snippet._ +import scala.xml.{Node, NodeSeq, Text} + +trait LoginStatus { self: MappedInt[_] => + override def asHtml = Text(is match { + case 0 => "login failure (0)" + case 1 => "login success (1)" + case x => x.toString + }) +} + +/* + Table: AAA_SYSLOG +*/ +object Syslog extends Syslog with MetaMapper[Syslog] { + override def dbTableName = "AAA_SYSLOG" + override def dbDefaultConnectionIdentifier = SyslogConnectionIdentifier + def fieldsForList = List(ts, source, loginStatus, username) +} + +class Syslog extends Mapper[Syslog] { + def getSingleton = Syslog + object ts extends MappedDateTime(this) { + override def dbColumnName = "TIMESTAMP" + override def displayName = "Timestamp" + } + object source extends MappedPoliteStringColName(this, 22, "FROMHOST", + "Source host") + object loginStatus extends MappedIntColName(this, "LOGIN_STATUS", + "Login status") with LoginStatus + object username extends MappedPoliteStringColName(this, 22, "USERNAME", + "Username") + object imsi extends MappedLongColName(this, "IMSI", "Imsi") +} + +// vim: set ts=2 sw=2 et: