diff --git a/app/controllers/Application.java b/app/controllers/Application.java index ed037c7..bed8816 100644 --- a/app/controllers/Application.java +++ b/app/controllers/Application.java @@ -18,7 +18,7 @@ public class Application extends Controller { - final static Form eventForm = form(Event.class); + final static Form eventForm = Form.form(Event.class); /** * Checks if events ends the same day which starts @@ -95,7 +95,7 @@ public static Result blank() { * @return Result */ public static Result add() { - Form eventForm = form(Event.class).bindFromRequest(); + Form eventForm = Form.form(Event.class).bindFromRequest(); if (eventForm.hasErrors()) { return badRequest(formNew.render(eventForm)); } @@ -119,7 +119,7 @@ public static Result add() { */ public static Result edit(Long id) { Event event = Event.find.byId(id); - Form eventForm = form(Event.class).fill(event); + Form eventForm = Form.form(Event.class).fill(event); return ok(formEdit.render(id, eventForm, event)); } @@ -130,7 +130,7 @@ public static Result edit(Long id) { * @return Result */ public static Result update(Long id) { - Form eventForm = form(Event.class).bindFromRequest(); + Form eventForm = Form.form(Event.class).bindFromRequest(); if (eventForm.hasErrors()) { return badRequest(formEdit.render(id, eventForm, Event.find.byId(id))); } @@ -161,7 +161,7 @@ public static Result delete(Long id) { * @return Result */ public static Result addByAjax() { - Form eventForm = form(Event.class).bindFromRequest(); + Form eventForm = Form.form(Event.class).bindFromRequest(); Event newEvent = eventForm.get(); newEvent.endsSameDay = endsSameDay(newEvent.start, newEvent.end); newEvent.save(); @@ -184,14 +184,14 @@ public static Result addByAjax() { */ public static Result move() { - Long id = Long.valueOf(form().bindFromRequest().get("id")); - int dayDelta = Integer.parseInt(form().bindFromRequest().get("dayDelta")); - int minuteDelta = Integer.parseInt(form().bindFromRequest().get("minuteDelta")); + Long id = Long.valueOf(Form.form().bindFromRequest().get("id")); + int dayDelta = Integer.parseInt(Form.form().bindFromRequest().get("dayDelta")); + int minuteDelta = Integer.parseInt(Form.form().bindFromRequest().get("minuteDelta")); Event event = Event.find.byId(id); event.start = new DateTime(event.start).plusDays(dayDelta).plusMinutes(minuteDelta).toDate(); event.end = new DateTime(event.end).plusDays(dayDelta).plusMinutes(minuteDelta).toDate(); - event.allDay = Boolean.valueOf(form().bindFromRequest().get("allDay")); + event.allDay = Boolean.valueOf(Form.form().bindFromRequest().get("allDay")); event.endsSameDay = endsSameDay(event.start, event.end); event.update(); @@ -208,9 +208,9 @@ public static Result move() { */ public static Result resize() { - Long id = Long.valueOf(form().bindFromRequest().get("id")); - int dayDelta = Integer.parseInt(form().bindFromRequest().get("dayDelta")); - int minuteDelta = Integer.parseInt(form().bindFromRequest().get("minuteDelta")); + Long id = Long.valueOf(Form.form().bindFromRequest().get("id")); + int dayDelta = Integer.parseInt(Form.form().bindFromRequest().get("dayDelta")); + int minuteDelta = Integer.parseInt(Form.form().bindFromRequest().get("minuteDelta")); Event event = Event.find.byId(id); event.end = new DateTime(event.end).plusDays(dayDelta).plusMinutes(minuteDelta).toDate(); diff --git a/conf/evolutions/default/1.sql b/conf/evolutions/default/1.sql index 4902319..53bdf3e 100644 --- a/conf/evolutions/default/1.sql +++ b/conf/evolutions/default/1.sql @@ -1,30 +1,30 @@ -# --- Created by Ebean DDL -# To stop Ebean DDL generation, remove this comment and start using Evolutions - -# --- !Ups - -create table event ( - id bigint not null, - title varchar(255), - all_day boolean, - start timestamp, - end timestamp, - ends_same_day boolean, - constraint pk_event primary key (id)) -; - -create sequence event_seq; - - - +# --- Created by Ebean DDL +# To stop Ebean DDL generation, remove this comment and start using Evolutions + +# --- !Ups + +create table event ( + id bigint not null, + title varchar(255), + all_day boolean, + start timestamp, + end timestamp, + ends_same_day boolean, + constraint pk_event primary key (id)) +; + +create sequence event_seq; + -# --- !Downs -SET REFERENTIAL_INTEGRITY FALSE; - -drop table if exists event; - -SET REFERENTIAL_INTEGRITY TRUE; -drop sequence if exists event_seq; +# --- !Downs +SET REFERENTIAL_INTEGRITY FALSE; + +drop table if exists event; + +SET REFERENTIAL_INTEGRITY TRUE; + +drop sequence if exists event_seq; + diff --git a/project/Build.scala b/project/Build.scala index 2c86ba1..1d1f15b 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -1,6 +1,6 @@ import sbt._ import Keys._ -import PlayProject._ +import play.Project._ object ApplicationBuild extends Build { @@ -8,11 +8,14 @@ object ApplicationBuild extends Build { val appVersion = "1.1.2-Snapshot" val appDependencies = Seq( + javaCore, + javaJdbc, + javaEbean, // Add your project dependencies here, "mysql" % "mysql-connector-java" % "5.1.18" ) - val main = PlayProject(appName, appVersion, appDependencies, mainLang = JAVA).settings( + val main = play.Project(appName, appVersion, appDependencies).settings( // Add your own project settings here ) diff --git a/project/build.properties b/project/build.properties index d428711..0974fce 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=0.11.3 +sbt.version=0.13.0 diff --git a/project/plugins.sbt b/project/plugins.sbt index be1ccc8..bff28ec 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -7,4 +7,4 @@ resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/release // Use the Play sbt plugin for Play projects -addSbtPlugin("play" % "sbt-plugin" % "2.0.2") +addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.0")