Skip to content

Commit

Permalink
Categories added to database schema
Browse files Browse the repository at this point in the history
  • Loading branch information
ignatov committed Jul 28, 2011
1 parent 018a45f commit 42b0bfa
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/scala/bootstrap/liftweb/Boot.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import _root_.net.liftweb.mapper.{DB, Schemifier, DefaultConnectionIdentifier, S

import tools.colladoc.api.ExportService
import tools.colladoc.lib.sitemap._
import tools.colladoc.model.mapper.{User, Comment, Properties, Discussion}
import tools.colladoc.model.mapper._
import tools.colladoc.lib.js.JqUI._
import tools.colladoc.api.{GridAPI, RestAPI}
import tools.colladoc.lib.openid.ColladocOpenIDVendor
Expand All @@ -61,7 +61,7 @@ class Boot {

// where to search snippet
LiftRules.addToPackages("scala.tools.colladoc")
Schemifier.schemify(true, Schemifier.infoF _, User, Comment, Properties, Discussion)
Schemifier.schemify(true, Schemifier.infoF _, User, Category, Comment, Properties, Discussion)

ColladocBoot.boot

Expand Down
59 changes: 59 additions & 0 deletions src/main/scala/scala/tools/colladoc/model/mapper/Category.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Copyright (c) 2011, Sergey Ignatov. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COLLABORATIVE SCALADOC PROJECT ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COLLABORATIVE SCALADOC
* PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package scala.tools.colladoc
package model.mapper

import net.liftweb.mapper._

/**
* Category for discussion thread.
* @author Sergey Ignatov
*/
class Category extends LongKeyedMapper[Category] with IdPK {
def getSingleton = Category

/** Category name. */
object name extends MappedString(this, 255) {
override def dbIndexed_? = true
}

/** Whether this category is still valid. */
object valid extends MappedBoolean(this) {
override def defaultValue = true
}

/** Is allowed to view this category for anonymous user. */
object anonymousView extends MappedBoolean(this) {
override def defaultValue = true
}

/** Is allowed to post into this category for anonymous user. */
object anonymousPost extends MappedBoolean(this) {
override def defaultValue = false
}
}

object Category extends Category with LongKeyedMetaMapper[Category] {
override def dbTableName = "categories"
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ import lib.util.DateUtils.{atomDateFormatter, dateFormatter}
class Discussion extends LongKeyedMapper[Discussion] with IdPK {
def getSingleton = Discussion

/** Category of this discussion. */
object category extends LongMappedMapper(this, Category)

/** Qualified name of symbol this comment belongs to. */
object qualifiedName extends MappedString(this, 255) {
override def dbIndexed_? = true
Expand Down

0 comments on commit 42b0bfa

Please sign in to comment.