diff --git a/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/AbstractDaoImpl.java b/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/AbstractDaoImpl.java index 1f9cf88..0fb4a22 100644 --- a/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/AbstractDaoImpl.java +++ b/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/AbstractDaoImpl.java @@ -1,5 +1,6 @@ package de.kreth.vaadin.clubhelper.vaadinclubhelper.dao; +import java.util.Date; import java.util.List; import javax.persistence.EntityManager; @@ -14,6 +15,8 @@ import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.EntityAccessor; public abstract class AbstractDaoImpl implements IDao { + private static final long serialVersionUID = 7886744143287550291L; + protected final Logger log = LoggerFactory.getLogger(getClass()); @Autowired @@ -28,9 +31,12 @@ public abstract class AbstractDaoImpl implements IDao< @Override @Transactional public void save(T obj) { + Date now = new Date(); + obj.setChanged(now); if (entityManager.contains(obj) || obj.hasValidId()) { entityManager.merge(obj); } else { + obj.setCreated(now); entityManager.persist(obj); } } diff --git a/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/AltersgruppeDaoImpl.java b/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/AltersgruppeDaoImpl.java index 3d13e77..2886130 100644 --- a/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/AltersgruppeDaoImpl.java +++ b/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/AltersgruppeDaoImpl.java @@ -7,6 +7,8 @@ import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Altersgruppe; @Repository public class AltersgruppeDaoImpl extends AbstractDaoImpl implements AltersgruppeDao { + private static final long serialVersionUID = 746136196155133506L; + public AltersgruppeDaoImpl() { super(Altersgruppe.class); } diff --git a/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/ClubEventDaoImpl.java b/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/ClubEventDaoImpl.java index 664bf1d..7d669c7 100644 --- a/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/ClubEventDaoImpl.java +++ b/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/ClubEventDaoImpl.java @@ -19,6 +19,8 @@ import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Person; @Transactional public class ClubEventDaoImpl extends AbstractDaoImpl implements ClubEventDao { + private static final long serialVersionUID = 7648111697282525347L; + public ClubEventDaoImpl() { super(ClubEvent.class); } diff --git a/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/GroupDaoImpl.java b/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/GroupDaoImpl.java index 9ec15a8..6d9f5f2 100644 --- a/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/GroupDaoImpl.java +++ b/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/GroupDaoImpl.java @@ -5,9 +5,9 @@ import org.springframework.stereotype.Repository; import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.GroupDef; @Repository -public class GroupDaoImpl extends AbstractDaoImpl - implements - GroupDao { +public class GroupDaoImpl extends AbstractDaoImpl implements GroupDao { + + private static final long serialVersionUID = -6675545206382142963L; public GroupDaoImpl() { super(GroupDef.class); diff --git a/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/IDao.java b/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/IDao.java index 737a2e2..9a2a1c7 100644 --- a/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/IDao.java +++ b/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/IDao.java @@ -1,8 +1,9 @@ package de.kreth.vaadin.clubhelper.vaadinclubhelper.dao; +import java.io.Serializable; import java.util.List; -public interface IDao { +public interface IDao extends Serializable { void save(T obj); diff --git a/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/PersonDaoImpl.java b/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/PersonDaoImpl.java index ac55dbc..16ad967 100644 --- a/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/PersonDaoImpl.java +++ b/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/PersonDaoImpl.java @@ -18,6 +18,8 @@ import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Startpass; @Repository public class PersonDaoImpl extends AbstractDaoImpl implements PersonDao { + private static final long serialVersionUID = -5809935282146356282L; + public PersonDaoImpl() { super(Person.class); } diff --git a/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/PflichtenDaoImpl.java b/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/PflichtenDaoImpl.java index 94438a3..0bf77f6 100644 --- a/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/PflichtenDaoImpl.java +++ b/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/PflichtenDaoImpl.java @@ -9,6 +9,8 @@ import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Pflicht; @Transactional public class PflichtenDaoImpl extends AbstractDaoImpl implements PflichtenDao { + private static final long serialVersionUID = 5660723465403552334L; + public PflichtenDaoImpl() { super(Pflicht.class); } diff --git a/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/EventDetails.java b/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/EventDetails.java index cb76201..ba9ec4f 100644 --- a/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/EventDetails.java +++ b/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/EventDetails.java @@ -17,7 +17,6 @@ import de.kreth.vaadin.clubhelper.vaadinclubhelper.dao.GroupDao; import de.kreth.vaadin.clubhelper.vaadinclubhelper.dao.PersonDao; import de.kreth.vaadin.clubhelper.vaadinclubhelper.dao.PflichtenDao; import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.ClubEvent; -import de.kreth.vaadin.clubhelper.vaadinclubhelper.security.SecurityVerifier; import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.components.EventAltersgruppen; import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.components.PersonGrid; import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.components.SingleEventView; @@ -31,21 +30,19 @@ public class EventDetails extends GridLayout implements NamedView { private final PersonDao personDao; private final GroupDao groupDao; private final PflichtenDao pflichtenDao; - private final SecurityVerifier securityGroupVerifier; private ClubEvent currentEvent; private SingleEventView eventView; private PersonGrid personGrid; private EventAltersgruppen eventAltersgruppen; - public EventDetails(PersonDao personDao, GroupDao groupDao, EventBusiness eventBusiness, PflichtenDao pflichtenDao, - SecurityVerifier securityGroupVerifier) { + public EventDetails(PersonDao personDao, GroupDao groupDao, EventBusiness eventBusiness, + PflichtenDao pflichtenDao) { super(3, 5); this.eventBusiness = eventBusiness; this.personDao = personDao; this.groupDao = groupDao; this.pflichtenDao = pflichtenDao; - this.securityGroupVerifier = securityGroupVerifier; } @Override diff --git a/src/main/resources/schema/version1.sql b/src/main/resources/schema/version1.sql index 476eb69..c0708e1 100644 --- a/src/main/resources/schema/version1.sql +++ b/src/main/resources/schema/version1.sql @@ -4,7 +4,7 @@ CREATE TABLE `pflichten` ( `fixed` TINYINT NULL, `ordered` INT NOT NULL, `comment` VARCHAR(500) NULL, - `changed` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + `changed` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, `created` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, `deleted` DATETIME NULL DEFAULT NULL, PRIMARY KEY (`id`), @@ -17,7 +17,7 @@ CREATE TABLE `altersgruppe` ( `bezeichnung` VARCHAR(100) NOT NULL, `start` INT NULL, `end` VARCHAR(45) NULL, - `changed` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `changed` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `created` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, `deleted` DATETIME NULL DEFAULT NULL, PRIMARY KEY (`id`), @@ -64,51 +64,51 @@ CREATE TABLE `clubhelper`.`clubevent_addon` ( ON UPDATE NO ACTION); ALTER TABLE `adress` -CHANGE COLUMN `changed` `changed` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , +CHANGE COLUMN `changed` `changed` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , CHANGE COLUMN `created` `created` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ; ALTER TABLE `altersgruppe` -CHANGE COLUMN `changed` `changed` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , +CHANGE COLUMN `changed` `changed` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , CHANGE COLUMN `created` `created` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ; ALTER TABLE `attendance` -CHANGE COLUMN `changed` `changed` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , +CHANGE COLUMN `changed` `changed` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , CHANGE COLUMN `created` `created` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ; ALTER TABLE `contact` -CHANGE COLUMN `changed` `changed` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , +CHANGE COLUMN `changed` `changed` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , CHANGE COLUMN `created` `created` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ; ALTER TABLE `deleted_entries` -CHANGE COLUMN `changed` `changed` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , +CHANGE COLUMN `changed` `changed` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , CHANGE COLUMN `created` `created` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ; ALTER TABLE `groupdef` -CHANGE COLUMN `changed` `changed` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , +CHANGE COLUMN `changed` `changed` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , CHANGE COLUMN `created` `created` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ; ALTER TABLE `person` -CHANGE COLUMN `changed` `changed` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , +CHANGE COLUMN `changed` `changed` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , CHANGE COLUMN `created` `created` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ; ALTER TABLE `persongroup` -CHANGE COLUMN `changed` `changed` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , +CHANGE COLUMN `changed` `changed` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , CHANGE COLUMN `created` `created` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ; ALTER TABLE `pflichten` -CHANGE COLUMN `changed` `changed` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , +CHANGE COLUMN `changed` `changed` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , CHANGE COLUMN `created` `created` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ; ALTER TABLE `relative` -CHANGE COLUMN `changed` `changed` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , +CHANGE COLUMN `changed` `changed` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , CHANGE COLUMN `created` `created` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ; ALTER TABLE `startpaesse` -CHANGE COLUMN `changed` `changed` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , +CHANGE COLUMN `changed` `changed` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , CHANGE COLUMN `created` `created` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ; ALTER TABLE `startpass_startrechte` -CHANGE COLUMN `changed` `changed` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , +CHANGE COLUMN `changed` `changed` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , CHANGE COLUMN `created` `created` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ; UPDATE `clubhelper`.`version` SET `version` = '12' WHERE (`id` = '1'); \ No newline at end of file