In a new project to support Manufacturing Operations, using Lift, I
want to code a common pattern for my application and hence I
introduced two traits implementing the basic relationship between a
Position and its content assumed as a Positionable. Concrete classes
will be persisted using Mapper.
Here my try:
trait Position extends BaseLongKeyedMapper {
type ContentType <: Positionable
def foreign: LongKeyedMetaMapper[ContentType]
def isMoving():Boolean = scheduled.obj.map(_ => true).openOr(false)
|| content.obj.map(_.isMoving()).openOr(false)
object role extends MappedString(this.asInstanceOf[MapperType],18)
object content extends MappedLongForeignKey(this.asInstanceOf
[MapperType],foreign) // type mismatch
object scheduled extends MappedLongForeignKey(this.asInstanceOf
[MapperType],foreign) // type mismatch
}
trait Positionable extends BaseLongKeyedMapper {
type ContainerType <: Position
def foreign: LongKeyedMetaMapper[ContainerType]
def isMoving(): Boolean = dest.obj.map(_=>true).openOr(false)
object name extends MappedString(this.asInstanceOf[MapperType],32)
object position extends MappedLongForeignKey(this.asInstanceOf
[MapperType],foreign) // type mismatch
object dest extends MappedLongForeignKey(this.asInstanceOf
[MapperType],foreign) // type mismatch
}
I would like to declare a concrete class this way:
class Pallet extends LongKeyedMapper[Pallet] with Positionable with
IdPK {
type ContainerType = PalletPosition
def getSingleton = PalletMeta
def foreign = PalletPositionMeta
}
object PalletMeta extends Pallet with LongKeyedMetaMapper[Pallet]
class PalletPosition extends LongKeyedMapper[PalletPosition] with
Position with IdPK {
type ContentType = Pallet
def getSingleton = PalletPositionMeta
def foreign = PalletMeta
}
object PalletPositionMeta extends PalletPosition with
LongKeyedMetaMapper[PalletPosition]
Unfortunately there is a type mismatch in parameters passed to
MappedLongForeignKey in the Position and Positionable traits.
Do you have any suggestion?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---