This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val fieldConstraints = form.mapping.mappings.map(m => m.key -> m.constraints) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package util | |
| import play.cache.CacheImpl | |
| import models.salatContext._ | |
| import scala.collection.JavaConversions.asJavaMap | |
| import com.mongodb.casbah.Imports._ | |
| import com.mongodb.WriteResult | |
| import java.io._ | |
| import play.jobs.{Every, Job} | |
| import controllers.ErrorReporter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @JsonCachable | |
| class ObjectIdSerializer extends JsonSerializer[ObjectId] { | |
| def serialize(id: ObjectId, json: JsonGenerator, provider: SerializerProvider) { | |
| json.writeString(id.toString) | |
| } | |
| } | |
| class ObjectIdDeserializer extends JsonDeserializer[ObjectId] { | |
| def deserialize(jp: JsonParser, context: DeserializationContext) = { | |
| if (!ObjectId.isValid(jp.getText)) throw context.mappingException("invalid ObjectId " + jp.getText) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object CHJson extends com.codahale.jerkson.Json { | |
| // this is where we setup out Jackson module for custom de/serialization | |
| val module: SimpleModule = new SimpleModule("delving", Version.unknownVersion()) | |
| module.addSerializer(classOf[ObjectId], new ObjectIdSerializer) | |
| module.addDeserializer(classOf[ObjectId], new ObjectIdDeserializer) | |
| mapper.registerModule(module) | |
| } |
NewerOlder