Commit 27307af9 authored by Stefan Oppl's avatar Stefan Oppl
Browse files

new data model (lva instanzen)

parent c28c35d2
Pipeline #384 failed with stages
in 9 minutes and 46 seconds
......@@ -17,14 +17,6 @@
"otherEntityRelationshipName": "lVA",
"relationshipName": "modul",
"otherEntityField": "id"
},
{
"relationshipType": "many-to-many",
"otherEntityName": "pruefungsTermin",
"otherEntityRelationshipName": "lva",
"relationshipName": "termin",
"otherEntityField": "id",
"ownerSide": false
}
],
"changelogDate": "20190327073248",
......
{
"name": "LVAInstanz",
"fields": [],
"relationships": [
{
"relationshipType": "many-to-one",
"otherEntityName": "lVA",
"otherEntityRelationshipName": "lVAInstanz",
"relationshipName": "lva",
"otherEntityField": "id"
},
{
"relationshipType": "many-to-one",
"otherEntityName": "studienjahr",
"otherEntityRelationshipName": "lVAInstanz",
"relationshipName": "jahr",
"otherEntityField": "id"
},
{
"relationshipType": "many-to-many",
"otherEntityName": "pruefungsTermin",
"otherEntityRelationshipName": "lvainstanz",
"relationshipName": "termin",
"otherEntityField": "id",
"ownerSide": false
}
],
"changelogDate": "20190520065436",
"entityTableName": "lva_instanz",
"dto": "no",
"pagination": "no",
"service": "serviceImpl",
"jpaMetamodelFiltering": false,
"fluentMethods": true,
"clientRootFolder": "",
"applications": "*"
}
\ No newline at end of file
......@@ -7,6 +7,13 @@
"fieldValidateRules": [
"required"
]
},
{
"fieldName": "reminderActive",
"fieldType": "Boolean",
"fieldValidateRules": [
"required"
]
}
],
"relationships": [
......@@ -27,9 +34,9 @@
},
{
"relationshipType": "many-to-many",
"otherEntityName": "lVA",
"otherEntityName": "lVAInstanz",
"otherEntityRelationshipName": "termin",
"relationshipName": "lva",
"relationshipName": "lvainstanz",
"otherEntityField": "id",
"ownerSide": true
}
......
{
"name": "Studienjahr",
"fields": [
{
"fieldName": "jahr",
"fieldType": "String"
}
],
"relationships": [],
"changelogDate": "20190520065435",
"entityTableName": "studienjahr",
"dto": "no",
"pagination": "no",
"service": "serviceImpl",
"jpaMetamodelFiltering": false,
"fluentMethods": true,
"clientRootFolder": "",
"applications": "*"
}
\ No newline at end of file
......@@ -49,6 +49,10 @@ public class CacheConfiguration {
cm.createCache(at.jku.ce.zml.domain.Raum.class.getName(), jcacheConfiguration);
cm.createCache(at.jku.ce.zml.domain.Raum.class.getName() + ".termins", jcacheConfiguration);
cm.createCache(at.jku.ce.zml.domain.MailRecipient.class.getName(), jcacheConfiguration);
cm.createCache(at.jku.ce.zml.domain.PruefungsTermin.class.getName() + ".lvainstanzs", jcacheConfiguration);
cm.createCache(at.jku.ce.zml.domain.Studienjahr.class.getName(), jcacheConfiguration);
cm.createCache(at.jku.ce.zml.domain.LVAInstanz.class.getName(), jcacheConfiguration);
cm.createCache(at.jku.ce.zml.domain.LVAInstanz.class.getName() + ".termins", jcacheConfiguration);
// jhipster-needle-ehcache-add-entry
};
}
......
package at.jku.ce.zml.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
......@@ -9,8 +8,6 @@ import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import java.util.Objects;
/**
......@@ -37,11 +34,6 @@ public class LVA implements Serializable {
@JsonIgnoreProperties("lVAS")
private Modul modul;
@ManyToMany(mappedBy = "lvas")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@JsonIgnore
private Set<PruefungsTermin> termins = new HashSet<>();
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() {
return id;
......@@ -89,31 +81,6 @@ public class LVA implements Serializable {
public void setModul(Modul modul) {
this.modul = modul;
}
public Set<PruefungsTermin> getTermins() {
return termins;
}
public LVA termins(Set<PruefungsTermin> pruefungsTermins) {
this.termins = pruefungsTermins;
return this;
}
public LVA addTermin(PruefungsTermin pruefungsTermin) {
this.termins.add(pruefungsTermin);
pruefungsTermin.getLvas().add(this);
return this;
}
public LVA removeTermin(PruefungsTermin pruefungsTermin) {
this.termins.remove(pruefungsTermin);
pruefungsTermin.getLvas().remove(this);
return this;
}
public void setTermins(Set<PruefungsTermin> pruefungsTermins) {
this.termins = pruefungsTermins;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
@Override
......
package at.jku.ce.zml.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import java.util.Objects;
/**
* A LVAInstanz.
*/
@Entity
@Table(name = "lva_instanz")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class LVAInstanz implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@ManyToOne
@JsonIgnoreProperties("lVAInstanzs")
private LVA lva;
@ManyToOne
@JsonIgnoreProperties("lVAInstanzs")
private Studienjahr jahr;
@ManyToMany(mappedBy = "lvainstanzs")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@JsonIgnore
private Set<PruefungsTermin> termins = new HashSet<>();
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public LVA getLva() {
return lva;
}
public LVAInstanz lva(LVA lVA) {
this.lva = lVA;
return this;
}
public void setLva(LVA lVA) {
this.lva = lVA;
}
public Studienjahr getJahr() {
return jahr;
}
public LVAInstanz jahr(Studienjahr studienjahr) {
this.jahr = studienjahr;
return this;
}
public void setJahr(Studienjahr studienjahr) {
this.jahr = studienjahr;
}
public Set<PruefungsTermin> getTermins() {
return termins;
}
public LVAInstanz termins(Set<PruefungsTermin> pruefungsTermins) {
this.termins = pruefungsTermins;
return this;
}
public LVAInstanz addTermin(PruefungsTermin pruefungsTermin) {
this.termins.add(pruefungsTermin);
pruefungsTermin.getLvainstanzs().add(this);
return this;
}
public LVAInstanz removeTermin(PruefungsTermin pruefungsTermin) {
this.termins.remove(pruefungsTermin);
pruefungsTermin.getLvainstanzs().remove(this);
return this;
}
public void setTermins(Set<PruefungsTermin> pruefungsTermins) {
this.termins = pruefungsTermins;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
LVAInstanz lVAInstanz = (LVAInstanz) o;
if (lVAInstanz.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), lVAInstanz.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "LVAInstanz{" +
"id=" + getId() +
"}";
}
}
......@@ -32,6 +32,10 @@ public class PruefungsTermin implements Serializable {
@Column(name = "start_zeitpunkt", nullable = false)
private Instant startZeitpunkt;
@NotNull
@Column(name = "reminder_active", nullable = false)
private Boolean reminderActive;
@ManyToOne
@JsonIgnoreProperties("pruefungsTermins")
private Modul modul;
......@@ -45,10 +49,10 @@ public class PruefungsTermin implements Serializable {
@ManyToMany
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@JoinTable(name = "pruefungs_termin_lva",
@JoinTable(name = "pruefungs_termin_lvainstanz",
joinColumns = @JoinColumn(name = "pruefungs_termin_id", referencedColumnName = "id"),
inverseJoinColumns = @JoinColumn(name = "lva_id", referencedColumnName = "id"))
private Set<LVA> lvas = new HashSet<>();
inverseJoinColumns = @JoinColumn(name = "lvainstanz_id", referencedColumnName = "id"))
private Set<LVAInstanz> lvainstanzs = new HashSet<>();
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() {
......@@ -72,6 +76,19 @@ public class PruefungsTermin implements Serializable {
this.startZeitpunkt = startZeitpunkt;
}
public Boolean isReminderActive() {
return reminderActive;
}
public PruefungsTermin reminderActive(Boolean reminderActive) {
this.reminderActive = reminderActive;
return this;
}
public void setReminderActive(Boolean reminderActive) {
this.reminderActive = reminderActive;
}
public Modul getModul() {
return modul;
}
......@@ -110,29 +127,29 @@ public class PruefungsTermin implements Serializable {
this.raums = raums;
}
public Set<LVA> getLvas() {
return lvas;
public Set<LVAInstanz> getLvainstanzs() {
return lvainstanzs;
}
public PruefungsTermin lvas(Set<LVA> lVAS) {
this.lvas = lVAS;
public PruefungsTermin lvainstanzs(Set<LVAInstanz> lVAInstanzs) {
this.lvainstanzs = lVAInstanzs;
return this;
}
public PruefungsTermin addLva(LVA lVA) {
this.lvas.add(lVA);
lVA.getTermins().add(this);
public PruefungsTermin addLvainstanz(LVAInstanz lVAInstanz) {
this.lvainstanzs.add(lVAInstanz);
lVAInstanz.getTermins().add(this);
return this;
}
public PruefungsTermin removeLva(LVA lVA) {
this.lvas.remove(lVA);
lVA.getTermins().remove(this);
public PruefungsTermin removeLvainstanz(LVAInstanz lVAInstanz) {
this.lvainstanzs.remove(lVAInstanz);
lVAInstanz.getTermins().remove(this);
return this;
}
public void setLvas(Set<LVA> lVAS) {
this.lvas = lVAS;
public void setLvainstanzs(Set<LVAInstanz> lVAInstanzs) {
this.lvainstanzs = lVAInstanzs;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
......@@ -161,6 +178,7 @@ public class PruefungsTermin implements Serializable {
return "PruefungsTermin{" +
"id=" + getId() +
", startZeitpunkt='" + getStartZeitpunkt() + "'" +
", reminderActive='" + isReminderActive() + "'" +
"}";
}
}
package at.jku.ce.zml.domain;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;
/**
* A Studienjahr.
*/
@Entity
@Table(name = "studienjahr")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Studienjahr implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "jahr")
private String jahr;
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getJahr() {
return jahr;
}
public Studienjahr jahr(String jahr) {
this.jahr = jahr;
return this;
}
public void setJahr(String jahr) {
this.jahr = jahr;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Studienjahr studienjahr = (Studienjahr) o;
if (studienjahr.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), studienjahr.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "Studienjahr{" +
"id=" + getId() +
", jahr='" + getJahr() + "'" +
"}";
}
}
package at.jku.ce.zml.repository;
import at.jku.ce.zml.domain.LVAInstanz;
import org.springframework.data.jpa.repository.*;
import org.springframework.stereotype.Repository;
/**
* Spring Data repository for the LVAInstanz entity.
*/
@SuppressWarnings("unused")
@Repository
public interface LVAInstanzRepository extends JpaRepository<LVAInstanz, Long> {
}
......@@ -17,13 +17,14 @@ import java.util.Optional;
@Repository
public interface PruefungsTerminRepository extends JpaRepository<PruefungsTermin, Long> {
@Query(value = "select distinct pruefungs_termin from PruefungsTermin pruefungs_termin left join fetch pruefungs_termin.raums left join fetch pruefungs_termin.lvas",
@Query(value = "select distinct pruefungs_termin from PruefungsTermin pruefungs_termin left join fetch pruefungs_termin.raums left join fetch pruefungs_termin.lvainstanzs",
countQuery = "select count(distinct pruefungs_termin) from PruefungsTermin pruefungs_termin")
Page<PruefungsTermin> findAllWithEagerRelationships(Pageable pageable);
@Query(value = "select distinct pruefungs_termin from PruefungsTermin pruefungs_termin left join fetch pruefungs_termin.raums left join fetch pruefungs_termin.lvas")
@Query(value = "select distinct pruefungs_termin from PruefungsTermin pruefungs_termin left join fetch pruefungs_termin.raums left join fetch pruefungs_termin.lvainstanzs")
List<PruefungsTermin> findAllWithEagerRelationships();
@Query("select pruefungs_termin from PruefungsTermin pruefungs_termin left join fetch pruefungs_termin.raums left join fetch pruefungs_termin.lvas where pruefungs_termin.id =:id")
@Query("select pruefungs_termin from PruefungsTermin pruefungs_termin left join fetch pruefungs_termin.raums left join fetch pruefungs_termin.lvainstanzs where pruefungs_termin.id =:id")
Optional<PruefungsTermin> findOneWithEagerRelationships(@Param("id") Long id);
}
package at.jku.ce.zml.repository;
import at.jku.ce.zml.domain.Studienjahr;
import org.springframework.data.jpa.repository.*;
import org.springframework.stereotype.Repository;
/**
* Spring Data repository for the Studienjahr entity.
*/
@SuppressWarnings("unused")
@Repository
public interface StudienjahrRepository extends JpaRepository<Studienjahr, Long> {
}
package at.jku.ce.zml.service;
import at.jku.ce.zml.domain.LVAInstanz;
import java.util.List;
import java.util.Optional;
/**
* Service Interface for managing LVAInstanz.
*/
public interface LVAInstanzService {
/**
* Save a lVAInstanz.
*
* @param lVAInstanz the entity to save
* @return the persisted entity
*/
LVAInstanz save(LVAInstanz lVAInstanz);
/**
* Get all the lVAInstanzs.
*
* @return the list of entities
*/
List<LVAInstanz> findAll();
/**
* Get the "id" lVAInstanz.
*
* @param id the id of the entity
* @return the entity
*/
Optional<LVAInstanz> findOne(Long id);
/**
* Delete the "id" lVAInstanz.
*
* @param id the id of the entity
*/
void delete(Long id);
}
......@@ -54,8 +54,8 @@ public class NotificationService {
* <p>
* This is scheduled to get fired every night, at 04:00 (am).
*/
// @Scheduled(cron = "0 0 4 * * ?")
@Scheduled(cron = "0 * * * * ?") // for testing purposes, this line triggers the method every minute, during operation use the line above
@Scheduled(cron = "0 0 4 * * ?")
// @Scheduled(cron = "0 * * * * ?") // for testing purposes, this line triggers the method every minute, during operation use the line above
public void sendNotification() {
Page<PruefungsTermin> results = pruefungsTerminService.findAll(Pageable.unpaged());
List<PruefungsTermin> resultList=results.getContent();
......@@ -231,7 +231,7 @@ public class NotificationService {
log.debug("referenceDate: " + referenceDate);
for (PruefungsTermin pruefungsTermin: allDates) {
log.debug("Pruefungstermin: "+pruefungsTermin.getStartZeitpunkt()+" truncated: "+pruefungsTermin.getStartZeitpunkt().truncatedTo(ChronoUnit.DAYS));
if (pruefungsTermin.getStartZeitpunkt().truncatedTo(ChronoUnit.DAYS).equals(referenceDate)) filteredDates.add(pruefungsTermin);
if (pruefungsTermin.isReminderActive() && pruefungsTermin.getStartZeitpunkt().truncatedTo(ChronoUnit.DAYS).equals(referenceDate)) filteredDates.add(pruefungsTermin);
}
return filteredDates;
}
......
......@@ -5,7 +5,6 @@ import at.jku.ce.zml.domain.PruefungsTermin;