Commit 53a48ded authored by Aurelien Surier Garofalo's avatar Aurelien Surier Garofalo
Browse files

Added roles

parent 03281134
......@@ -13,6 +13,19 @@
"otherEntityName": "taux",
"relationshipType": "one-to-many",
"otherEntityRelationshipName": "agence"
},
{
"relationshipName": "chef_manager",
"otherEntityName": "rOLE_CHEF_MANAGER_AGENCE",
"relationshipType": "many-to-one",
"otherEntityField": "id"
},
{
"relationshipName": "manager",
"otherEntityName": "rOLE_MANAGER_AGENCE",
"relationshipType": "one-to-one",
"ownerSide": false,
"otherEntityRelationshipName": "managed_agence"
}
],
"fields": [
......
{
"fluentMethods": true,
"clientRootFolder": "",
"relationships": [
{
"relationshipName": "managed_agencies",
"otherEntityName": "agence",
"relationshipType": "one-to-many",
"otherEntityRelationshipName": "chef_manager"
},
{
"relationshipName": "user",
"otherEntityName": "user",
"relationshipType": "one-to-one",
"otherEntityField": "login",
"ownerSide": true,
"otherEntityRelationshipName": "rOLE_CHEF_MANAGER_AGENCE"
}
],
"fields": [],
"changelogDate": "20181120085506",
"dto": "no",
"searchEngine": "elasticsearch",
"service": "no",
"entityTableName": "role_chef_manager_agence",
"jpaMetamodelFiltering": false,
"pagination": "no"
}
{
"fluentMethods": true,
"clientRootFolder": "",
"relationships": [
{
"relationshipName": "reservation",
"otherEntityName": "reservation",
"relationshipType": "one-to-many",
"otherEntityRelationshipName": "client"
},
{
"relationshipName": "user",
"otherEntityName": "user",
"relationshipType": "one-to-one",
"otherEntityField": "login",
"ownerSide": true,
"otherEntityRelationshipName": "rOLE_CLIENT"
}
],
"fields": [],
"changelogDate": "20181120104116",
"dto": "no",
"searchEngine": "elasticsearch",
"service": "no",
"entityTableName": "role_client",
"jpaMetamodelFiltering": false,
"pagination": "no"
}
{
"fluentMethods": true,
"clientRootFolder": "",
"relationships": [
{
"relationshipName": "managed_agence",
"otherEntityName": "agence",
"relationshipType": "one-to-one",
"otherEntityField": "id",
"ownerSide": true,
"otherEntityRelationshipName": "manager"
},
{
"relationshipName": "user",
"otherEntityName": "user",
"relationshipType": "one-to-one",
"otherEntityField": "login",
"ownerSide": true,
"otherEntityRelationshipName": "rOLE_MANAGER_AGENCE"
}
],
"fields": [],
"changelogDate": "20181120101525",
"dto": "no",
"searchEngine": "elasticsearch",
"service": "no",
"entityTableName": "role_manager_agence",
"jpaMetamodelFiltering": false,
"pagination": "no"
}
......@@ -10,6 +10,15 @@
"required"
],
"otherEntityField": "id"
},
{
"relationshipName": "client",
"otherEntityName": "rOLE_CLIENT",
"relationshipType": "many-to-one",
"relationshipValidateRules": [
"required"
],
"otherEntityField": "id"
}
],
"fields": [
......
......@@ -37,4 +37,4 @@
"en"
]
}
}
}
\ No newline at end of file
package com.mycompany.myapp.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
......@@ -12,7 +13,6 @@ import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import java.util.Objects;
import java.util.Optional;
/**
* A Agence.
......@@ -45,6 +45,14 @@ public class Agence implements Serializable {
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
private Set<Taux> tauxes = new HashSet<>();
@ManyToOne
@JsonIgnoreProperties("")
private ROLE_CHEF_MANAGER_AGENCE chef_manager;
@OneToOne(mappedBy = "managed_agence")
@JsonIgnore
private ROLE_MANAGER_AGENCE manager;
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() {
return id;
......@@ -108,11 +116,6 @@ public class Agence implements Serializable {
public Set<Taux> getTauxes() {
return tauxes;
}
public Optional<Set<Taux>> getTauxesOptional()
{
return Optional.ofNullable(tauxes);
}
public Agence tauxes(Set<Taux> tauxes) {
this.tauxes = tauxes;
......@@ -134,6 +137,32 @@ public class Agence implements Serializable {
public void setTauxes(Set<Taux> tauxes) {
this.tauxes = tauxes;
}
public ROLE_CHEF_MANAGER_AGENCE getChef_manager() {
return chef_manager;
}
public Agence chef_manager(ROLE_CHEF_MANAGER_AGENCE rOLE_CHEF_MANAGER_AGENCE) {
this.chef_manager = rOLE_CHEF_MANAGER_AGENCE;
return this;
}
public void setChef_manager(ROLE_CHEF_MANAGER_AGENCE rOLE_CHEF_MANAGER_AGENCE) {
this.chef_manager = rOLE_CHEF_MANAGER_AGENCE;
}
public ROLE_MANAGER_AGENCE getManager() {
return manager;
}
public Agence manager(ROLE_MANAGER_AGENCE rOLE_MANAGER_AGENCE) {
this.manager = rOLE_MANAGER_AGENCE;
return this;
}
public void setManager(ROLE_MANAGER_AGENCE rOLE_MANAGER_AGENCE) {
this.manager = rOLE_MANAGER_AGENCE;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
@Override
......
package com.mycompany.myapp.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import org.springframework.data.elasticsearch.annotations.Document;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import java.util.Objects;
/**
* A ROLE_CHEF_MANAGER_AGENCE.
*/
@Entity
@Table(name = "role_chef_manager_agence")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Document(indexName = "role_chef_manager_agence")
public class ROLE_CHEF_MANAGER_AGENCE implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@OneToMany(mappedBy = "chef_manager")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
private Set<Agence> managed_agencies = new HashSet<>();
@OneToOne
@JoinColumn(unique = true)
private User user;
// 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 Set<Agence> getManaged_agencies() {
return managed_agencies;
}
public ROLE_CHEF_MANAGER_AGENCE managed_agencies(Set<Agence> agences) {
this.managed_agencies = agences;
return this;
}
public ROLE_CHEF_MANAGER_AGENCE addManaged_agencies(Agence agence) {
this.managed_agencies.add(agence);
agence.setChef_manager(this);
return this;
}
public ROLE_CHEF_MANAGER_AGENCE removeManaged_agencies(Agence agence) {
this.managed_agencies.remove(agence);
agence.setChef_manager(null);
return this;
}
public void setManaged_agencies(Set<Agence> agences) {
this.managed_agencies = agences;
}
public User getUser() {
return user;
}
public ROLE_CHEF_MANAGER_AGENCE user(User user) {
this.user = user;
return this;
}
public void setUser(User user) {
this.user = user;
}
// 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;
}
ROLE_CHEF_MANAGER_AGENCE rOLE_CHEF_MANAGER_AGENCE = (ROLE_CHEF_MANAGER_AGENCE) o;
if (rOLE_CHEF_MANAGER_AGENCE.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), rOLE_CHEF_MANAGER_AGENCE.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "ROLE_CHEF_MANAGER_AGENCE{" +
"id=" + getId() +
"}";
}
}
package com.mycompany.myapp.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import org.springframework.data.elasticsearch.annotations.Document;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import java.util.Objects;
/**
* A ROLE_CLIENT.
*/
@Entity
@Table(name = "role_client")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Document(indexName = "role_client")
public class ROLE_CLIENT implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@OneToMany(mappedBy = "client")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
private Set<Reservation> reservations = new HashSet<>();
@OneToOne
@JoinColumn(unique = true)
private User user;
// 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 Set<Reservation> getReservations() {
return reservations;
}
public ROLE_CLIENT reservations(Set<Reservation> reservations) {
this.reservations = reservations;
return this;
}
public ROLE_CLIENT addReservation(Reservation reservation) {
this.reservations.add(reservation);
reservation.setClient(this);
return this;
}
public ROLE_CLIENT removeReservation(Reservation reservation) {
this.reservations.remove(reservation);
reservation.setClient(null);
return this;
}
public void setReservations(Set<Reservation> reservations) {
this.reservations = reservations;
}
public User getUser() {
return user;
}
public ROLE_CLIENT user(User user) {
this.user = user;
return this;
}
public void setUser(User user) {
this.user = user;
}
// 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;
}
ROLE_CLIENT rOLE_CLIENT = (ROLE_CLIENT) o;
if (rOLE_CLIENT.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), rOLE_CLIENT.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "ROLE_CLIENT{" +
"id=" + getId() +
"}";
}
}
package com.mycompany.myapp.domain;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import org.springframework.data.elasticsearch.annotations.Document;
import java.io.Serializable;
import java.util.Objects;
/**
* A ROLE_MANAGER_AGENCE.
*/
@Entity
@Table(name = "role_manager_agence")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Document(indexName = "role_manager_agence")
public class ROLE_MANAGER_AGENCE implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@OneToOne
@JoinColumn(unique = true)
private Agence managed_agence;
@OneToOne
@JoinColumn(unique = true)
private User user;
// 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 Agence getManaged_agence() {
return managed_agence;
}
public ROLE_MANAGER_AGENCE managed_agence(Agence agence) {
this.managed_agence = agence;
return this;
}
public void setManaged_agence(Agence agence) {
this.managed_agence = agence;
}
public User getUser() {
return user;
}
public ROLE_MANAGER_AGENCE user(User user) {
this.user = user;
return this;
}
public void setUser(User user) {
this.user = user;
}
// 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;
}
ROLE_MANAGER_AGENCE rOLE_MANAGER_AGENCE = (ROLE_MANAGER_AGENCE) o;
if (rOLE_MANAGER_AGENCE.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), rOLE_MANAGER_AGENCE.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "ROLE_MANAGER_AGENCE{" +
"id=" + getId() +
"}";
}
}
......@@ -50,6 +50,11 @@ public class Reservation implements Serializable {
@JsonIgnoreProperties("reservations")
private Vehicule vehicule;
@ManyToOne(optional = false)
@NotNull
@JsonIgnoreProperties("reservations")
private ROLE_CLIENT client;
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() {
return id;
......@@ -123,6 +128,19 @@ public class Reservation implements Serializable {
public void setVehicule(Vehicule vehicule) {
this.vehicule = vehicule;
}
public ROLE_CLIENT getClient() {
return client;
}
public Reservation client(ROLE_CLIENT rOLE_CLIENT) {
this.client = rOLE_CLIENT;
return this;
}
public void setClient(ROLE_CLIENT rOLE_CLIENT) {
this.client = rOLE_CLIENT;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
@Override
......