parent
76c3754931
commit
3943e3a228
@ -1,195 +1,195 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
|
||||
<groupId>de.kreth.vaadin.clubhelper</groupId> |
||||
<artifactId>vaadin-clubhelper</artifactId> |
||||
<version>0.0.1-SNAPSHOT</version> |
||||
<packaging>war</packaging> |
||||
|
||||
<name>vaadin-clubhelper</name> |
||||
<description>Demo project for Spring Boot</description> |
||||
|
||||
<parent> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-parent</artifactId> |
||||
<version>2.0.3.RELEASE</version> |
||||
<relativePath /> <!-- lookup parent from repository --> |
||||
</parent> |
||||
|
||||
<properties> |
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> |
||||
<java.version>1.8</java.version> |
||||
<vaadin.version>8.4.4</vaadin.version> |
||||
<google-api-version>1.23.0</google-api-version> |
||||
<google-api-sheets-version>v4-rev488-1.23.0</google-api-sheets-version> |
||||
<google-api-calendar-version>v3-rev271-1.23.0</google-api-calendar-version> |
||||
</properties> |
||||
|
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-jdbc</artifactId> |
||||
</dependency> |
||||
<!-- <dependency> --> |
||||
<!-- <groupId>org.springframework.boot</groupId> --> |
||||
<!-- <artifactId>spring-boot-starter-security</artifactId> --> |
||||
<!-- </dependency> --> |
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-data-jpa</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-web</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.vaadin</groupId> |
||||
<artifactId>vaadin-spring-boot-starter</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.vaadin</groupId> |
||||
<artifactId>vaadin-push</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.vaadin.teemu</groupId> |
||||
<artifactId>switch</artifactId> |
||||
<version>3.0.0</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.hibernate</groupId> |
||||
<artifactId>hibernate-core</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>mysql</groupId> |
||||
<artifactId>mysql-connector-java</artifactId> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>org.vaadin.blackbluegl</groupId> |
||||
<artifactId>calendar-component</artifactId> |
||||
<version>2.0-BETA4</version> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>com.google.apis</groupId> |
||||
<artifactId>google-api-services-calendar</artifactId> |
||||
<version>${google-api-calendar-version}</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.google.api-client</groupId> |
||||
<artifactId>google-api-client-appengine</artifactId> |
||||
<version>${google-api-version}</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.google.api-client</groupId> |
||||
<artifactId>google-api-client-gson</artifactId> |
||||
<version>${google-api-version}</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.google.oauth-client</groupId> |
||||
<artifactId>google-oauth-client-java6</artifactId> |
||||
<version>${google-api-version}</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.google.oauth-client</groupId> |
||||
<artifactId>google-oauth-client-jetty</artifactId> |
||||
<version>${google-api-version}</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.slf4j</groupId> |
||||
<artifactId>slf4j-api</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>ch.qos.logback</groupId> |
||||
<artifactId>logback-classic</artifactId> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-test</artifactId> |
||||
<scope>test</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework.security</groupId> |
||||
<artifactId>spring-security-test</artifactId> |
||||
<scope>test</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.h2database</groupId> |
||||
<artifactId>h2</artifactId> |
||||
<scope>test</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>commons-io</groupId> |
||||
<artifactId>commons-io</artifactId> |
||||
<version>2.6</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.hibernate</groupId> |
||||
<artifactId>hibernate-testing</artifactId> |
||||
<scope>test</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.hibernate</groupId> |
||||
<artifactId>hibernate-entitymanager</artifactId> |
||||
<scope>test</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.slf4j</groupId> |
||||
<artifactId>slf4j-simple</artifactId> |
||||
</dependency> |
||||
</dependencies> |
||||
|
||||
<dependencyManagement> |
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>com.vaadin</groupId> |
||||
<artifactId>vaadin-bom</artifactId> |
||||
<version>${vaadin.version}</version> |
||||
<type>pom</type> |
||||
<scope>import</scope> |
||||
</dependency> |
||||
</dependencies> |
||||
</dependencyManagement> |
||||
|
||||
<build> |
||||
<plugins> |
||||
<plugin> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-maven-plugin</artifactId> |
||||
</plugin> |
||||
|
||||
<plugin> |
||||
<groupId>com.vaadin</groupId> |
||||
<artifactId>vaadin-maven-plugin</artifactId> |
||||
<version>${vaadin.version}</version> |
||||
<executions> |
||||
<execution> |
||||
<goals> |
||||
<goal>update-theme</goal> |
||||
<goal>update-widgetset</goal> |
||||
<goal>compile</goal> |
||||
<!-- Comment out compile-theme goal to use on-the-fly theme compilation --> |
||||
<goal>compile-theme</goal> |
||||
</goals> |
||||
</execution> |
||||
</executions> |
||||
<configuration> |
||||
<gwtSdkFirstInClasspath>true</gwtSdkFirstInClasspath> |
||||
</configuration> |
||||
</plugin> |
||||
</plugins> |
||||
</build> |
||||
|
||||
<repositories> |
||||
<repository> |
||||
<id>vaadin-addons</id> |
||||
<url>http://maven.vaadin.com/vaadin-addons</url> |
||||
</repository> |
||||
</repositories> |
||||
|
||||
</project> |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
|
||||
<groupId>de.kreth.vaadin.clubhelper</groupId> |
||||
<artifactId>vaadin-clubhelper</artifactId> |
||||
<version>0.0.1-SNAPSHOT</version> |
||||
<packaging>war</packaging> |
||||
|
||||
<name>vaadin-clubhelper</name> |
||||
<description>Demo project for Spring Boot</description> |
||||
|
||||
<parent> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-parent</artifactId> |
||||
<version>2.0.3.RELEASE</version> |
||||
<relativePath /> <!-- lookup parent from repository --> |
||||
</parent> |
||||
|
||||
<properties> |
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> |
||||
<java.version>1.8</java.version> |
||||
<vaadin.version>8.4.4</vaadin.version> |
||||
<google-api-version>1.23.0</google-api-version> |
||||
<google-api-sheets-version>v4-rev488-1.23.0</google-api-sheets-version> |
||||
<google-api-calendar-version>v3-rev271-1.23.0</google-api-calendar-version> |
||||
</properties> |
||||
|
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-jdbc</artifactId> |
||||
</dependency> |
||||
<!-- <dependency> --> |
||||
<!-- <groupId>org.springframework.boot</groupId> --> |
||||
<!-- <artifactId>spring-boot-starter-security</artifactId> --> |
||||
<!-- </dependency> --> |
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-data-jpa</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-web</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.vaadin</groupId> |
||||
<artifactId>vaadin-spring-boot-starter</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.vaadin</groupId> |
||||
<artifactId>vaadin-push</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.vaadin.teemu</groupId> |
||||
<artifactId>switch</artifactId> |
||||
<version>3.0.0</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.vaadin.blackbluegl</groupId> |
||||
<artifactId>calendar-component</artifactId> |
||||
<version>2.0-BETA4</version> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>org.hibernate</groupId> |
||||
<artifactId>hibernate-core</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>mysql</groupId> |
||||
<artifactId>mysql-connector-java</artifactId> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>com.google.apis</groupId> |
||||
<artifactId>google-api-services-calendar</artifactId> |
||||
<version>${google-api-calendar-version}</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.google.api-client</groupId> |
||||
<artifactId>google-api-client-appengine</artifactId> |
||||
<version>${google-api-version}</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.google.api-client</groupId> |
||||
<artifactId>google-api-client-gson</artifactId> |
||||
<version>${google-api-version}</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.google.oauth-client</groupId> |
||||
<artifactId>google-oauth-client-java6</artifactId> |
||||
<version>${google-api-version}</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.google.oauth-client</groupId> |
||||
<artifactId>google-oauth-client-jetty</artifactId> |
||||
<version>${google-api-version}</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.slf4j</groupId> |
||||
<artifactId>slf4j-api</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>ch.qos.logback</groupId> |
||||
<artifactId>logback-classic</artifactId> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-test</artifactId> |
||||
<scope>test</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework.security</groupId> |
||||
<artifactId>spring-security-test</artifactId> |
||||
<scope>test</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.h2database</groupId> |
||||
<artifactId>h2</artifactId> |
||||
<scope>test</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>commons-io</groupId> |
||||
<artifactId>commons-io</artifactId> |
||||
<version>2.6</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.hibernate</groupId> |
||||
<artifactId>hibernate-testing</artifactId> |
||||
<scope>test</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.hibernate</groupId> |
||||
<artifactId>hibernate-entitymanager</artifactId> |
||||
<scope>test</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.slf4j</groupId> |
||||
<artifactId>slf4j-simple</artifactId> |
||||
</dependency> |
||||
</dependencies> |
||||
|
||||
<dependencyManagement> |
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>com.vaadin</groupId> |
||||
<artifactId>vaadin-bom</artifactId> |
||||
<version>${vaadin.version}</version> |
||||
<type>pom</type> |
||||
<scope>import</scope> |
||||
</dependency> |
||||
</dependencies> |
||||
</dependencyManagement> |
||||
|
||||
<build> |
||||
<plugins> |
||||
<plugin> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-maven-plugin</artifactId> |
||||
</plugin> |
||||
|
||||
<plugin> |
||||
<groupId>com.vaadin</groupId> |
||||
<artifactId>vaadin-maven-plugin</artifactId> |
||||
<version>${vaadin.version}</version> |
||||
<executions> |
||||
<execution> |
||||
<goals> |
||||
<goal>update-theme</goal> |
||||
<goal>update-widgetset</goal> |
||||
<goal>compile</goal> |
||||
<!-- Comment out compile-theme goal to use on-the-fly theme compilation --> |
||||
<goal>compile-theme</goal> |
||||
</goals> |
||||
</execution> |
||||
</executions> |
||||
<configuration> |
||||
<gwtSdkFirstInClasspath>true</gwtSdkFirstInClasspath> |
||||
</configuration> |
||||
</plugin> |
||||
</plugins> |
||||
</build> |
||||
|
||||
<repositories> |
||||
<repository> |
||||
<id>vaadin-addons</id> |
||||
<url>http://maven.vaadin.com/vaadin-addons</url> |
||||
</repository> |
||||
</repositories> |
||||
|
||||
</project> |
||||
|
||||
@ -1,25 +1,25 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"> |
||||
<persistence-unit name="vaadin-clubhelper" transaction-type="RESOURCE_LOCAL"> |
||||
<provider>org.hibernate.ejb.HibernatePersistence</provider> |
||||
<mapping-file>schema/ClubEvent.hbm.xml</mapping-file> |
||||
<class>de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Adress</class> |
||||
<class>de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Attendance</class> |
||||
<class>de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Contact</class> |
||||
<class>de.kreth.vaadin.clubhelper.vaadinclubhelper.data.DeletedEntry</class> |
||||
<class>de.kreth.vaadin.clubhelper.vaadinclubhelper.data.GroupDef</class> |
||||
<class>de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Person</class> |
||||
<class>de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Persongroup</class> |
||||
<class>de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Relative</class> |
||||
<class>de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Startpaesse</class> |
||||
<class>de.kreth.vaadin.clubhelper.vaadinclubhelper.data.StartpassStartrechte</class> |
||||
<class>de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Version</class> |
||||
<properties> |
||||
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/> |
||||
<property name="javax.persistence.jdbc.url" value="localhost:3306"/> |
||||
<property name="javax.persistence.jdbc.user" value="root"/> |
||||
<property name="javax.persistence.jdbc.password" value="07!73"/> |
||||
<property name="javax.persistence.schema-generation.scripts.action" value="create"/> |
||||
</properties> |
||||
</persistence-unit> |
||||
</persistence> |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"> |
||||
<persistence-unit name="vaadin-clubhelper" transaction-type="RESOURCE_LOCAL"> |
||||
<provider>org.hibernate.ejb.HibernatePersistence</provider> |
||||
<mapping-file>schema/ClubEvent.hbm.xml</mapping-file> |
||||
<class>de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Adress</class> |
||||
<class>de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Attendance</class> |
||||
<class>de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Contact</class> |
||||
<class>de.kreth.vaadin.clubhelper.vaadinclubhelper.data.DeletedEntry</class> |
||||
<class>de.kreth.vaadin.clubhelper.vaadinclubhelper.data.GroupDef</class> |
||||
<class>de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Person</class> |
||||
<class>de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Persongroup</class> |
||||
<class>de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Relative</class> |
||||
<class>de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Startpaesse</class> |
||||
<class>de.kreth.vaadin.clubhelper.vaadinclubhelper.data.StartpassStartrechte</class> |
||||
<class>de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Version</class> |
||||
<properties> |
||||
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/> |
||||
<property name="javax.persistence.jdbc.url" value="localhost:3306"/> |
||||
<property name="javax.persistence.jdbc.user" value="root"/> |
||||
<property name="javax.persistence.jdbc.password" value="07!73"/> |
||||
<property name="javax.persistence.schema-generation.scripts.action" value="create"/> |
||||
</properties> |
||||
</persistence-unit> |
||||
</persistence> |
||||
|
||||
@ -1,152 +1,152 @@ |
||||
package de.kreth.vaadin.clubhelper.vaadinclubhelper.data; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
|
||||
import javax.persistence.Entity; |
||||
import javax.persistence.FetchType; |
||||
import javax.persistence.GeneratedValue; |
||||
import javax.persistence.GenerationType; |
||||
import javax.persistence.Id; |
||||
import javax.persistence.JoinColumn; |
||||
import javax.persistence.JoinTable; |
||||
import javax.persistence.ManyToMany; |
||||
import javax.persistence.NamedQuery; |
||||
import javax.persistence.Table; |
||||
import javax.persistence.Temporal; |
||||
import javax.persistence.TemporalType; |
||||
|
||||
/** |
||||
* The persistent class for the groupDef database table. |
||||
* |
||||
*/ |
||||
@Entity(name = "groupDef") |
||||
@Table(name = "groupDef") |
||||
@NamedQuery(name = GroupDef.QUERY_FINDALL, query = "SELECT g FROM groupDef g") |
||||
public class GroupDef implements Serializable { |
||||
|
||||
public final static String QUERY_FINDALL = "GroupDef.findAll"; |
||||
|
||||
private static final long serialVersionUID = -2827542956463449518L; |
||||
|
||||
@Id |
||||
@GeneratedValue(strategy = GenerationType.IDENTITY) |
||||
private int id; |
||||
|
||||
@Temporal(TemporalType.TIMESTAMP) |
||||
private Date changed; |
||||
|
||||
@Temporal(TemporalType.TIMESTAMP) |
||||
private Date created; |
||||
|
||||
@Temporal(TemporalType.TIMESTAMP) |
||||
private Date deleted; |
||||
|
||||
private String name; |
||||
|
||||
@ManyToMany(fetch=FetchType.LAZY) |
||||
@JoinTable (name = "persongroup", |
||||
joinColumns = { @JoinColumn(name = "group_id") }, |
||||
inverseJoinColumns = { @JoinColumn(name = "person_id") }) |
||||
private List<Persongroup> persongroups; |
||||
|
||||
public GroupDef() { |
||||
} |
||||
|
||||
public int getId() { |
||||
return this.id; |
||||
} |
||||
|
||||
public void setId(int id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public Date getChanged() { |
||||
return this.changed; |
||||
} |
||||
|
||||
public void setChanged(Date changed) { |
||||
this.changed = changed; |
||||
} |
||||
|
||||
public Date getCreated() { |
||||
return this.created; |
||||
} |
||||
|
||||
public void setCreated(Date created) { |
||||
this.created = created; |
||||
} |
||||
|
||||
public Date getDeleted() { |
||||
return this.deleted; |
||||
} |
||||
|
||||
public void setDeleted(Date deleted) { |
||||
this.deleted = deleted; |
||||
} |
||||
|
||||
public String getName() { |
||||
return this.name; |
||||
} |
||||
|
||||
public void setName(String name) { |
||||
this.name = name; |
||||
} |
||||
|
||||
public List<Persongroup> getPersongroups() { |
||||
return this.persongroups; |
||||
} |
||||
|
||||
public void setPersongroups(List<Persongroup> persongroups) { |
||||
this.persongroups = persongroups; |
||||
} |
||||
|
||||
public Persongroup addPersongroup(Persongroup persongroup) { |
||||
getPersongroups().add(persongroup); |
||||
persongroup.setGroupDef(this); |
||||
|
||||
return persongroup; |
||||
} |
||||
|
||||
public Persongroup removePersongroup(Persongroup persongroup) { |
||||
getPersongroups().remove(persongroup); |
||||
persongroup.setGroupDef(null); |
||||
|
||||
return persongroup; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return "GroupDef [id=" + id + ", name=" + name + "]"; |
||||
} |
||||
|
||||
@Override |
||||
public int hashCode() { |
||||
final int prime = 31; |
||||
int result = 1; |
||||
result = prime * result + id; |
||||
result = prime * result + ((name == null) ? 0 : name.hashCode()); |
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object obj) { |
||||
if (this == obj) |
||||
return true; |
||||
if (obj == null) |
||||
return false; |
||||
if (getClass() != obj.getClass()) |
||||
return false; |
||||
GroupDef other = (GroupDef) obj; |
||||
if (id != other.id) |
||||
return false; |
||||
if (name == null) { |
||||
if (other.name != null) |
||||
return false; |
||||
} else if (!name.equals(other.name)) |
||||
return false; |
||||
return true; |
||||
} |
||||
|
||||
package de.kreth.vaadin.clubhelper.vaadinclubhelper.data; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
|
||||
import javax.persistence.Entity; |
||||
import javax.persistence.FetchType; |
||||
import javax.persistence.GeneratedValue; |
||||
import javax.persistence.GenerationType; |
||||
import javax.persistence.Id; |
||||
import javax.persistence.JoinColumn; |
||||
import javax.persistence.JoinTable; |
||||
import javax.persistence.ManyToMany; |
||||
import javax.persistence.NamedQuery; |
||||
import javax.persistence.Table; |
||||
import javax.persistence.Temporal; |
||||
import javax.persistence.TemporalType; |
||||
|
||||
/** |
||||
* The persistent class for the groupDef database table. |
||||
* |
||||
*/ |
||||
@Entity(name = "groupDef") |
||||
@Table(name = "groupDef") |
||||
@NamedQuery(name = GroupDef.QUERY_FINDALL, query = "SELECT g FROM groupDef g") |
||||
public class GroupDef implements Serializable { |
||||
|
||||
public final static String QUERY_FINDALL = "GroupDef.findAll"; |
||||
|
||||
private static final long serialVersionUID = -2827542956463449518L; |
||||
|
||||
@Id |
||||
@GeneratedValue(strategy = GenerationType.IDENTITY) |
||||
private int id; |
||||
|
||||
@Temporal(TemporalType.TIMESTAMP) |
||||
private Date changed; |
||||
|
||||
@Temporal(TemporalType.TIMESTAMP) |
||||
private Date created; |
||||
|
||||
@Temporal(TemporalType.TIMESTAMP) |
||||
private Date deleted; |
||||
|
||||
private String name; |
||||
|
||||
@ManyToMany(fetch=FetchType.LAZY) |
||||
@JoinTable (name = "persongroup", |
||||
joinColumns = { @JoinColumn(name = "group_id") }, |
||||
inverseJoinColumns = { @JoinColumn(name = "person_id") }) |
||||
private List<Persongroup> persongroups; |
||||
|
||||
public GroupDef() { |
||||
} |
||||
|
||||
public int getId() { |
||||
return this.id; |
||||
} |
||||
|
||||
public void setId(int id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public Date getChanged() { |
||||
return this.changed; |
||||
} |
||||
|
||||
public void setChanged(Date changed) { |
||||
this.changed = changed; |
||||
} |
||||
|
||||
public Date getCreated() { |
||||
return this.created; |
||||
} |
||||
|
||||
public void setCreated(Date created) { |
||||
this.created = created; |
||||
} |
||||
|
||||
public Date getDeleted() { |
||||
return this.deleted; |
||||
} |
||||
|
||||
public void setDeleted(Date deleted) { |
||||
this.deleted = deleted; |
||||
} |
||||
|
||||
public String getName() { |
||||
return this.name; |
||||
} |
||||
|
||||
public void setName(String name) { |
||||
this.name = name; |
||||
} |
||||
|
||||
public List<Persongroup> getPersongroups() { |
||||
return this.persongroups; |
||||
} |
||||
|
||||
public void setPersongroups(List<Persongroup> persongroups) { |
||||
this.persongroups = persongroups; |
||||
} |
||||
|
||||
public Persongroup addPersongroup(Persongroup persongroup) { |
||||
getPersongroups().add(persongroup); |
||||
persongroup.setGroupDef(this); |
||||
|
||||
return persongroup; |
||||
} |
||||
|
||||
public Persongroup removePersongroup(Persongroup persongroup) { |
||||
getPersongroups().remove(persongroup); |
||||
persongroup.setGroupDef(null); |
||||
|
||||
return persongroup; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return "GroupDef [id=" + id + ", name=" + name + "]"; |
||||
} |
||||
|
||||
@Override |
||||
public int hashCode() { |
||||
final int prime = 31; |
||||
int result = 1; |
||||
result = prime * result + id; |
||||
result = prime * result + ((name == null) ? 0 : name.hashCode()); |
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object obj) { |
||||
if (this == obj) |
||||
return true; |
||||
if (obj == null) |
||||
return false; |
||||
if (getClass() != obj.getClass()) |
||||
return false; |
||||
GroupDef other = (GroupDef) obj; |
||||
if (id != other.id) |
||||
return false; |
||||
if (name == null) { |
||||
if (other.name != null) |
||||
return false; |
||||
} else if (!name.equals(other.name)) |
||||
return false; |
||||
return true; |
||||
} |
||||
|
||||
} |
||||
@ -1,365 +1,365 @@ |
||||
package de.kreth.vaadin.clubhelper.vaadinclubhelper.data; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
import java.util.Set; |
||||
|
||||
import javax.persistence.*; |
||||
|
||||
/** |
||||
* The persistent class for the person database table. |
||||
* |
||||
*/ |
||||
@Entity |
||||
@Table(name = "person") |
||||
@NamedQuery(name = Person.QUERY_FINDALL, query = "SELECT p FROM Person p") |
||||
public class Person implements Serializable { |
||||
|
||||
public final static String QUERY_FINDALL = "Person.findAll"; |
||||
|
||||
private static final long serialVersionUID = -8361264400619997123L; |
||||
|
||||
@Id |
||||
@GeneratedValue(strategy = GenerationType.IDENTITY) |
||||
private int id; |
||||
|
||||
@Temporal(TemporalType.TIMESTAMP) |
||||
private Date birth; |
||||
|
||||
@Temporal(TemporalType.TIMESTAMP) |
||||
private Date changed; |
||||
|
||||
@Temporal(TemporalType.TIMESTAMP) |
||||
private Date created; |
||||
|
||||
@Temporal(TemporalType.TIMESTAMP) |
||||
private Date deleted; |
||||
|
||||
private String password; |
||||
|
||||
private String prename; |
||||
|
||||
private String surname; |
||||
|
||||
private String username; |
||||
|
||||
// bi-directional many-to-one association to Adress
|
||||
@OneToMany(mappedBy = "person") |
||||
private List<Adress> adresses; |
||||
|
||||
// bi-directional many-to-one association to Attendance
|
||||
@OneToMany(mappedBy = "person") |
||||
private List<Attendance> attendances; |
||||
|
||||
// bi-directional many-to-one association to Contact
|
||||
@OneToMany(mappedBy = "person") |
||||
private List<Contact> contacts; |
||||
|
||||
// bi-directional many-to-many association to Persongroup
|
||||
@ManyToMany(fetch=FetchType.EAGER) |
||||
@JoinTable (name = "persongroup", |
||||
joinColumns = { @JoinColumn(name = "person_id") }, |
||||
inverseJoinColumns = { @JoinColumn(name = "group_id") }) |
||||
private List<GroupDef> groups; |
||||
|
||||
// bi-directional many-to-one association to Relative
|
||||
@OneToMany(mappedBy = "person1Bean") |
||||
private List<Relative> relatives1; |
||||
|
||||
// bi-directional many-to-one association to Relative
|
||||
@OneToMany(mappedBy = "person2Bean") |
||||
private List<Relative> relatives2; |
||||
|
||||
// bi-directional many-to-one association to Startpaesse
|
||||
@OneToMany(mappedBy = "person") |
||||
private List<Startpaesse> startpaesses; |
||||
|
||||
@ManyToMany(cascade = { CascadeType.MERGE, CascadeType.REFRESH, CascadeType.REMOVE, CascadeType.DETACH }, fetch = FetchType.LAZY) |
||||
@JoinTable( |
||||
name = "clubevent_has_person", |
||||
joinColumns = { @JoinColumn(name = "person_id") }, |
||||
inverseJoinColumns = { @JoinColumn(name = "clubevent_id") } |
||||
) |
||||
private Set<ClubEvent> events; |
||||
|
||||
public Person() { |
||||
} |
||||
|
||||
public int getId() { |
||||
return this.id; |
||||
} |
||||
|
||||
public void setId(int id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public Date getBirth() { |
||||
return this.birth; |
||||
} |
||||
|
||||
public void setBirth(Date birth) { |
||||
this.birth = birth; |
||||
} |
||||
|
||||
public Date getChanged() { |
||||
return this.changed; |
||||
} |
||||
|
||||
public void setChanged(Date changed) { |
||||
this.changed = changed; |
||||
} |
||||
|
||||
public Date getCreated() { |
||||
return this.created; |
||||
} |
||||
|
||||
public void setCreated(Date created) { |
||||
this.created = created; |
||||
} |
||||
|
||||
public Date getDeleted() { |
||||
return this.deleted; |
||||
} |
||||
|
||||
public void setDeleted(Date deleted) { |
||||
this.deleted = deleted; |
||||
} |
||||
|
||||
public String getPassword() { |
||||
return this.password; |
||||
} |
||||
|
||||
public void setPassword(String password) { |
||||
this.password = password; |
||||
} |
||||
|
||||
public String getPrename() { |
||||
return this.prename; |
||||
} |
||||
|
||||
public void setPrename(String prename) { |
||||
this.prename = prename; |
||||
} |
||||
|
||||
public String getSurname() { |
||||
return this.surname; |
||||
} |
||||
|
||||
public void setSurname(String surname) { |
||||
this.surname = surname; |
||||
} |
||||
|
||||
public String getUsername() { |
||||
return this.username; |
||||
} |
||||
|
||||
public void setUsername(String username) { |
||||
this.username = username; |
||||
} |
||||
|
||||
public List<Adress> getAdresses() { |
||||
return this.adresses; |
||||
} |
||||
|
||||
public void setAdresses(List<Adress> adresses) { |
||||
this.adresses = adresses; |
||||
} |
||||
|
||||
public Adress addAdress(Adress adress) { |
||||
getAdresses().add(adress); |
||||
adress.setPerson(this); |
||||
|
||||
return adress; |
||||
} |
||||
|
||||
public Adress removeAdress(Adress adress) { |
||||
getAdresses().remove(adress); |
||||
adress.setPerson(null); |
||||
|
||||
return adress; |
||||
} |
||||
|
||||
public List<Attendance> getAttendances() { |
||||
return this.attendances; |
||||
} |
||||
|
||||
public void setAttendances(List<Attendance> attendances) { |
||||
this.attendances = attendances; |
||||
} |
||||
|
||||
public Attendance addAttendance(Attendance attendance) { |
||||
getAttendances().add(attendance); |
||||
attendance.setPerson(this); |
||||
|
||||
return attendance; |
||||
} |
||||
|
||||
public Attendance removeAttendance(Attendance attendance) { |
||||
getAttendances().remove(attendance); |
||||
attendance.setPerson(null); |
||||
|
||||
return attendance; |
||||
} |
||||
|
||||
public List<Contact> getContacts() { |
||||
return this.contacts; |
||||
} |
||||
|
||||
public void setContacts(List<Contact> contacts) { |
||||
this.contacts = contacts; |
||||
} |
||||
|
||||
public Contact addContact(Contact contact) { |
||||
getContacts().add(contact); |
||||
contact.setPerson(this); |
||||
|
||||
return contact; |
||||
} |
||||
|
||||
public Contact removeContact(Contact contact) { |
||||
getContacts().remove(contact); |
||||
contact.setPerson(null); |
||||
|
||||
return contact; |
||||
} |
||||
|
||||
public List<GroupDef> getPersongroups() { |
||||
return this.groups; |
||||
} |
||||
|
||||
public void setPersongroups(List<GroupDef> persongroups) { |
||||
this.groups = persongroups; |
||||
} |
||||
|
||||
public void addPersongroup(GroupDef persongroup) { |
||||
getPersongroups().add(persongroup); |
||||
} |
||||
|
||||
public void removePersongroup(GroupDef persongroup) { |
||||
getPersongroups().remove(persongroup); |
||||
} |
||||
|
||||
public List<Relative> getRelatives1() { |
||||
return this.relatives1; |
||||
} |
||||
|
||||
public void setRelatives1(List<Relative> relatives1) { |
||||
this.relatives1 = relatives1; |
||||
} |
||||
|
||||
public Relative addRelatives1(Relative relatives1) { |
||||
getRelatives1().add(relatives1); |
||||
relatives1.setPerson1Bean(this); |
||||
|
||||
return relatives1; |
||||
} |
||||
|
||||
public Relative removeRelatives1(Relative relatives1) { |
||||
getRelatives1().remove(relatives1); |
||||
relatives1.setPerson1Bean(null); |
||||
|
||||
return relatives1; |
||||
} |
||||
|
||||
public List<Relative> getRelatives2() { |
||||
return this.relatives2; |
||||
} |
||||
|
||||
public void setRelatives2(List<Relative> relatives2) { |
||||
this.relatives2 = relatives2; |
||||
} |
||||
|
||||
public Relative addRelatives2(Relative relatives2) { |
||||
getRelatives2().add(relatives2); |
||||
relatives2.setPerson2Bean(this); |
||||
|
||||
return relatives2; |
||||
} |
||||
|
||||
public Relative removeRelatives2(Relative relatives2) { |
||||
getRelatives2().remove(relatives2); |
||||
relatives2.setPerson2Bean(null); |
||||
|
||||
return relatives2; |
||||
} |
||||
|
||||
public List<Startpaesse> getStartpaesses() { |
||||
return this.startpaesses; |
||||
} |
||||
|
||||
public void setStartpaesses(List<Startpaesse> startpaesses) { |
||||
this.startpaesses = startpaesses; |
||||
} |
||||
|
||||
public Startpaesse addStartpaess(Startpaesse startpaess) { |
||||
getStartpaesses().add(startpaess); |
||||
startpaess.setPerson(this); |
||||
|
||||
return startpaess; |
||||
} |
||||
|
||||
public Startpaesse removeStartpaess(Startpaesse startpaess) { |
||||
getStartpaesses().remove(startpaess); |
||||
startpaess.setPerson(null); |
||||
return startpaess; |
||||
} |
||||
|
||||
@Override |
||||
public int hashCode() { |
||||
final int prime = 31; |
||||
int result = 1; |
||||
result = prime * result + ((created == null) ? 0 : created.hashCode()); |
||||
result = prime * result + ((deleted == null) ? 0 : deleted.hashCode()); |
||||
result = prime * result + id; |
||||
result = prime * result + ((prename == null) ? 0 : prename.hashCode()); |
||||
result = prime * result + ((surname == null) ? 0 : surname.hashCode()); |
||||
result = prime * result + ((username == null) ? 0 : username.hashCode()); |
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object obj) { |
||||
if (this == obj) |
||||
return true; |
||||
if (obj == null) |
||||
return false; |
||||
if (getClass() != obj.getClass()) |
||||
return false; |
||||
Person other = (Person) obj; |
||||
if (created == null) { |
||||
if (other.created != null) |
||||
return false; |
||||
} else if (!created.equals(other.created)) |
||||
return false; |
||||
if (deleted == null) { |
||||
if (other.deleted != null) |
||||
return false; |
||||
} else if (!deleted.equals(other.deleted)) |
||||
return false; |
||||
if (id != other.id) |
||||
return false; |
||||
if (prename == null) { |
||||
if (other.prename != null) |
||||
return false; |
||||
} else if (!prename.equals(other.prename)) |
||||
return false; |
||||
if (surname == null) { |
||||
if (other.surname != null) |
||||
return false; |
||||
} else if (!surname.equals(other.surname)) |
||||
return false; |
||||
if (username == null) { |
||||
if (other.username != null) |
||||
return false; |
||||
} else if (!username.equals(other.username)) |
||||
return false; |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return "Person [id=" + id + ", prename=" + prename + ", surname=" + surname + "]"; |
||||
} |
||||
|
||||
package de.kreth.vaadin.clubhelper.vaadinclubhelper.data; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
import java.util.Set; |
||||
|
||||
import javax.persistence.*; |
||||
|
||||
/** |
||||
* The persistent class for the person database table. |
||||
* |
||||
*/ |
||||
@Entity |
||||
@Table(name = "person") |
||||
@NamedQuery(name = Person.QUERY_FINDALL, query = "SELECT p FROM Person p") |
||||
public class Person implements Serializable { |
||||
|
||||
public final static String QUERY_FINDALL = "Person.findAll"; |
||||
|
||||
private static final long serialVersionUID = -8361264400619997123L; |
||||
|
||||
@Id |
||||
@GeneratedValue(strategy = GenerationType.IDENTITY) |
||||
private int id; |
||||
|
||||
@Temporal(TemporalType.TIMESTAMP) |
||||
private Date birth; |
||||
|
||||
@Temporal(TemporalType.TIMESTAMP) |
||||
private Date changed; |
||||
|
||||
@Temporal(TemporalType.TIMESTAMP) |
||||
private Date created; |
||||
|
||||
@Temporal(TemporalType.TIMESTAMP) |
||||
private Date deleted; |
||||
|
||||
private String password; |
||||
|
||||
private String prename; |
||||
|
||||
private String surname; |
||||
|
||||
private String username; |
||||
|
||||
// bi-directional many-to-one association to Adress
|
||||
@OneToMany(mappedBy = "person") |
||||
private List<Adress> adresses; |
||||
|
||||
// bi-directional many-to-one association to Attendance
|
||||
@OneToMany(mappedBy = "person") |
||||
private List<Attendance> attendances; |
||||
|
||||
// bi-directional many-to-one association to Contact
|
||||
@OneToMany(mappedBy = "person") |
||||
private List<Contact> contacts; |
||||
|
||||
// bi-directional many-to-many association to Persongroup
|
||||
@ManyToMany(fetch=FetchType.EAGER) |
||||
@JoinTable (name = "persongroup", |
||||
joinColumns = { @JoinColumn(name = "person_id") }, |
||||
inverseJoinColumns = { @JoinColumn(name = "group_id") }) |
||||
private List<GroupDef> groups; |
||||
|
||||
// bi-directional many-to-one association to Relative
|
||||
@OneToMany(mappedBy = "person1Bean") |
||||
private List<Relative> relatives1; |
||||
|
||||
// bi-directional many-to-one association to Relative
|
||||
@OneToMany(mappedBy = "person2Bean") |
||||
private List<Relative> relatives2; |
||||
|
||||
// bi-directional many-to-one association to Startpaesse
|
||||
@OneToMany(mappedBy = "person") |
||||
private List<Startpaesse> startpaesses; |
||||
|
||||
@ManyToMany(cascade = { CascadeType.MERGE, CascadeType.REFRESH, CascadeType.REMOVE, CascadeType.DETACH }, fetch = FetchType.LAZY) |
||||
@JoinTable( |
||||
name = "clubevent_has_person", |
||||
joinColumns = { @JoinColumn(name = "person_id") }, |
||||
inverseJoinColumns = { @JoinColumn(name = "clubevent_id") } |
||||
) |
||||
private Set<ClubEvent> events; |
||||
|
||||
public Person() { |
||||
} |
||||
|
||||
public int getId() { |
||||
return this.id; |
||||
} |
||||
|
||||
public void setId(int id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public Date getBirth() { |
||||
return this.birth; |
||||
} |
||||
|
||||
public void setBirth(Date birth) { |
||||
this.birth = birth; |
||||
} |
||||
|
||||
public Date getChanged() { |
||||
return this.changed; |
||||
} |
||||
|
||||
public void setChanged(Date changed) { |
||||
this.changed = changed; |
||||
} |
||||
|
||||
public Date getCreated() { |
||||
return this.created; |
||||
} |
||||
|
||||
public void setCreated(Date created) { |
||||
this.created = created; |
||||
} |
||||
|
||||
public Date getDeleted() { |
||||
return this.deleted; |
||||
} |
||||
|
||||
public void setDeleted(Date deleted) { |
||||
this.deleted = deleted; |
||||
} |
||||
|
||||
public String getPassword() { |
||||
return this.password; |
||||
} |
||||
|
||||
public void setPassword(String password) { |
||||
this.password = password; |
||||
} |
||||
|
||||
public String getPrename() { |
||||
return this.prename; |
||||
} |
||||
|
||||
public void setPrename(String prename) { |
||||
this.prename = prename; |
||||
} |
||||
|
||||
public String getSurname() { |
||||
return this.surname; |
||||
} |
||||
|
||||
public void setSurname(String surname) { |
||||
this.surname = surname; |
||||
} |
||||
|
||||
public String getUsername() { |
||||
return this.username; |
||||
} |
||||
|
||||
public void setUsername(String username) { |
||||
this.username = username; |
||||
} |
||||
|
||||
public List<Adress> getAdresses() { |
||||
return this.adresses; |
||||
} |
||||
|
||||
public void setAdresses(List<Adress> adresses) { |
||||
this.adresses = adresses; |
||||
} |
||||
|
||||
public Adress addAdress(Adress adress) { |
||||
getAdresses().add(adress); |
||||
adress.setPerson(this); |
||||
|
||||
return adress; |
||||
} |
||||
|
||||
public Adress removeAdress(Adress adress) { |
||||
getAdresses().remove(adress); |
||||
adress.setPerson(null); |
||||
|
||||
return adress; |
||||
} |
||||
|
||||
public List<Attendance> getAttendances() { |
||||
return this.attendances; |
||||
} |
||||
|
||||
public void setAttendances(List<Attendance> attendances) { |
||||
this.attendances = attendances; |
||||
} |
||||
|
||||
public Attendance addAttendance(Attendance attendance) { |
||||
getAttendances().add(attendance); |
||||
attendance.setPerson(this); |
||||
|
||||
return attendance; |
||||
} |
||||
|
||||
public Attendance removeAttendance(Attendance attendance) { |
||||
getAttendances().remove(attendance); |
||||
attendance.setPerson(null); |
||||
|
||||
return attendance; |
||||
} |
||||
|
||||
public List<Contact> getContacts() { |
||||
return this.contacts; |
||||
} |
||||
|
||||
public void setContacts(List<Contact> contacts) { |
||||
this.contacts = contacts; |
||||
} |
||||
|
||||
public Contact addContact(Contact contact) { |
||||
getContacts().add(contact); |
||||
contact.setPerson(this); |
||||
|
||||
return contact; |
||||
} |
||||
|
||||
public Contact removeContact(Contact contact) { |
||||
getContacts().remove(contact); |
||||
contact.setPerson(null); |
||||
|
||||
return contact; |
||||
} |
||||
|
||||
public List<GroupDef> getPersongroups() { |
||||
return this.groups; |
||||
} |
||||
|
||||
public void setPersongroups(List<GroupDef> persongroups) { |
||||
this.groups = persongroups; |
||||
} |
||||
|
||||
public void addPersongroup(GroupDef persongroup) { |
||||
getPersongroups().add(persongroup); |
||||
} |
||||
|
||||
public void removePersongroup(GroupDef persongroup) { |
||||
getPersongroups().remove(persongroup); |
||||
} |
||||
|
||||
public List<Relative> getRelatives1() { |
||||
return this.relatives1; |
||||
} |
||||
|
||||
public void setRelatives1(List<Relative> relatives1) { |
||||
this.relatives1 = relatives1; |
||||
} |
||||
|
||||
public Relative addRelatives1(Relative relatives1) { |
||||
getRelatives1().add(relatives1); |
||||
relatives1.setPerson1Bean(this); |
||||
|
||||
return relatives1; |
||||
} |
||||
|
||||
public Relative removeRelatives1(Relative relatives1) { |
||||
getRelatives1().remove(relatives1); |
||||
relatives1.setPerson1Bean(null); |
||||
|
||||
return relatives1; |
||||
} |
||||
|
||||
public List<Relative> getRelatives2() { |
||||
return this.relatives2; |
||||
} |
||||
|
||||
public void setRelatives2(List<Relative> relatives2) { |
||||
this.relatives2 = relatives2; |
||||
} |
||||
|
||||
public Relative addRelatives2(Relative relatives2) { |
||||
getRelatives2().add(relatives2); |
||||
relatives2.setPerson2Bean(this); |
||||
|
||||
return relatives2; |
||||
} |
||||
|
||||
public Relative removeRelatives2(Relative relatives2) { |
||||
getRelatives2().remove(relatives2); |
||||
relatives2.setPerson2Bean(null); |
||||
|
||||
return relatives2; |
||||
} |
||||
|
||||
public List<Startpaesse> getStartpaesses() { |
||||
return this.startpaesses; |
||||
} |
||||
|
||||
public void setStartpaesses(List<Startpaesse> startpaesses) { |
||||
this.startpaesses = startpaesses; |
||||
} |
||||
|
||||
public Startpaesse addStartpaess(Startpaesse startpaess) { |
||||
getStartpaesses().add(startpaess); |
||||
startpaess.setPerson(this); |
||||
|
||||
return startpaess; |
||||
} |
||||
|
||||
public Startpaesse removeStartpaess(Startpaesse startpaess) { |
||||
getStartpaesses().remove(startpaess); |
||||
startpaess.setPerson(null); |
||||
return startpaess; |
||||
} |
||||
|
||||
@Override |
||||
public int hashCode() { |
||||
final int prime = 31; |
||||
int result = 1; |
||||
result = prime * result + ((created == null) ? 0 : created.hashCode()); |
||||
result = prime * result + ((deleted == null) ? 0 : deleted.hashCode()); |
||||
result = prime * result + id; |
||||
result = prime * result + ((prename == null) ? 0 : prename.hashCode()); |
||||
result = prime * result + ((surname == null) ? 0 : surname.hashCode()); |
||||
result = prime * result + ((username == null) ? 0 : username.hashCode()); |
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object obj) { |
||||
if (this == obj) |
||||
return true; |
||||
if (obj == null) |
||||
return false; |
||||
if (getClass() != obj.getClass()) |
||||
return false; |
||||
Person other = (Person) obj; |
||||
if (created == null) { |
||||
if (other.created != null) |
||||
return false; |
||||
} else if (!created.equals(other.created)) |
||||
return false; |
||||
if (deleted == null) { |
||||
if (other.deleted != null) |
||||
return false; |
||||
} else if (!deleted.equals(other.deleted)) |
||||
return false; |
||||
if (id != other.id) |
||||
return false; |
||||
if (prename == null) { |
||||
if (other.prename != null) |
||||
return false; |
||||
} else if (!prename.equals(other.prename)) |
||||
return false; |
||||
if (surname == null) { |
||||
if (other.surname != null) |
||||
return false; |
||||
} else if (!surname.equals(other.surname)) |
||||
return false; |
||||
if (username == null) { |
||||
if (other.username != null) |
||||
return false; |
||||
} else if (!username.equals(other.username)) |
||||
return false; |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return "Person [id=" + id + ", prename=" + prename + ", surname=" + surname + "]"; |
||||
} |
||||
|
||||
} |
||||
@ -1,131 +1,131 @@ |
||||
package de.kreth.vaadin.clubhelper.vaadinclubhelper.data; |
||||
|
||||
import java.io.Serializable; |
||||
import javax.persistence.*; |
||||
import java.util.Date; |
||||
|
||||
|
||||
/** |
||||
* The persistent class for the persongroup database table. |
||||
* |
||||
*/ |
||||
@Entity |
||||
@Table(name="persongroup") |
||||
@NamedQuery(name="Persongroup.findAll", query="SELECT p FROM Persongroup p") |
||||
public class Persongroup implements Serializable { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@Id |
||||
@GeneratedValue(strategy=GenerationType.IDENTITY) |
||||
private int id; |
||||
|
||||
@Temporal(TemporalType.TIMESTAMP) |
||||
private Date changed; |
||||
|
||||
@Temporal(TemporalType.TIMESTAMP) |
||||
private Date created; |
||||
|
||||
@Temporal(TemporalType.TIMESTAMP) |
||||
private Date deleted; |
||||
|
||||
//bi-directional many-to-one association to Person
|
||||
@ManyToOne |
||||
private Person person; |
||||
|
||||
//bi-directional many-to-one association to GroupDef
|
||||
@ManyToOne |
||||
@JoinColumn(name="group_id") |
||||
private GroupDef groupDef; |
||||
|
||||
public Persongroup() { |
||||
} |
||||
|
||||
public int getId() { |
||||
return this.id; |
||||
} |
||||
|
||||
public void setId(int id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public Date getChanged() { |
||||
return this.changed; |
||||
} |
||||
|
||||
public void setChanged(Date changed) { |
||||
this.changed = changed; |
||||
} |
||||
|
||||
public Date getCreated() { |
||||
return this.created; |
||||
} |
||||
|
||||
public void setCreated(Date created) { |
||||
this.created = created; |
||||
} |
||||
|
||||
public Date getDeleted() { |
||||
return this.deleted; |
||||
} |
||||
|
||||
public void setDeleted(Date deleted) { |
||||
this.deleted = deleted; |
||||
} |
||||
|
||||
public Person getPerson() { |
||||
return this.person; |
||||
} |
||||
|
||||
public void setPerson(Person person) { |
||||
this.person = person; |
||||
} |
||||
|
||||
public GroupDef getGroupDef() { |
||||
return this.groupDef; |
||||
} |
||||
|
||||
public void setGroupDef(GroupDef groupDef) { |
||||
this.groupDef = groupDef; |
||||
} |
||||
|
||||
@Override |
||||
public int hashCode() { |
||||
final int prime = 31; |
||||
int result = 1; |
||||
result = prime * result + ((deleted == null) ? 0 : deleted.hashCode()); |
||||
result = prime * result + ((groupDef == null) ? 0 : groupDef.hashCode()); |
||||
result = prime * result + id; |
||||
result = prime * result + ((person == null) ? 0 : person.hashCode()); |
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object obj) { |
||||
if (this == obj) |
||||
return true; |
||||
if (obj == null) |
||||
return false; |
||||
if (getClass() != obj.getClass()) |
||||
return false; |
||||
Persongroup other = (Persongroup) obj; |
||||
if (deleted == null) { |
||||
if (other.deleted != null) |
||||
return false; |
||||
} else if (!deleted.equals(other.deleted)) |
||||
return false; |
||||
if (groupDef == null) { |
||||
if (other.groupDef != null) |
||||
return false; |
||||
} else if (!groupDef.equals(other.groupDef)) |
||||
return false; |
||||
if (id != other.id) |
||||
return false; |
||||
if (person == null) { |
||||
if (other.person != null) |
||||
return false; |
||||
} else if (!person.equals(other.person)) |
||||
return false; |
||||
return true; |
||||
} |
||||
|
||||
package de.kreth.vaadin.clubhelper.vaadinclubhelper.data; |
||||
|
||||
import java.io.Serializable; |
||||
import javax.persistence.*; |
||||
import java.util.Date; |
||||
|
||||
|
||||
/** |
||||
* The persistent class for the persongroup database table. |
||||
* |
||||
*/ |
||||
@Entity |
||||
@Table(name="persongroup") |
||||
@NamedQuery(name="Persongroup.findAll", query="SELECT p FROM Persongroup p") |
||||
public class Persongroup implements Serializable { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@Id |
||||
@GeneratedValue(strategy=GenerationType.IDENTITY) |
||||
private int id; |
||||
|
||||
@Temporal(TemporalType.TIMESTAMP) |
||||
private Date changed; |
||||
|
||||
@Temporal(TemporalType.TIMESTAMP) |
||||
private Date created; |
||||
|
||||
@Temporal(TemporalType.TIMESTAMP) |
||||
private Date deleted; |
||||
|
||||
//bi-directional many-to-one association to Person
|
||||
@ManyToOne |
||||
private Person person; |
||||
|
||||
//bi-directional many-to-one association to GroupDef
|
||||
@ManyToOne |
||||
@JoinColumn(name="group_id") |
||||
private GroupDef groupDef; |
||||
|
||||
public Persongroup() { |
||||
} |
||||
|
||||
public int getId() { |
||||
return this.id; |
||||
} |
||||
|
||||
public void setId(int id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public Date getChanged() { |
||||
return this.changed; |
||||
} |
||||
|
||||
public void setChanged(Date changed) { |
||||
this.changed = changed; |
||||
} |
||||
|
||||
public Date getCreated() { |
||||
return this.created; |
||||
} |
||||
|
||||
public void setCreated(Date created) { |
||||
this.created = created; |
||||
} |
||||
|
||||
public Date getDeleted() { |
||||
return this.deleted; |
||||
} |
||||
|
||||
public void setDeleted(Date deleted) { |
||||
this.deleted = deleted; |
||||
} |
||||
|
||||
public Person getPerson() { |
||||
return this.person; |
||||
} |
||||
|
||||
public void setPerson(Person person) { |
||||
this.person = person; |
||||
} |
||||
|
||||
public GroupDef getGroupDef() { |
||||
return this.groupDef; |
||||
} |
||||
|
||||
public void setGroupDef(GroupDef groupDef) { |
||||
this.groupDef = groupDef; |
||||
} |
||||
|
||||
@Override |
||||
public int hashCode() { |
||||
final int prime = 31; |
||||
int result = 1; |
||||
result = prime * result + ((deleted == null) ? 0 : deleted.hashCode()); |
||||
result = prime * result + ((groupDef == null) ? 0 : groupDef.hashCode()); |
||||
result = prime * result + id; |
||||
result = prime * result + ((person == null) ? 0 : person.hashCode()); |
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object obj) { |
||||
if (this == obj) |
||||
return true; |
||||
if (obj == null) |
||||
return false; |
||||
if (getClass() != obj.getClass()) |
||||
return false; |
||||
Persongroup other = (Persongroup) obj; |
||||
if (deleted == null) { |
||||
if (other.deleted != null) |
||||
return false; |
||||
} else if (!deleted.equals(other.deleted)) |
||||
return false; |
||||
if (groupDef == null) { |
||||
if (other.groupDef != null) |
||||
return false; |
||||
} else if (!groupDef.equals(other.groupDef)) |
||||
return false; |
||||
if (id != other.id) |
||||
return false; |
||||
if (person == null) { |
||||
if (other.person != null) |
||||
return false; |
||||
} else if (!person.equals(other.person)) |
||||
return false; |
||||
return true; |
||||
} |
||||
|
||||
} |
||||
@ -1,166 +1,166 @@ |
||||
package de.kreth.vaadin.clubhelper.vaadinclubhelper.data; |
||||
|
||||
import java.io.Serializable; |
||||
import javax.persistence.*; |
||||
import java.util.Date; |
||||
|
||||
|
||||
/** |
||||
* The persistent class for the relative database table. |
||||
* |
||||
*/ |
||||
@Entity |
||||
@Table(name="relative") |
||||
@NamedQuery(name="Relative.findAll", query="SELECT r FROM Relative r") |
||||
public class Relative implements Serializable { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@Id |
||||
@GeneratedValue(strategy=GenerationType.IDENTITY) |
||||
private int id; |
||||
|
||||
@Temporal(TemporalType.TIMESTAMP) |
||||
private Date changed; |
||||
|
||||
@Temporal(TemporalType.TIMESTAMP) |
||||
private Date created; |
||||
|
||||
@Temporal(TemporalType.TIMESTAMP) |
||||
private Date deleted; |
||||
|
||||
@Column(name="TO_PERSON1_RELATION") |
||||
private String toPerson1Relation; |
||||
|
||||
@Column(name="TO_PERSON2_RELATION") |
||||
private String toPerson2Relation; |
||||
|
||||
//bi-directional many-to-one association to Person
|
||||
@ManyToOne |
||||
@JoinColumn(name="person1") |
||||
private Person person1Bean; |
||||
|
||||
//bi-directional many-to-one association to Person
|
||||
@ManyToOne |
||||
@JoinColumn(name="person2") |
||||
private Person person2Bean; |
||||
|
||||
public Relative() { |
||||
} |
||||
|
||||
public int getId() { |
||||
return this.id; |
||||
} |
||||
|
||||
public void setId(int id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public Date getChanged() { |
||||
return this.changed; |
||||
} |
||||
|
||||
public void setChanged(Date changed) { |
||||
this.changed = changed; |
||||
} |
||||
|
||||
public Date getCreated() { |
||||
return this.created; |
||||
} |
||||
|
||||
public void setCreated(Date created) { |
||||
this.created = created; |
||||
} |
||||
|
||||
public Date getDeleted() { |
||||
return this.deleted; |
||||
} |
||||
|
||||
public void setDeleted(Date deleted) { |
||||
this.deleted = deleted; |
||||
} |
||||
|
||||
public String getToPerson1Relation() { |
||||
return this.toPerson1Relation; |
||||
} |
||||
|
||||
public void setToPerson1Relation(String toPerson1Relation) { |
||||
this.toPerson1Relation = toPerson1Relation; |
||||
} |
||||
|
||||
public String getToPerson2Relation() { |
||||
return this.toPerson2Relation; |
||||
} |
||||
|
||||
public void setToPerson2Relation(String toPerson2Relation) { |
||||
this.toPerson2Relation = toPerson2Relation; |
||||
} |
||||
|
||||
public Person getPerson1Bean() { |
||||
return this.person1Bean; |
||||
} |
||||
|
||||
public void setPerson1Bean(Person person1Bean) { |
||||
this.person1Bean = person1Bean; |
||||
} |
||||
|
||||
public Person getPerson2Bean() { |
||||
return this.person2Bean; |
||||
} |
||||
|
||||
public void setPerson2Bean(Person person2Bean) { |
||||
this.person2Bean = person2Bean; |
||||
} |
||||
|
||||
@Override |
||||
public int hashCode() { |
||||
final int prime = 31; |
||||
int result = 1; |
||||
result = prime * result + ((deleted == null) ? 0 : deleted.hashCode()); |
||||
result = prime * result + id; |
||||
result = prime * result + ((person1Bean == null) ? 0 : person1Bean.hashCode()); |
||||
result = prime * result + ((person2Bean == null) ? 0 : person2Bean.hashCode()); |
||||
result = prime * result + ((toPerson1Relation == null) ? 0 : toPerson1Relation.hashCode()); |
||||
result = prime * result + ((toPerson2Relation == null) ? 0 : toPerson2Relation.hashCode()); |
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object obj) { |
||||
if (this == obj) |
||||
return true; |
||||
if (obj == null) |
||||
return false; |
||||
if (getClass() != obj.getClass()) |
||||
return false; |
||||
Relative other = (Relative) obj; |
||||
if (deleted == null) { |
||||
if (other.deleted != null) |
||||
return false; |
||||
} else if (!deleted.equals(other.deleted)) |
||||
return false; |
||||
if (id != other.id) |
||||
return false; |
||||
if (person1Bean == null) { |
||||
if (other.person1Bean != null) |
||||
return false; |
||||
} else if (!person1Bean.equals(other.person1Bean)) |
||||
return false; |
||||
if (person2Bean == null) { |
||||
if (other.person2Bean != null) |
||||
return false; |
||||
} else if (!person2Bean.equals(other.person2Bean)) |
||||
return false; |
||||
if (toPerson1Relation == null) { |
||||
if (other.toPerson1Relation != null) |
||||
return false; |
||||
} else if (!toPerson1Relation.equals(other.toPerson1Relation)) |
||||
return false; |
||||
if (toPerson2Relation == null) { |
||||
if (other.toPerson2Relation != null) |
||||
return false; |
||||
} else if (!toPerson2Relation.equals(other.toPerson2Relation)) |
||||
return false; |
||||
return true; |
||||
} |
||||
|
||||
package de.kreth.vaadin.clubhelper.vaadinclubhelper.data; |
||||
|
||||
import java.io.Serializable; |
||||
import javax.persistence.*; |
||||
import java.util.Date; |
||||
|
||||
|
||||
/** |
||||
* The persistent class for the relative database table. |
||||
* |
||||
*/ |
||||
@Entity |
||||
@Table(name="relative") |
||||
@NamedQuery(name="Relative.findAll", query="SELECT r FROM Relative r") |
||||
public class Relative implements Serializable { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@Id |
||||
@GeneratedValue(strategy=GenerationType.IDENTITY) |
||||
private int id; |
||||
|
||||
@Temporal(TemporalType.TIMESTAMP) |
||||
private Date changed; |
||||
|
||||
@Temporal(TemporalType.TIMESTAMP) |
||||
private Date created; |
||||
|
||||
@Temporal(TemporalType.TIMESTAMP) |
||||
private Date deleted; |
||||
|
||||
@Column(name="TO_PERSON1_RELATION") |
||||
private String toPerson1Relation; |
||||
|
||||
@Column(name="TO_PERSON2_RELATION") |
||||
private String toPerson2Relation; |
||||
|
||||
//bi-directional many-to-one association to Person
|
||||
@ManyToOne |
||||
@JoinColumn(name="person1") |
||||
private Person person1Bean; |
||||
|
||||
//bi-directional many-to-one association to Person
|
||||
@ManyToOne |
||||
@JoinColumn(name="person2") |
||||
private Person person2Bean; |
||||
|
||||
public Relative() { |
||||
} |
||||
|
||||
public int getId() { |
||||
return this.id; |
||||
} |
||||
|
||||
public void setId(int id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public Date getChanged() { |
||||
return this.changed; |
||||
} |
||||
|
||||
public void setChanged(Date changed) { |
||||
this.changed = changed; |
||||
} |
||||
|
||||
public Date getCreated() { |
||||
return this.created; |
||||
} |
||||
|
||||
public void setCreated(Date created) { |
||||
this.created = created; |
||||
} |
||||
|
||||
public Date getDeleted() { |
||||
return this.deleted; |
||||
} |
||||
|
||||
public void setDeleted(Date deleted) { |
||||
this.deleted = deleted; |
||||
} |
||||
|
||||
public String getToPerson1Relation() { |
||||
return this.toPerson1Relation; |
||||
} |
||||
|
||||
public void setToPerson1Relation(String toPerson1Relation) { |
||||
this.toPerson1Relation = toPerson1Relation; |
||||
} |
||||
|
||||
public String getToPerson2Relation() { |
||||
return this.toPerson2Relation; |
||||
} |
||||
|
||||
public void setToPerson2Relation(String toPerson2Relation) { |
||||
this.toPerson2Relation = toPerson2Relation; |
||||
} |
||||
|
||||
public Person getPerson1Bean() { |
||||
return this.person1Bean; |
||||
} |
||||
|
||||
public void setPerson1Bean(Person person1Bean) { |
||||
this.person1Bean = person1Bean; |
||||
} |
||||
|
||||
public Person getPerson2Bean() { |
||||
return this.person2Bean; |
||||
} |
||||
|
||||
public void setPerson2Bean(Person person2Bean) { |
||||
this.person2Bean = person2Bean; |
||||
} |
||||
|
||||
@Override |
||||
public int hashCode() { |
||||
final int prime = 31; |
||||
int result = 1; |
||||
result = prime * result + ((deleted == null) ? 0 : deleted.hashCode()); |
||||
result = prime * result + id; |
||||
result = prime * result + ((person1Bean == null) ? 0 : person1Bean.hashCode()); |
||||
result = prime * result + ((person2Bean == null) ? 0 : person2Bean.hashCode()); |
||||
result = prime * result + ((toPerson1Relation == null) ? 0 : toPerson1Relation.hashCode()); |
||||
result = prime * result + ((toPerson2Relation == null) ? 0 : toPerson2Relation.hashCode()); |
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object obj) { |
||||
if (this == obj) |
||||
return true; |
||||
if (obj == null) |
||||
return false; |
||||
if (getClass() != obj.getClass()) |
||||
return false; |
||||
Relative other = (Relative) obj; |
||||
if (deleted == null) { |
||||
if (other.deleted != null) |
||||
return false; |
||||
} else if (!deleted.equals(other.deleted)) |
||||
return false; |
||||
if (id != other.id) |
||||
return false; |
||||
if (person1Bean == null) { |
||||
if (other.person1Bean != null) |
||||
return false; |
||||
} else if (!person1Bean.equals(other.person1Bean)) |
||||
return false; |
||||
if (person2Bean == null) { |
||||
if (other.person2Bean != null) |
||||
return false; |
||||
} else if (!person2Bean.equals(other.person2Bean)) |
||||
return false; |
||||
if (toPerson1Relation == null) { |
||||
if (other.toPerson1Relation != null) |
||||
return false; |
||||
} else if (!toPerson1Relation.equals(other.toPerson1Relation)) |
||||
return false; |
||||
if (toPerson2Relation == null) { |
||||
if (other.toPerson2Relation != null) |
||||
return false; |
||||
} else if (!toPerson2Relation.equals(other.toPerson2Relation)) |
||||
return false; |
||||
return true; |
||||
} |
||||
|
||||
} |
||||
@ -1,162 +1,162 @@ |
||||
package de.kreth.vaadin.clubhelper.vaadinclubhelper.data; |
||||
|
||||
import java.io.Serializable; |
||||
import javax.persistence.*; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
|
||||
|
||||
/** |
||||
* The persistent class for the startpaesse database table. |
||||
* |
||||
*/ |
||||
@Entity |
||||
@Table(name="startpaesse") |
||||
@NamedQuery(name="Startpaesse.findAll", query="SELECT s FROM Startpaesse s") |
||||
public class Startpaesse implements Serializable { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@Id |
||||
@GeneratedValue(strategy=GenerationType.IDENTITY) |
||||
private int id; |
||||
|
||||
@Temporal(TemporalType.TIMESTAMP) |
||||
private Date changed; |
||||
|
||||
@Temporal(TemporalType.TIMESTAMP) |
||||
private Date created; |
||||
|
||||
@Temporal(TemporalType.TIMESTAMP) |
||||
private Date deleted; |
||||
|
||||
@Column(name="startpass_nr") |
||||
private String startpassNr; |
||||
|
||||
//bi-directional many-to-one association to Person
|
||||
@ManyToOne |
||||
private Person person; |
||||
|
||||
//bi-directional many-to-one association to StartpassStartrechte
|
||||
@OneToMany(mappedBy="startpaesse") |
||||
private List<StartpassStartrechte> startpassStartrechtes; |
||||
|
||||
public Startpaesse() { |
||||
} |
||||
|
||||
public int getId() { |
||||
return this.id; |
||||
} |
||||
|
||||
public void setId(int id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public Date getChanged() { |
||||
return this.changed; |
||||
} |
||||
|
||||
public void setChanged(Date changed) { |
||||
this.changed = changed; |
||||
} |
||||
|
||||
public Date getCreated() { |
||||
return this.created; |
||||
} |
||||
|
||||
public void setCreated(Date created) { |
||||
this.created = created; |
||||
} |
||||
|
||||
public Date getDeleted() { |
||||
return this.deleted; |
||||
} |
||||
|
||||
public void setDeleted(Date deleted) { |
||||
this.deleted = deleted; |
||||
} |
||||
|
||||
public String getStartpassNr() { |
||||
return this.startpassNr; |
||||
} |
||||
|
||||
public void setStartpassNr(String startpassNr) { |
||||
this.startpassNr = startpassNr; |
||||
} |
||||
|
||||
public Person getPerson() { |
||||
return this.person; |
||||
} |
||||
|
||||
public void setPerson(Person person) { |
||||
this.person = person; |
||||
} |
||||
|
||||
public List<StartpassStartrechte> getStartpassStartrechtes() { |
||||
return this.startpassStartrechtes; |
||||
} |
||||
|
||||
public void setStartpassStartrechtes(List<StartpassStartrechte> startpassStartrechtes) { |
||||
this.startpassStartrechtes = startpassStartrechtes; |
||||
} |
||||
|
||||
public StartpassStartrechte addStartpassStartrechte(StartpassStartrechte startpassStartrechte) { |
||||
getStartpassStartrechtes().add(startpassStartrechte); |
||||
startpassStartrechte.setStartpaesse(this); |
||||
|
||||
return startpassStartrechte; |
||||
} |
||||
|
||||
public StartpassStartrechte removeStartpassStartrechte(StartpassStartrechte startpassStartrechte) { |
||||
getStartpassStartrechtes().remove(startpassStartrechte); |
||||
startpassStartrechte.setStartpaesse(null); |
||||
|
||||
return startpassStartrechte; |
||||
} |
||||
|
||||
@Override |
||||
public int hashCode() { |
||||
final int prime = 31; |
||||
int result = 1; |
||||
result = prime * result + ((deleted == null) ? 0 : deleted.hashCode()); |
||||
result = prime * result + id; |
||||
result = prime * result + ((person == null) ? 0 : person.hashCode()); |
||||
result = prime * result + ((startpassNr == null) ? 0 : startpassNr.hashCode()); |
||||
result = prime * result + ((startpassStartrechtes == null) ? 0 : startpassStartrechtes.hashCode()); |
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object obj) { |
||||
if (this == obj) |
||||
return true; |
||||
if (obj == null) |
||||
return false; |
||||
if (getClass() != obj.getClass()) |
||||
return false; |
||||
Startpaesse other = (Startpaesse) obj; |
||||
if (deleted == null) { |
||||
if (other.deleted != null) |
||||
return false; |
||||
} else if (!deleted.equals(other.deleted)) |
||||
return false; |
||||
if (id != other.id) |
||||
return false; |
||||
if (person == null) { |
||||
if (other.person != null) |
||||
return false; |
||||
} else if (!person.equals(other.person)) |
||||
return false; |
||||
if (startpassNr == null) { |
||||
if (other.startpassNr != null) |
||||
return false; |
||||
} else if (!startpassNr.equals(other.startpassNr)) |
||||
return false; |
||||
if (startpassStartrechtes == null) { |
||||
if (other.startpassStartrechtes != null) |
||||
return false; |
||||
} else if (!startpassStartrechtes.equals(other.startpassStartrechtes)) |
||||
return false; |
||||
return true; |
||||
} |
||||
|
||||
package de.kreth.vaadin.clubhelper.vaadinclubhelper.data; |
||||
|
||||
import java.io.Serializable; |
||||
import javax.persistence.*; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
|
||||
|
||||
/** |
||||
* The persistent class for the startpaesse database table. |
||||
* |
||||
*/ |
||||
@Entity |
||||
@Table(name="startpaesse") |
||||
@NamedQuery(name="Startpaesse.findAll", query="SELECT s FROM Startpaesse s") |
||||
public class Startpaesse implements Serializable { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@Id |
||||
@GeneratedValue(strategy=GenerationType.IDENTITY) |
||||
private int id; |
||||
|
||||
@Temporal(TemporalType.TIMESTAMP) |
||||
private Date changed; |
||||
|
||||
@Temporal(TemporalType.TIMESTAMP) |
||||
private Date created; |
||||
|
||||
@Temporal(TemporalType.TIMESTAMP) |
||||
private Date deleted; |
||||
|
||||
@Column(name="startpass_nr") |
||||
private String startpassNr; |
||||
|
||||
//bi-directional many-to-one association to Person
|
||||
@ManyToOne |
||||
private Person person; |
||||
|
||||
//bi-directional many-to-one association to StartpassStartrechte
|
||||
@OneToMany(mappedBy="startpaesse") |
||||
private List<StartpassStartrechte> startpassStartrechtes; |
||||
|
||||
public Startpaesse() { |
||||
} |
||||
|
||||
public int getId() { |
||||
return this.id; |
||||
} |
||||
|
||||
public void setId(int id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public Date getChanged() { |
||||
return this.changed; |
||||
} |
||||
|
||||
public void setChanged(Date changed) { |
||||
this.changed = changed; |
||||
} |
||||
|
||||
public Date getCreated() { |
||||
return this.created; |
||||
} |
||||
|
||||
public void setCreated(Date created) { |
||||
this.created = created; |
||||
} |
||||
|
||||
public Date getDeleted() { |
||||
return this.deleted; |
||||
} |
||||
|
||||
public void setDeleted(Date deleted) { |
||||
this.deleted = deleted; |
||||
} |
||||
|
||||
public String getStartpassNr() { |
||||
return this.startpassNr; |
||||
} |
||||
|
||||
public void setStartpassNr(String startpassNr) { |
||||
this.startpassNr = startpassNr; |
||||
} |
||||
|
||||
public Person getPerson() { |
||||
return this.person; |
||||
} |
||||
|
||||
public void setPerson(Person person) { |
||||
this.person = person; |
||||
} |
||||
|
||||
public List<StartpassStartrechte> getStartpassStartrechtes() { |
||||
return this.startpassStartrechtes; |
||||
} |
||||
|
||||
public void setStartpassStartrechtes(List<StartpassStartrechte> startpassStartrechtes) { |
||||
this.startpassStartrechtes = startpassStartrechtes; |
||||
} |
||||
|
||||
public StartpassStartrechte addStartpassStartrechte(StartpassStartrechte startpassStartrechte) { |
||||
getStartpassStartrechtes().add(startpassStartrechte); |
||||
startpassStartrechte.setStartpaesse(this); |
||||
|
||||
return startpassStartrechte; |
||||
} |
||||
|
||||
public StartpassStartrechte removeStartpassStartrechte(StartpassStartrechte startpassStartrechte) { |
||||
getStartpassStartrechtes().remove(startpassStartrechte); |
||||
startpassStartrechte.setStartpaesse(null); |
||||
|
||||
return startpassStartrechte; |
||||
} |
||||
|
||||
@Override |
||||
public int hashCode() { |
||||
final int prime = 31; |
||||
int result = 1; |
||||
result = prime * result + ((deleted == null) ? 0 : deleted.hashCode()); |
||||
result = prime * result + id; |
||||
result = prime * result + ((person == null) ? 0 : person.hashCode()); |
||||
result = prime * result + ((startpassNr == null) ? 0 : startpassNr.hashCode()); |
||||
result = prime * result + ((startpassStartrechtes == null) ? 0 : startpassStartrechtes.hashCode()); |
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object obj) { |
||||
if (this == obj) |
||||
return true; |
||||
if (obj == null) |
||||
return false; |
||||
if (getClass() != obj.getClass()) |
||||
return false; |
||||
Startpaesse other = (Startpaesse) obj; |
||||
if (deleted == null) { |
||||
if (other.deleted != null) |
||||
return false; |
||||
} else if (!deleted.equals(other.deleted)) |
||||
return false; |
||||
if (id != other.id) |
||||
return false; |
||||
if (person == null) { |
||||
if (other.person != null) |
||||
return false; |
||||
} else if (!person.equals(other.person)) |
||||
return false; |
||||
if (startpassNr == null) { |
||||
if (other.startpassNr != null) |
||||
return false; |
||||
} else if (!startpassNr.equals(other.startpassNr)) |
||||
return false; |
||||
if (startpassStartrechtes == null) { |
||||
if (other.startpassStartrechtes != null) |
||||
return false; |
||||
} else if (!startpassStartrechtes.equals(other.startpassStartrechtes)) |
||||
return false; |
||||
return true; |
||||
} |
||||
|
||||
} |
||||
@ -1,125 +1,125 @@ |
||||
package de.kreth.vaadin.clubhelper.vaadinclubhelper.ui; |
||||
|
||||
import java.util.List; |
||||
import java.util.Set; |
||||
import java.util.concurrent.ExecutorService; |
||||
import java.util.concurrent.Executors; |
||||
|
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.vaadin.addon.calendar.ui.CalendarComponentEvents; |
||||
|
||||
import com.vaadin.annotations.Push; |
||||
import com.vaadin.annotations.Theme; |
||||
import com.vaadin.event.selection.SelectionEvent; |
||||
import com.vaadin.server.VaadinRequest; |
||||
import com.vaadin.shared.communication.PushMode; |
||||
import com.vaadin.spring.annotation.SpringUI; |
||||
import com.vaadin.ui.HorizontalLayout; |
||||
import com.vaadin.ui.UI; |
||||
|
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.business.EventBusiness; |
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.dao.GroupDao; |
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.dao.PersonDao; |
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.ClubEvent; |
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Person; |
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.components.CalendarComponent; |
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.components.PersonEditDialog; |
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.components.PersonGrid; |
||||
|
||||
@Theme("vaadin-clubhelpertheme") |
||||
@SpringUI |
||||
@Push(value=PushMode.MANUAL) |
||||
public class MainUi extends UI { |
||||
|
||||
private static final long serialVersionUID = 7581634188909841919L; |
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MainUi.class); |
||||
|
||||
@Autowired |
||||
PersonDao personDao; |
||||
|
||||
@Autowired |
||||
GroupDao groupDao; |
||||
|
||||
@Autowired |
||||
EventBusiness eventBusiness; |
||||
|
||||
private PersonGrid personGrid; |
||||
|
||||
private CalendarComponent calendar; |
||||
|
||||
private HorizontalLayout contentLayout; |
||||
|
||||
@Override |
||||
protected void init(VaadinRequest request) { |
||||
|
||||
LOGGER.debug("Starting Vaadin UI with " + getClass().getName()); |
||||
|
||||
List<Person> persons = personDao.listAll(); |
||||
personGrid = new PersonGrid(groupDao); |
||||
personGrid.setItems(persons); |
||||
personGrid.setCaption("Personen"); |
||||
personGrid.onClosedFunction(() -> detailClosed()); |
||||
personGrid.onPersonSelect(ev -> personSelectionChange(ev)); |
||||
personGrid.onPersonEdit(p -> onPersonEdit(p)); |
||||
|
||||
this.calendar = new CalendarComponent(); |
||||
calendar.setHandler(this::onItemClick); |
||||
|
||||
contentLayout = new HorizontalLayout(); |
||||
contentLayout.setSizeFull(); |
||||
contentLayout.addComponents(calendar); |
||||
|
||||
setContent(contentLayout); |
||||
setSizeFull(); |
||||
|
||||
ExecutorService exec = Executors.newSingleThreadExecutor(); |
||||
exec.execute(() -> { |
||||
|
||||
final List<ClubEvent> events = eventBusiness.loadEvents(request); |
||||
LOGGER.info("Loaded events: {}", events); |
||||
final UI ui = calendar.getUI(); |
||||
ui.access(() -> { |
||||
calendar.setItems(events); |
||||
ui.push(); |
||||
}); |
||||
|
||||
}); |
||||
exec.shutdown(); |
||||
LOGGER.info("Loaded UI and started fetch of Events"); |
||||
} |
||||
|
||||
private void onPersonEdit(Person p) { |
||||
PersonEditDialog dlg = new PersonEditDialog(groupDao.listAll(), p, personDao); |
||||
getUI().addWindow(dlg); |
||||
} |
||||
|
||||
private void personSelectionChange(SelectionEvent<Person> ev) { |
||||
Set<Person> selected = ev.getAllSelectedItems(); |
||||
LOGGER.debug("Selection changed to: {}", selected); |
||||
eventBusiness.changePersons(selected); |
||||
} |
||||
|
||||
private void detailClosed() { |
||||
LOGGER.debug("Closing detail view."); |
||||
contentLayout.removeComponent(personGrid); |
||||
} |
||||
|
||||
private void onItemClick(CalendarComponentEvents.ItemClickEvent event) { |
||||
ClubEvent ev = (ClubEvent) event.getCalendarItem(); |
||||
LOGGER.debug("Opening detail view for {}", ev); |
||||
|
||||
contentLayout.removeComponent(personGrid); |
||||
contentLayout.addComponent(personGrid); |
||||
|
||||
personGrid.setCaption(ev.getCaption()); |
||||
personGrid.setTitle(ev.getCaption()); |
||||
personGrid.setEnabled(false); |
||||
personGrid.selectItems(ev.getPersons()); |
||||
personGrid.setVisible(true); |
||||
personGrid.setEnabled(true); |
||||
eventBusiness.setSelected(ev); |
||||
} |
||||
|
||||
} |
||||
package de.kreth.vaadin.clubhelper.vaadinclubhelper.ui; |
||||
|
||||
import java.util.List; |
||||
import java.util.Set; |
||||
import java.util.concurrent.ExecutorService; |
||||
import java.util.concurrent.Executors; |
||||
|
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.vaadin.addon.calendar.ui.CalendarComponentEvents; |
||||
|
||||
import com.vaadin.annotations.Push; |
||||
import com.vaadin.annotations.Theme; |
||||
import com.vaadin.event.selection.SelectionEvent; |
||||
import com.vaadin.server.VaadinRequest; |
||||
import com.vaadin.shared.communication.PushMode; |
||||
import com.vaadin.spring.annotation.SpringUI; |
||||
import com.vaadin.ui.HorizontalLayout; |
||||
import com.vaadin.ui.UI; |
||||
|
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.business.EventBusiness; |
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.dao.GroupDao; |
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.dao.PersonDao; |
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.ClubEvent; |
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Person; |
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.components.CalendarComponent; |
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.components.PersonEditDialog; |
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.components.PersonGrid; |
||||
|
||||
@Theme("vaadin-clubhelpertheme") |
||||
@SpringUI |
||||
@Push(value=PushMode.MANUAL) |
||||
public class MainUi extends UI { |
||||
|
||||
private static final long serialVersionUID = 7581634188909841919L; |
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MainUi.class); |
||||
|
||||
@Autowired |
||||
PersonDao personDao; |
||||
|
||||
@Autowired |
||||
GroupDao groupDao; |
||||
|
||||
@Autowired |
||||
EventBusiness eventBusiness; |
||||
|
||||
private PersonGrid personGrid; |
||||
|
||||
private CalendarComponent calendar; |
||||
|
||||
private HorizontalLayout contentLayout; |
||||
|
||||
@Override |
||||
protected void init(VaadinRequest request) { |
||||
|
||||
LOGGER.debug("Starting Vaadin UI with " + getClass().getName()); |
||||
|
||||
List<Person> persons = personDao.listAll(); |
||||
personGrid = new PersonGrid(groupDao); |
||||
personGrid.setItems(persons); |
||||
personGrid.setCaption("Personen"); |
||||
personGrid.onClosedFunction(() -> detailClosed()); |
||||
personGrid.onPersonSelect(ev -> personSelectionChange(ev)); |
||||
personGrid.onPersonEdit(p -> onPersonEdit(p)); |
||||
|
||||
this.calendar = new CalendarComponent(); |
||||
calendar.setHandler(this::onItemClick); |
||||
|
||||
contentLayout = new HorizontalLayout(); |
||||
contentLayout.setSizeFull(); |
||||
contentLayout.addComponents(calendar); |
||||
|
||||
setContent(contentLayout); |
||||
setSizeFull(); |
||||
|
||||
ExecutorService exec = Executors.newSingleThreadExecutor(); |
||||
exec.execute(() -> { |
||||
|
||||
final List<ClubEvent> events = eventBusiness.loadEvents(request); |
||||
LOGGER.info("Loaded events: {}", events); |
||||
final UI ui = calendar.getUI(); |
||||
ui.access(() -> { |
||||
calendar.setItems(events); |
||||
ui.push(); |
||||
}); |
||||
|
||||
}); |
||||
exec.shutdown(); |
||||
LOGGER.info("Loaded UI and started fetch of Events"); |
||||
} |
||||
|
||||
private void onPersonEdit(Person p) { |
||||
PersonEditDialog dlg = new PersonEditDialog(groupDao.listAll(), p, personDao); |
||||
getUI().addWindow(dlg); |
||||
} |
||||
|
||||
private void personSelectionChange(SelectionEvent<Person> ev) { |
||||
Set<Person> selected = ev.getAllSelectedItems(); |
||||
LOGGER.debug("Selection changed to: {}", selected); |
||||
eventBusiness.changePersons(selected); |
||||
} |
||||
|
||||
private void detailClosed() { |
||||
LOGGER.debug("Closing detail view."); |
||||
contentLayout.removeComponent(personGrid); |
||||
} |
||||
|
||||
private void onItemClick(CalendarComponentEvents.ItemClickEvent event) { |
||||
ClubEvent ev = (ClubEvent) event.getCalendarItem(); |
||||
LOGGER.debug("Opening detail view for {}", ev); |
||||
|
||||
contentLayout.removeComponent(personGrid); |
||||
contentLayout.addComponent(personGrid); |
||||
|
||||
personGrid.setCaption(ev.getCaption()); |
||||
personGrid.setTitle(ev.getCaption()); |
||||
personGrid.setEnabled(false); |
||||
personGrid.selectItems(ev.getPersons()); |
||||
personGrid.setVisible(true); |
||||
personGrid.setEnabled(true); |
||||
eventBusiness.setSelected(ev); |
||||
} |
||||
|
||||
} |
||||
|
||||
@ -1,219 +1,219 @@ |
||||
package de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.components; |
||||
|
||||
import java.text.DateFormat; |
||||
import java.util.ArrayList; |
||||
import java.util.Collection; |
||||
import java.util.HashSet; |
||||
import java.util.List; |
||||
import java.util.Set; |
||||
import java.util.function.Consumer; |
||||
import java.util.function.Predicate; |
||||
|
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
|
||||
import com.vaadin.data.HasValue.ValueChangeEvent; |
||||
import com.vaadin.data.provider.ConfigurableFilterDataProvider; |
||||
import com.vaadin.data.provider.ListDataProvider; |
||||
import com.vaadin.event.selection.SelectionListener; |
||||
import com.vaadin.event.selection.SingleSelectionEvent; |
||||
import com.vaadin.icons.VaadinIcons; |
||||
import com.vaadin.server.SerializablePredicate; |
||||
import com.vaadin.ui.Button; |
||||
import com.vaadin.ui.CheckBox; |
||||
import com.vaadin.ui.ComboBox; |
||||
import com.vaadin.ui.CustomComponent; |
||||
import com.vaadin.ui.Grid; |
||||
import com.vaadin.ui.Grid.SelectionMode; |
||||
import com.vaadin.ui.HorizontalLayout; |
||||
import com.vaadin.ui.MultiSelect; |
||||
import com.vaadin.ui.TextField; |
||||
import com.vaadin.ui.VerticalLayout; |
||||
import com.vaadin.ui.themes.ValoTheme; |
||||
|
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.dao.GroupDao; |
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.GroupDef; |
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Person; |
||||
|
||||
public class PersonGrid extends CustomComponent { |
||||
|
||||
private static final long serialVersionUID = -8148097982839343673L; |
||||
private final Logger log = LoggerFactory.getLogger(getClass()); |
||||
|
||||
private final DateFormat birthFormat = DateFormat |
||||
.getDateInstance(DateFormat.MEDIUM); |
||||
|
||||
private final Grid<Person> grid; |
||||
|
||||
private final CheckBox checkIncluded; |
||||
private final ComboBox<GroupDef> comboGroups; |
||||
|
||||
private final TextField textTitle; |
||||
|
||||
private ClosedFunction closedFunction = null; |
||||
private ConfigurableFilterDataProvider<Person, Void, SerializablePredicate<Person>> dataProvider; |
||||
private Boolean selectedOnlyFilter; |
||||
private Set<GroupDef> groupMemberFilter; |
||||
private List<GroupDef> allGroups; |
||||
private Consumer<Person> onPersonEdit; |
||||
|
||||
public PersonGrid(GroupDao groupDao) { |
||||
|
||||
textTitle = new TextField(); |
||||
textTitle.setStyleName("title_label"); |
||||
textTitle.setCaption("Veranstaltung"); |
||||
textTitle.setEnabled(false); |
||||
textTitle.setSizeFull(); |
||||
|
||||
checkIncluded = new CheckBox("Nur gemeldete"); |
||||
checkIncluded.addValueChangeListener(ev -> onSelectedOnly(ev)); |
||||
comboGroups = new ComboBox<>("Gruppenfilter"); |
||||
comboGroups.setEmptySelectionAllowed(true); |
||||
comboGroups.setEmptySelectionCaption("Alle"); |
||||
comboGroups.setItemCaptionGenerator(GroupDef::getName); |
||||
comboGroups.addSelectionListener(ev -> onGroupSelected(ev)); |
||||
allGroups = groupDao.listAll(); |
||||
comboGroups.setItems(allGroups); |
||||
log.info("Loaded Groups: {}", allGroups); |
||||
|
||||
HorizontalLayout filters = new HorizontalLayout(); |
||||
filters.addComponents(checkIncluded, comboGroups); |
||||
dataProvider = new ListDataProvider<Person>(new ArrayList<>()).withConfigurableFilter(); |
||||
grid = new Grid<>(); |
||||
grid.setDataProvider(dataProvider); |
||||
grid.addColumn(Person::getPrename).setCaption("Vorname"); |
||||
grid.addColumn(Person::getSurname).setCaption("Nachname"); |
||||
grid.addColumn(Person::getBirth, |
||||
b -> b != null ? birthFormat.format(b) : "") |
||||
.setCaption("Geburtstag"); |
||||
grid.addComponentColumn(this::buildDeleteButton); |
||||
grid.setSelectionMode(SelectionMode.MULTI); |
||||
|
||||
Button close = new Button("Schließen", ev -> { |
||||
PersonGrid.this.setVisible(false); |
||||
if (closedFunction != null) { |
||||
closedFunction.closed(); |
||||
} |
||||
}); |
||||
|
||||
VerticalLayout panel = new VerticalLayout(); |
||||
panel.addComponents(textTitle, filters, grid, close); |
||||
setCompositionRoot(panel); |
||||
} |
||||
|
||||
private Button buildDeleteButton(Person p) { |
||||
Button button = new Button(VaadinIcons.EDIT); |
||||
button.addStyleName(ValoTheme.BUTTON_SMALL); |
||||
button.addClickListener(e -> showPersonDetails(p)); |
||||
return button; |
||||
} |
||||
|
||||
private void showPersonDetails(Person p) { |
||||
if (onPersonEdit != null) { |
||||
onPersonEdit.accept(p); |
||||
} |
||||
} |
||||
|
||||
public void onClosedFunction(ClosedFunction closedFunction) { |
||||
this.closedFunction = closedFunction; |
||||
} |
||||
|
||||
private void onSelectedOnly(ValueChangeEvent<Boolean> ev) { |
||||
this.selectedOnlyFilter = ev.getValue(); |
||||
updateFilter(); |
||||
} |
||||
|
||||
private void updateFilter() { |
||||
Predicate<Person> filter = p -> true; |
||||
if (selectedOnlyFilter!= null && selectedOnlyFilter.equals(Boolean.TRUE)) { |
||||
Set<Person> selected = grid.getSelectedItems(); |
||||
filter = p -> selected.contains(p); |
||||
} |
||||
if (groupMemberFilter != null && groupMemberFilter.isEmpty() == false) { |
||||
final Set<Integer> groupIds = new HashSet<>(); |
||||
groupMemberFilter.forEach(gm -> { |
||||
groupIds.add(gm.getId()); |
||||
}); |
||||
|
||||
filter = filter.and(p -> { |
||||
{ |
||||
List<GroupDef> personGroups = p.getPersongroups(); |
||||
for (GroupDef pg : personGroups) { |
||||
if (groupIds.contains(pg.getId())) { |
||||
return true; |
||||
} |
||||
} |
||||
return false; |
||||
} |
||||
}); |
||||
} |
||||
|
||||
setFilter(filter); |
||||
} |
||||
|
||||
public void setFilter(Predicate<Person> filter) { |
||||
dataProvider.setFilter(p -> filter.test(p)); |
||||
grid.getDataProvider().refreshAll(); |
||||
} |
||||
|
||||
public void onPersonSelect(SelectionListener<Person> listener) throws UnsupportedOperationException { |
||||
grid.addSelectionListener(listener); |
||||
} |
||||
|
||||
public void selectItems(Person... items) { |
||||
MultiSelect<Person> asMultiSelect = grid.asMultiSelect(); |
||||
asMultiSelect.deselectAll(); |
||||
asMultiSelect.select(items); |
||||
} |
||||
|
||||
public void deselectItems(Person... items) { |
||||
grid.asMultiSelect().deselect(items); |
||||
} |
||||
|
||||
public void select(Person item) { |
||||
grid.select(item); |
||||
} |
||||
|
||||
public void deselect(Person item) { |
||||
grid.deselect(item); |
||||
} |
||||
|
||||
public void deselectAll() { |
||||
grid.deselectAll(); |
||||
} |
||||
|
||||
private void onGroupSelected(SingleSelectionEvent<GroupDef> ev) { |
||||
|
||||
groupMemberFilter = ev.getAllSelectedItems(); |
||||
updateFilter(); |
||||
} |
||||
|
||||
public void setTitle(String value) { |
||||
if (value == null) { |
||||
value = ""; |
||||
} |
||||
textTitle.setValue(value); |
||||
} |
||||
|
||||
public void setItems(Collection<Person> items) { |
||||
grid.setItems(items); |
||||
} |
||||
|
||||
public void setItems(Person... items) { |
||||
grid.setItems(items); |
||||
} |
||||
|
||||
public interface ClosedFunction { |
||||
void closed(); |
||||
} |
||||
|
||||
public void selectItems(Collection<Person> persons) { |
||||
log.debug("Selecting now: {}" + persons); |
||||
selectItems(persons.toArray(new Person[0])); |
||||
} |
||||
|
||||
public void onPersonEdit(Consumer<Person> function) { |
||||
this.onPersonEdit = function; |
||||
} |
||||
|
||||
} |
||||
package de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.components; |
||||
|
||||
import java.text.DateFormat; |
||||
import java.util.ArrayList; |
||||
import java.util.Collection; |
||||
import java.util.HashSet; |
||||
import java.util.List; |
||||
import java.util.Set; |
||||
import java.util.function.Consumer; |
||||
import java.util.function.Predicate; |
||||
|
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
|
||||
import com.vaadin.data.HasValue.ValueChangeEvent; |
||||
import com.vaadin.data.provider.ConfigurableFilterDataProvider; |
||||
import com.vaadin.data.provider.ListDataProvider; |
||||
import com.vaadin.event.selection.SelectionListener; |
||||
import com.vaadin.event.selection.SingleSelectionEvent; |
||||
import com.vaadin.icons.VaadinIcons; |
||||
import com.vaadin.server.SerializablePredicate; |
||||
import com.vaadin.ui.Button; |
||||
import com.vaadin.ui.CheckBox; |
||||
import com.vaadin.ui.ComboBox; |
||||
import com.vaadin.ui.CustomComponent; |
||||
import com.vaadin.ui.Grid; |
||||
import com.vaadin.ui.Grid.SelectionMode; |
||||
import com.vaadin.ui.HorizontalLayout; |
||||
import com.vaadin.ui.MultiSelect; |
||||
import com.vaadin.ui.TextField; |
||||
import com.vaadin.ui.VerticalLayout; |
||||
import com.vaadin.ui.themes.ValoTheme; |
||||
|
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.dao.GroupDao; |
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.GroupDef; |
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Person; |
||||
|
||||
public class PersonGrid extends CustomComponent { |
||||
|
||||
private static final long serialVersionUID = -8148097982839343673L; |
||||
private final Logger log = LoggerFactory.getLogger(getClass()); |
||||
|
||||
private final DateFormat birthFormat = DateFormat |
||||
.getDateInstance(DateFormat.MEDIUM); |
||||
|
||||
private final Grid<Person> grid; |
||||
|
||||
private final CheckBox checkIncluded; |
||||
private final ComboBox<GroupDef> comboGroups; |
||||
|
||||
private final TextField textTitle; |
||||
|
||||
private ClosedFunction closedFunction = null; |
||||
private ConfigurableFilterDataProvider<Person, Void, SerializablePredicate<Person>> dataProvider; |
||||
private Boolean selectedOnlyFilter; |
||||
private Set<GroupDef> groupMemberFilter; |
||||
private List<GroupDef> allGroups; |
||||
private Consumer<Person> onPersonEdit; |
||||
|
||||
public PersonGrid(GroupDao groupDao) { |
||||
|
||||
textTitle = new TextField(); |
||||
textTitle.setStyleName("title_label"); |
||||
textTitle.setCaption("Veranstaltung"); |
||||
textTitle.setEnabled(false); |
||||
textTitle.setSizeFull(); |
||||
|
||||
checkIncluded = new CheckBox("Nur gemeldete"); |
||||
checkIncluded.addValueChangeListener(ev -> onSelectedOnly(ev)); |
||||
comboGroups = new ComboBox<>("Gruppenfilter"); |
||||
comboGroups.setEmptySelectionAllowed(true); |
||||
comboGroups.setEmptySelectionCaption("Alle"); |
||||
comboGroups.setItemCaptionGenerator(GroupDef::getName); |
||||
comboGroups.addSelectionListener(ev -> onGroupSelected(ev)); |
||||
allGroups = groupDao.listAll(); |
||||
comboGroups.setItems(allGroups); |
||||
log.info("Loaded Groups: {}", allGroups); |
||||
|
||||
HorizontalLayout filters = new HorizontalLayout(); |
||||
filters.addComponents(checkIncluded, comboGroups); |
||||
dataProvider = new ListDataProvider<Person>(new ArrayList<>()).withConfigurableFilter(); |
||||
grid = new Grid<>(); |
||||
grid.setDataProvider(dataProvider); |
||||
grid.addColumn(Person::getPrename).setCaption("Vorname"); |
||||
grid.addColumn(Person::getSurname).setCaption("Nachname"); |
||||
grid.addColumn(Person::getBirth, |
||||
b -> b != null ? birthFormat.format(b) : "") |
||||
.setCaption("Geburtstag"); |
||||
grid.addComponentColumn(this::buildDeleteButton); |
||||
grid.setSelectionMode(SelectionMode.MULTI); |
||||
|
||||
Button close = new Button("Schließen", ev -> { |
||||
PersonGrid.this.setVisible(false); |
||||
if (closedFunction != null) { |
||||
closedFunction.closed(); |
||||
} |
||||
}); |
||||
|
||||
VerticalLayout panel = new VerticalLayout(); |
||||
panel.addComponents(textTitle, filters, grid, close); |
||||
setCompositionRoot(panel); |
||||
} |
||||
|
||||
private Button buildDeleteButton(Person p) { |
||||
Button button = new Button(VaadinIcons.EDIT); |
||||
button.addStyleName(ValoTheme.BUTTON_SMALL); |
||||
button.addClickListener(e -> showPersonDetails(p)); |
||||
return button; |
||||
} |
||||
|
||||
private void showPersonDetails(Person p) { |
||||
if (onPersonEdit != null) { |
||||
onPersonEdit.accept(p); |
||||
} |
||||
} |
||||
|
||||
public void onClosedFunction(ClosedFunction closedFunction) { |
||||
this.closedFunction = closedFunction; |
||||
} |
||||
|
||||
private void onSelectedOnly(ValueChangeEvent<Boolean> ev) { |
||||
this.selectedOnlyFilter = ev.getValue(); |
||||
updateFilter(); |
||||
} |
||||
|
||||
private void updateFilter() { |
||||
Predicate<Person> filter = p -> true; |
||||
if (selectedOnlyFilter!= null && selectedOnlyFilter.equals(Boolean.TRUE)) { |
||||
Set<Person> selected = grid.getSelectedItems(); |
||||
filter = p -> selected.contains(p); |
||||
} |
||||
if (groupMemberFilter != null && groupMemberFilter.isEmpty() == false) { |
||||
final Set<Integer> groupIds = new HashSet<>(); |
||||
groupMemberFilter.forEach(gm -> { |
||||
groupIds.add(gm.getId()); |
||||
}); |
||||
|
||||
filter = filter.and(p -> { |
||||
{ |
||||
List<GroupDef> personGroups = p.getPersongroups(); |
||||
for (GroupDef pg : personGroups) { |
||||
if (groupIds.contains(pg.getId())) { |
||||
return true; |
||||
} |
||||
} |
||||
return false; |
||||
} |
||||
}); |
||||
} |
||||
|
||||
setFilter(filter); |
||||
} |
||||
|
||||
public void setFilter(Predicate<Person> filter) { |
||||
dataProvider.setFilter(p -> filter.test(p)); |
||||
grid.getDataProvider().refreshAll(); |
||||
} |
||||
|
||||
public void onPersonSelect(SelectionListener<Person> listener) throws UnsupportedOperationException { |
||||
grid.addSelectionListener(listener); |
||||
} |
||||
|
||||
public void selectItems(Person... items) { |
||||
MultiSelect<Person> asMultiSelect = grid.asMultiSelect(); |
||||
asMultiSelect.deselectAll(); |
||||
asMultiSelect.select(items); |
||||
} |
||||
|
||||
public void deselectItems(Person... items) { |
||||
grid.asMultiSelect().deselect(items); |
||||
} |
||||
|
||||
public void select(Person item) { |
||||
grid.select(item); |
||||
} |
||||
|
||||
public void deselect(Person item) { |
||||
grid.deselect(item); |
||||
} |
||||
|
||||
public void deselectAll() { |
||||
grid.deselectAll(); |
||||
} |
||||
|
||||
private void onGroupSelected(SingleSelectionEvent<GroupDef> ev) { |
||||
|
||||
groupMemberFilter = ev.getAllSelectedItems(); |
||||
updateFilter(); |
||||
} |
||||
|
||||
public void setTitle(String value) { |
||||
if (value == null) { |
||||
value = ""; |
||||
} |
||||
textTitle.setValue(value); |
||||
} |
||||
|
||||
public void setItems(Collection<Person> items) { |
||||
grid.setItems(items); |
||||
} |
||||
|
||||
public void setItems(Person... items) { |
||||
grid.setItems(items); |
||||
} |
||||
|
||||
public interface ClosedFunction { |
||||
void closed(); |
||||
} |
||||
|
||||
public void selectItems(Collection<Person> persons) { |
||||
log.debug("Selecting now: {}" + persons); |
||||
selectItems(persons.toArray(new Person[0])); |
||||
} |
||||
|
||||
public void onPersonEdit(Consumer<Person> function) { |
||||
this.onPersonEdit = function; |
||||
} |
||||
|
||||
} |
||||
|
||||
@ -1,22 +1,22 @@ |
||||
<?xml version='1.0' encoding='UTF-8'?> |
||||
<!DOCTYPE hibernate-configuration PUBLIC |
||||
"-//Hibernate/Hibernate Configuration DTD 3.0//EN" |
||||
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> |
||||
|
||||
<hibernate-configuration> |
||||
<session-factory> |
||||
<!-- SQL Dialect --> |
||||
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> |
||||
|
||||
<!-- Database Connection Settings --> |
||||
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> |
||||
<property name="hibernate.connection.datasource">java:comp/env/jdbc/clubhelperbackend</property> |
||||
<property name="cache.providerclass">org.hibernate.NoCacheProvider</property> |
||||
<property name="show_sql">true</property> |
||||
|
||||
<!-- Specifying Session Context --> |
||||
<property name="hibernate.current_session_context_class">org.hibernate.context.internal.ThreadLocalSessionContext</property> |
||||
|
||||
<!-- <mapping resource="schema/ClubEvent.hbm.xml"></mapping> --> |
||||
</session-factory> |
||||
</hibernate-configuration> |
||||
<?xml version='1.0' encoding='UTF-8'?> |
||||
<!DOCTYPE hibernate-configuration PUBLIC |
||||
"-//Hibernate/Hibernate Configuration DTD 3.0//EN" |
||||
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> |
||||
|
||||
<hibernate-configuration> |
||||
<session-factory> |
||||
<!-- SQL Dialect --> |
||||
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> |
||||
|
||||
<!-- Database Connection Settings --> |
||||
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> |
||||
<property name="hibernate.connection.datasource">java:comp/env/jdbc/clubhelperbackend</property> |
||||
<property name="cache.providerclass">org.hibernate.NoCacheProvider</property> |
||||
<property name="show_sql">true</property> |
||||
|
||||
<!-- Specifying Session Context --> |
||||
<property name="hibernate.current_session_context_class">org.hibernate.context.internal.ThreadLocalSessionContext</property> |
||||
|
||||
<!-- <mapping resource="schema/ClubEvent.hbm.xml"></mapping> --> |
||||
</session-factory> |
||||
</hibernate-configuration> |
||||
|
||||
@ -1,36 +1,36 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" |
||||
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> |
||||
<hibernate-mapping> |
||||
<class |
||||
name="de.kreth.vaadin.clubhelper.vaadinclubhelper.data.ClubEvent" |
||||
table="ClubEvent"> |
||||
<id column="id" name="id" type="string" /> |
||||
<property column="caption" generated="never" lazy="false" |
||||
name="caption" type="string" /> |
||||
<property column="description" generated="never" lazy="false" |
||||
name="description" type="string" /> |
||||
<property column="iCalUID" generated="never" lazy="false" |
||||
name="iCalUID" type="string" /> |
||||
<property column="location" generated="never" lazy="false" |
||||
name="location" type="string" /> |
||||
<property column="start" generated="never" lazy="false" |
||||
name="start" /> |
||||
<property column="end" generated="never" lazy="false" |
||||
name="end" /> |
||||
<property generated="never" lazy="false" |
||||
name="allDay"> |
||||
<column sql-type="BOOLEAN" not-null="true" name="allDay" /> |
||||
</property> |
||||
<property column="organizerDisplayName" generated="never" |
||||
lazy="false" name="organizerDisplayName" type="string" /> |
||||
|
||||
<set name="persons" table="clubevent_has_person" cascade="save-update" lazy="false"> |
||||
<key column="clubevent_id"/> |
||||
<many-to-many column="person_id" class="de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Person" /> |
||||
</set> |
||||
</class> |
||||
<query name="ClubEvent.findAll"> |
||||
<![CDATA[from ClubEvent]]> |
||||
</query> |
||||
</hibernate-mapping> |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" |
||||
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> |
||||
<hibernate-mapping> |
||||
<class |
||||
name="de.kreth.vaadin.clubhelper.vaadinclubhelper.data.ClubEvent" |
||||
table="ClubEvent"> |
||||
<id column="id" name="id" type="string" /> |
||||
<property column="caption" generated="never" lazy="false" |
||||
name="caption" type="string" /> |
||||
<property column="description" generated="never" lazy="false" |
||||
name="description" type="string" /> |
||||
<property column="iCalUID" generated="never" lazy="false" |
||||
name="iCalUID" type="string" /> |
||||
<property column="location" generated="never" lazy="false" |
||||
name="location" type="string" /> |
||||
<property column="start" generated="never" lazy="false" |
||||
name="start" /> |
||||
<property column="end" generated="never" lazy="false" |
||||
name="end" /> |
||||
<property generated="never" lazy="false" |
||||
name="allDay"> |
||||
<column sql-type="BOOLEAN" not-null="true" name="allDay" /> |
||||
</property> |
||||
<property column="organizerDisplayName" generated="never" |
||||
lazy="false" name="organizerDisplayName" type="string" /> |
||||
|
||||
<set name="persons" table="clubevent_has_person" cascade="save-update" lazy="false"> |
||||
<key column="clubevent_id"/> |
||||
<many-to-many column="person_id" class="de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Person" /> |
||||
</set> |
||||
</class> |
||||
<query name="ClubEvent.findAll"> |
||||
<![CDATA[from ClubEvent]]> |
||||
</query> |
||||
</hibernate-mapping> |
||||
|
||||
@ -1,169 +1,169 @@ |
||||
package de.kreth.vaadin.clubhelper.vaadinclubhelper.dao; |
||||
|
||||
import static org.junit.Assert.assertEquals; |
||||
import static org.junit.Assert.assertFalse; |
||||
import static org.junit.Assert.assertNotNull; |
||||
import static org.junit.Assert.assertTrue; |
||||
|
||||
import java.sql.Connection; |
||||
import java.sql.ResultSet; |
||||
import java.sql.SQLException; |
||||
import java.sql.Statement; |
||||
import java.time.ZoneId; |
||||
import java.time.ZonedDateTime; |
||||
import java.util.ArrayList; |
||||
import java.util.Date; |
||||
import java.util.HashSet; |
||||
import java.util.List; |
||||
import java.util.Set; |
||||
import java.util.concurrent.atomic.AtomicBoolean; |
||||
|
||||
import org.hibernate.IdentifierLoadAccess; |
||||
import org.hibernate.Transaction; |
||||
import org.hibernate.jdbc.Work; |
||||
import org.hibernate.query.Query; |
||||
import org.junit.Test; |
||||
|
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.ClubEvent; |
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.ClubEventBuilder; |
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.ClubeventHasPerson; |
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Person; |
||||
|
||||
public class ClubEventDataTest extends AbstractDatabaseTest { |
||||
|
||||
public Person testInsertPerson() { |
||||
Person p = new Person(); |
||||
p.setPrename("prename"); |
||||
p.setSurname("surname"); |
||||
p.setBirth(new Date()); |
||||
Transaction tx = session.beginTransaction(); |
||||
session.save(p); |
||||
tx.commit(); |
||||
return p; |
||||
} |
||||
|
||||
@Test |
||||
public void testInsertEvent() { |
||||
ClubEvent ev = creteEvent(); |
||||
|
||||
Transaction tx = session.beginTransaction(); |
||||
session.save(ev); |
||||
tx.commit(); |
||||
} |
||||
|
||||
@Test |
||||
public void testSelectEvents() { |
||||
ClubEvent ev = creteEvent(); |
||||
|
||||
Transaction tx = session.beginTransaction(); |
||||
session.save(ev); |
||||
tx.commit(); |
||||
|
||||
Query<ClubEvent> query = session.createNamedQuery("ClubEvent.findAll", |
||||
ClubEvent.class); |
||||
List<ClubEvent> result = query.list(); |
||||
assertEquals(1, result.size()); |
||||
} |
||||
|
||||
@Test |
||||
public void testEventWithPerson() { |
||||
|
||||
ClubEvent ev = creteEvent(); |
||||
|
||||
Person person = testInsertPerson(); |
||||
Set<Person> persons = ev.getPersons(); |
||||
if (persons == null) { |
||||
persons = new HashSet<>(); |
||||
ev.setPersons(persons); |
||||
} |
||||
persons.add(person); |
||||
|
||||
Transaction tx = session.beginTransaction(); |
||||
session.save(ev); |
||||
tx.commit(); |
||||
|
||||
List<ClubeventHasPerson> loadEventPersons = loadEventPersons(); |
||||
assertFalse(loadEventPersons.isEmpty()); |
||||
ClubeventHasPerson link = loadEventPersons.get(0); |
||||
assertEquals(person.getId(), link.getPersonId()); |
||||
assertEquals(ev.getId(), link.getClubEventId()); |
||||
|
||||
} |
||||
|
||||
private List<ClubeventHasPerson> loadEventPersons() { |
||||
final AtomicBoolean finishedWork = new AtomicBoolean(false); |
||||
List<ClubeventHasPerson> link = new ArrayList<>(); |
||||
|
||||
session.doWork(new Work() { |
||||
|
||||
@Override |
||||
public void execute(Connection connection) throws SQLException { |
||||
Statement stm = connection.createStatement(); |
||||
ResultSet rs = stm.executeQuery("select * from clubevent_has_person"); |
||||
while (rs.next()) { |
||||
ClubeventHasPerson ep = new ClubeventHasPerson(); |
||||
|
||||
ep.setClubEventId(rs.getString("clubevent_id")); |
||||
ep.setPersonId(rs.getInt("person_id")); |
||||
link.add(ep); |
||||
} |
||||
|
||||
finishedWork.set(true); |
||||
} |
||||
}); |
||||
assertTrue(finishedWork.get()); |
||||
return link; |
||||
} |
||||
|
||||
@Test |
||||
public void changeEventsPersons() { |
||||
ClubEvent ev = creteEvent(); |
||||
|
||||
Transaction tx = session.beginTransaction(); |
||||
session.save(ev); |
||||
tx.commit(); |
||||
|
||||
Person person = testInsertPerson(); |
||||
|
||||
Person person2 = new Person(); |
||||
person2.setId(person.getId() + 1); |
||||
person2.setPrename(person.getPrename() + "_2"); |
||||
person2.setSurname(person.getSurname() + "_2"); |
||||
person2.setBirth(new Date()); |
||||
|
||||
tx = session.beginTransaction(); |
||||
session.save(person2); |
||||
tx.commit(); |
||||
|
||||
IdentifierLoadAccess<ClubEvent> idLoadAccess = session.byId(ClubEvent.class); |
||||
ClubEvent loaded = idLoadAccess.load(ev.getId()); |
||||
assertNotNull(loaded); |
||||
if (loaded.getPersons() == null) { |
||||
loaded.setPersons(new HashSet<>()); |
||||
} |
||||
|
||||
loaded.getPersons().add(person); |
||||
tx = session.beginTransaction(); |
||||
session.update(ev); |
||||
tx.commit(); |
||||
|
||||
loaded.getPersons().add(person2); |
||||
tx = session.beginTransaction(); |
||||
session.update(ev); |
||||
tx.commit(); |
||||
List<ClubeventHasPerson> entries = loadEventPersons(); |
||||
assertEquals(2, entries.size()); |
||||
} |
||||
|
||||
private ClubEvent creteEvent() { |
||||
ClubEvent ev = ClubEventBuilder.builder().withId("id").withAllDay(true) |
||||
.withCaption("caption").withDescription("description") |
||||
.withStart(ZonedDateTime.of(2018, 8, 13, 0, 0, 0, 0, |
||||
ZoneId.systemDefault())) |
||||
.withEnd(ZonedDateTime.of(2018, 8, 13, 0, 0, 0, 0, |
||||
ZoneId.systemDefault())) |
||||
.withiCalUID("iCalUID") |
||||
.withOrganizerDisplayName("organizerDisplayName").build(); |
||||
return ev; |
||||
} |
||||
} |
||||
package de.kreth.vaadin.clubhelper.vaadinclubhelper.dao; |
||||
|
||||
import static org.junit.Assert.assertEquals; |
||||
import static org.junit.Assert.assertFalse; |
||||
import static org.junit.Assert.assertNotNull; |
||||
import static org.junit.Assert.assertTrue; |
||||
|
||||
import java.sql.Connection; |
||||
import java.sql.ResultSet; |
||||
import java.sql.SQLException; |
||||
import java.sql.Statement; |
||||
import java.time.ZoneId; |
||||
import java.time.ZonedDateTime; |
||||
import java.util.ArrayList; |
||||
import java.util.Date; |
||||
import java.util.HashSet; |
||||
import java.util.List; |
||||
import java.util.Set; |
||||
import java.util.concurrent.atomic.AtomicBoolean; |
||||
|
||||
import org.hibernate.IdentifierLoadAccess; |
||||
import org.hibernate.Transaction; |
||||
import org.hibernate.jdbc.Work; |
||||
import org.hibernate.query.Query; |
||||
import org.junit.Test; |
||||
|
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.ClubEvent; |
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.ClubEventBuilder; |
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.ClubeventHasPerson; |
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Person; |
||||
|
||||
public class ClubEventDataTest extends AbstractDatabaseTest { |
||||
|
||||
public Person testInsertPerson() { |
||||
Person p = new Person(); |
||||
p.setPrename("prename"); |
||||
p.setSurname("surname"); |
||||
p.setBirth(new Date()); |
||||
Transaction tx = session.beginTransaction(); |
||||
session.save(p); |
||||
tx.commit(); |
||||
return p; |
||||
} |
||||
|
||||
@Test |
||||
public void testInsertEvent() { |
||||
ClubEvent ev = creteEvent(); |
||||
|
||||
Transaction tx = session.beginTransaction(); |
||||
session.save(ev); |
||||
tx.commit(); |
||||
} |
||||
|
||||
@Test |
||||
public void testSelectEvents() { |
||||
ClubEvent ev = creteEvent(); |
||||
|
||||
Transaction tx = session.beginTransaction(); |
||||
session.save(ev); |
||||
tx.commit(); |
||||
|
||||
Query<ClubEvent> query = session.createNamedQuery("ClubEvent.findAll", |
||||
ClubEvent.class); |
||||
List<ClubEvent> result = query.list(); |
||||
assertEquals(1, result.size()); |
||||
} |
||||
|
||||
@Test |
||||
public void testEventWithPerson() { |
||||
|
||||
ClubEvent ev = creteEvent(); |
||||
|
||||
Person person = testInsertPerson(); |
||||
Set<Person> persons = ev.getPersons(); |
||||
if (persons == null) { |
||||
persons = new HashSet<>(); |
||||
ev.setPersons(persons); |
||||
} |
||||
persons.add(person); |
||||
|
||||
Transaction tx = session.beginTransaction(); |
||||
session.save(ev); |
||||
tx.commit(); |
||||
|
||||
List<ClubeventHasPerson> loadEventPersons = loadEventPersons(); |
||||
assertFalse(loadEventPersons.isEmpty()); |
||||
ClubeventHasPerson link = loadEventPersons.get(0); |
||||
assertEquals(person.getId(), link.getPersonId()); |
||||
assertEquals(ev.getId(), link.getClubEventId()); |
||||
|
||||
} |
||||
|
||||
private List<ClubeventHasPerson> loadEventPersons() { |
||||
final AtomicBoolean finishedWork = new AtomicBoolean(false); |
||||
List<ClubeventHasPerson> link = new ArrayList<>(); |
||||
|
||||
session.doWork(new Work() { |
||||
|
||||
@Override |
||||
public void execute(Connection connection) throws SQLException { |
||||
Statement stm = connection.createStatement(); |
||||
ResultSet rs = stm.executeQuery("select * from clubevent_has_person"); |
||||
while (rs.next()) { |
||||
ClubeventHasPerson ep = new ClubeventHasPerson(); |
||||
|
||||
ep.setClubEventId(rs.getString("clubevent_id")); |
||||
ep.setPersonId(rs.getInt("person_id")); |
||||
link.add(ep); |
||||
} |
||||
|
||||
finishedWork.set(true); |
||||
} |
||||
}); |
||||
assertTrue(finishedWork.get()); |
||||
return link; |
||||
} |
||||
|
||||
@Test |
||||
public void changeEventsPersons() { |
||||
ClubEvent ev = creteEvent(); |
||||
|
||||
Transaction tx = session.beginTransaction(); |
||||
session.save(ev); |
||||
tx.commit(); |
||||
|
||||
Person person = testInsertPerson(); |
||||
|
||||
Person person2 = new Person(); |
||||
person2.setId(person.getId() + 1); |
||||
person2.setPrename(person.getPrename() + "_2"); |
||||
person2.setSurname(person.getSurname() + "_2"); |
||||
person2.setBirth(new Date()); |
||||
|
||||
tx = session.beginTransaction(); |
||||
session.save(person2); |
||||
tx.commit(); |
||||
|
||||
IdentifierLoadAccess<ClubEvent> idLoadAccess = session.byId(ClubEvent.class); |
||||
ClubEvent loaded = idLoadAccess.load(ev.getId()); |
||||
assertNotNull(loaded); |
||||
if (loaded.getPersons() == null) { |
||||
loaded.setPersons(new HashSet<>()); |
||||
} |
||||
|
||||
loaded.getPersons().add(person); |
||||
tx = session.beginTransaction(); |
||||
session.update(ev); |
||||
tx.commit(); |
||||
|
||||
loaded.getPersons().add(person2); |
||||
tx = session.beginTransaction(); |
||||
session.update(ev); |
||||
tx.commit(); |
||||
List<ClubeventHasPerson> entries = loadEventPersons(); |
||||
assertEquals(2, entries.size()); |
||||
} |
||||
|
||||
private ClubEvent creteEvent() { |
||||
ClubEvent ev = ClubEventBuilder.builder().withId("id").withAllDay(true) |
||||
.withCaption("caption").withDescription("description") |
||||
.withStart(ZonedDateTime.of(2018, 8, 13, 0, 0, 0, 0, |
||||
ZoneId.systemDefault())) |
||||
.withEnd(ZonedDateTime.of(2018, 8, 13, 0, 0, 0, 0, |
||||
ZoneId.systemDefault())) |
||||
.withiCalUID("iCalUID") |
||||
.withOrganizerDisplayName("organizerDisplayName").build(); |
||||
return ev; |
||||
} |
||||
} |
||||
|
||||
Loading…
Reference in new issue