Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration key for disabling validation #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ object Play2MorphiaPluginBuild extends Build {
"play2-morphia-plugin",
file("."),
settings = buildSettings ++ Seq(
javacOptions ++= Seq("-target", "1.6", "-source", "1.6", "-encoding", "utf8"),
javacOptions in doc := Seq("-source", "1.6", "-encoding", "utf8"),
libraryDependencies := runtime ++ test,
publishMavenStyle := true,
publishTo := Some(githubRepository),
scalacOptions ++= Seq("-Xlint", "-deprecation", "-unchecked", "-encoding", "utf8"),
javacOptions ++= Seq("-source", "1.6", "-encoding", "utf8"),
resolvers ++= Seq(DefaultMavenRepository, Resolvers.typesafeRepository), //, Resolvers.morphiaRepository),
checksums := Nil // To prevent proxyToys downloding fails https://github.com/leodagdag/play2-morphia-plugin/issues/11
)
Expand All @@ -30,23 +31,14 @@ object Play2MorphiaPluginBuild extends Build {

object Dependencies {
val runtime = Seq(
"com.github.jmkgreen.morphia" % "morphia" % "1.2.2",
("com.github.jmkgreen.morphia" % "morphia-logging-slf4j" % "1.2.2" % "compile" notTransitive())
"com.github.jmkgreen.morphia" % "morphia" % "1.2.3",
("com.github.jmkgreen.morphia" % "morphia-logging-slf4j" % "1.2.3" % "compile" notTransitive())
.exclude("org.slf4j", "slf4j-simple")
.exclude("org.slf4j", "slf4j-jdk14"),
("com.github.jmkgreen.morphia" % "morphia-validation" % "1.2.2" % "compile" notTransitive())
("com.github.jmkgreen.morphia" % "morphia-validation" % "1.2.3" % "compile" notTransitive())
.exclude("org.slf4j", "slf4j-simple")
.exclude("org.slf4j", "slf4j-jdk14"),

"play" %% "play-java" % "2.1.0" % "compile"


/*,
("org.springframework" % "spring-core" % "3.0.7.RELEASE" % "compile" notTransitive())
.exclude("org.springframework", "spring-asm")
.exclude("commons-logging", "commons-logging"),
("org.springframework" % "spring-beans" % "3.0.7.RELEASE" % "compile" notTransitive())
.exclude("org.springframework", "spring-core")*/
"play" %% "play-java" % "2.1.1" % "compile"
)
val test = Seq(
//"play" %% "play-test" % "2.0.4" % "test"
Expand All @@ -55,7 +47,7 @@ object Play2MorphiaPluginBuild extends Build {

object BuildSettings {
val buildOrganization = "leodagdag"
val buildVersion = "0.0.14"
val buildVersion = "0.0.15"
val buildScalaVersion = "2.10.0"
val buildSbtVersion = "0.12.2"
val buildSettings = Defaults.defaultSettings ++ Seq(
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/leodagdag/play2morphia/MorphiaPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ public void onStart() {
morphia.getMapper().getOptions().objectFactory = new PlayCreator();
}
// Configure validator
new ValidationExtension(morphia);
if (morphiaConf.getBoolean(ConfigKey.VALIDATION.getKey(), true))
new ValidationExtension(morphia);

//Check if credentials parameters are present
String username = morphiaConf.getString(ConfigKey.DB_USERNAME.getKey());
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/leodagdag/play2morphia/utils/ConfigKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ public enum ConfigKey {
ID_TYPE("id.type"), /**/
DEFAULT_WRITE_CONCERN("defaultWriteConcern"), /**/
COLLECTION_UPLOADS("collection.upload"), /**/
LOGGER("logger");
LOGGER("logger"),
VALIDATION("validation");

public static final String PREFIX = "morphia";

Expand Down