import of initial customer.jdl including related entities
This commit is contained in:
parent
acd28d679c
commit
1e7b801e22
53
.jhipster/Asset.json
Normal file
53
.jhipster/Asset.json
Normal file
@ -0,0 +1,53 @@
|
||||
{
|
||||
"name": "Asset",
|
||||
"fields": [
|
||||
{
|
||||
"fieldName": "date",
|
||||
"fieldType": "LocalDate",
|
||||
"fieldValidateRules": [
|
||||
"required"
|
||||
]
|
||||
},
|
||||
{
|
||||
"fieldName": "action",
|
||||
"fieldType": "AssetAction",
|
||||
"fieldValues": "PAYMENT,HANDOVER,ADOPTION,LOSS,CLEARING,PAYBACK",
|
||||
"fieldValidateRules": [
|
||||
"required"
|
||||
]
|
||||
},
|
||||
{
|
||||
"fieldName": "amount",
|
||||
"fieldType": "BigDecimal",
|
||||
"fieldValidateRules": [
|
||||
"required"
|
||||
]
|
||||
},
|
||||
{
|
||||
"fieldName": "comment",
|
||||
"fieldType": "String",
|
||||
"fieldValidateRules": [
|
||||
"maxlength"
|
||||
],
|
||||
"fieldValidateRulesMaxlength": 160
|
||||
}
|
||||
],
|
||||
"relationships": [
|
||||
{
|
||||
"relationshipType": "many-to-one",
|
||||
"otherEntityName": "membership",
|
||||
"otherEntityRelationshipName": "asset",
|
||||
"relationshipName": "member",
|
||||
"otherEntityField": "id"
|
||||
}
|
||||
],
|
||||
"changelogDate": "20190403083740",
|
||||
"entityTableName": "asset",
|
||||
"dto": "mapstruct",
|
||||
"pagination": "infinite-scroll",
|
||||
"service": "serviceClass",
|
||||
"jpaMetamodelFiltering": true,
|
||||
"fluentMethods": true,
|
||||
"clientRootFolder": "",
|
||||
"applications": "*"
|
||||
}
|
49
.jhipster/Contact.json
Normal file
49
.jhipster/Contact.json
Normal file
@ -0,0 +1,49 @@
|
||||
{
|
||||
"name": "Contact",
|
||||
"fields": [
|
||||
{
|
||||
"fieldName": "firstName",
|
||||
"fieldType": "String",
|
||||
"fieldValidateRules": [
|
||||
"required",
|
||||
"maxlength"
|
||||
],
|
||||
"fieldValidateRulesMaxlength": 80
|
||||
},
|
||||
{
|
||||
"fieldName": "lastName",
|
||||
"fieldType": "String",
|
||||
"fieldValidateRules": [
|
||||
"required",
|
||||
"maxlength"
|
||||
],
|
||||
"fieldValidateRulesMaxlength": 80
|
||||
},
|
||||
{
|
||||
"fieldName": "email",
|
||||
"fieldType": "String",
|
||||
"fieldValidateRules": [
|
||||
"required",
|
||||
"maxlength"
|
||||
],
|
||||
"fieldValidateRulesMaxlength": 80
|
||||
}
|
||||
],
|
||||
"relationships": [
|
||||
{
|
||||
"relationshipType": "one-to-many",
|
||||
"otherEntityName": "customerContact",
|
||||
"otherEntityRelationshipName": "contact",
|
||||
"relationshipName": "role"
|
||||
}
|
||||
],
|
||||
"changelogDate": "20190403083736",
|
||||
"entityTableName": "contact",
|
||||
"dto": "mapstruct",
|
||||
"pagination": "infinite-scroll",
|
||||
"service": "serviceClass",
|
||||
"jpaMetamodelFiltering": true,
|
||||
"fluentMethods": true,
|
||||
"clientRootFolder": "",
|
||||
"applications": "*"
|
||||
}
|
50
.jhipster/Customer.json
Normal file
50
.jhipster/Customer.json
Normal file
@ -0,0 +1,50 @@
|
||||
{
|
||||
"name": "Customer",
|
||||
"fields": [
|
||||
{
|
||||
"fieldName": "number",
|
||||
"fieldType": "Integer",
|
||||
"fieldValidateRules": [
|
||||
"required",
|
||||
"unique",
|
||||
"min",
|
||||
"max"
|
||||
],
|
||||
"fieldValidateRulesMin": 10000,
|
||||
"fieldValidateRulesMax": 99999
|
||||
},
|
||||
{
|
||||
"fieldName": "prefix",
|
||||
"fieldType": "String",
|
||||
"fieldValidateRules": [
|
||||
"required",
|
||||
"unique",
|
||||
"pattern"
|
||||
],
|
||||
"fieldValidateRulesPattern": "[a-z][a-z0-9]+"
|
||||
}
|
||||
],
|
||||
"relationships": [
|
||||
{
|
||||
"relationshipType": "one-to-many",
|
||||
"otherEntityName": "membership",
|
||||
"otherEntityRelationshipName": "customer",
|
||||
"relationshipName": "membership"
|
||||
},
|
||||
{
|
||||
"relationshipType": "one-to-many",
|
||||
"otherEntityName": "customerContact",
|
||||
"otherEntityRelationshipName": "customer",
|
||||
"relationshipName": "role"
|
||||
}
|
||||
],
|
||||
"changelogDate": "20190403083735",
|
||||
"entityTableName": "customer",
|
||||
"dto": "mapstruct",
|
||||
"pagination": "infinite-scroll",
|
||||
"service": "serviceClass",
|
||||
"jpaMetamodelFiltering": true,
|
||||
"fluentMethods": true,
|
||||
"clientRootFolder": "",
|
||||
"applications": "*"
|
||||
}
|
40
.jhipster/CustomerContact.json
Normal file
40
.jhipster/CustomerContact.json
Normal file
@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "CustomerContact",
|
||||
"fields": [
|
||||
{
|
||||
"fieldName": "role",
|
||||
"fieldType": "CustomerContactRole",
|
||||
"fieldValues": "CONTRACTUAL,TECHNICAL,FINANCIAL",
|
||||
"fieldValidateRules": [
|
||||
"required"
|
||||
]
|
||||
}
|
||||
],
|
||||
"relationships": [
|
||||
{
|
||||
"relationshipType": "many-to-one",
|
||||
"otherEntityName": "contact",
|
||||
"otherEntityRelationshipName": "role",
|
||||
"relationshipValidateRules": "required",
|
||||
"relationshipName": "contact",
|
||||
"otherEntityField": "email"
|
||||
},
|
||||
{
|
||||
"relationshipType": "many-to-one",
|
||||
"otherEntityName": "customer",
|
||||
"otherEntityRelationshipName": "role",
|
||||
"relationshipValidateRules": "required",
|
||||
"relationshipName": "customer",
|
||||
"otherEntityField": "prefix"
|
||||
}
|
||||
],
|
||||
"changelogDate": "20190403083737",
|
||||
"entityTableName": "customer_contact",
|
||||
"dto": "mapstruct",
|
||||
"pagination": "infinite-scroll",
|
||||
"service": "serviceClass",
|
||||
"jpaMetamodelFiltering": true,
|
||||
"fluentMethods": true,
|
||||
"clientRootFolder": "",
|
||||
"applications": "*"
|
||||
}
|
46
.jhipster/Membership.json
Normal file
46
.jhipster/Membership.json
Normal file
@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "Membership",
|
||||
"fields": [
|
||||
{
|
||||
"fieldName": "sinceDate",
|
||||
"fieldType": "LocalDate",
|
||||
"fieldValidateRules": [
|
||||
"required"
|
||||
]
|
||||
},
|
||||
{
|
||||
"fieldName": "untilDate",
|
||||
"fieldType": "LocalDate"
|
||||
}
|
||||
],
|
||||
"relationships": [
|
||||
{
|
||||
"relationshipType": "one-to-many",
|
||||
"otherEntityName": "share",
|
||||
"otherEntityRelationshipName": "member",
|
||||
"relationshipName": "share"
|
||||
},
|
||||
{
|
||||
"relationshipType": "one-to-many",
|
||||
"otherEntityName": "asset",
|
||||
"otherEntityRelationshipName": "member",
|
||||
"relationshipName": "asset"
|
||||
},
|
||||
{
|
||||
"relationshipType": "many-to-one",
|
||||
"otherEntityName": "customer",
|
||||
"otherEntityRelationshipName": "membership",
|
||||
"relationshipName": "customer",
|
||||
"otherEntityField": "prefix"
|
||||
}
|
||||
],
|
||||
"changelogDate": "20190403083738",
|
||||
"entityTableName": "membership",
|
||||
"dto": "mapstruct",
|
||||
"pagination": "infinite-scroll",
|
||||
"service": "serviceClass",
|
||||
"jpaMetamodelFiltering": true,
|
||||
"fluentMethods": true,
|
||||
"clientRootFolder": "",
|
||||
"applications": "*"
|
||||
}
|
53
.jhipster/Share.json
Normal file
53
.jhipster/Share.json
Normal file
@ -0,0 +1,53 @@
|
||||
{
|
||||
"name": "Share",
|
||||
"fields": [
|
||||
{
|
||||
"fieldName": "date",
|
||||
"fieldType": "LocalDate",
|
||||
"fieldValidateRules": [
|
||||
"required"
|
||||
]
|
||||
},
|
||||
{
|
||||
"fieldName": "action",
|
||||
"fieldType": "ShareAction",
|
||||
"fieldValues": "SUBSCRIPTION,CANCELLATION",
|
||||
"fieldValidateRules": [
|
||||
"required"
|
||||
]
|
||||
},
|
||||
{
|
||||
"fieldName": "quantity",
|
||||
"fieldType": "Integer",
|
||||
"fieldValidateRules": [
|
||||
"required"
|
||||
]
|
||||
},
|
||||
{
|
||||
"fieldName": "comment",
|
||||
"fieldType": "String",
|
||||
"fieldValidateRules": [
|
||||
"maxlength"
|
||||
],
|
||||
"fieldValidateRulesMaxlength": 160
|
||||
}
|
||||
],
|
||||
"relationships": [
|
||||
{
|
||||
"relationshipType": "many-to-one",
|
||||
"otherEntityName": "membership",
|
||||
"otherEntityRelationshipName": "share",
|
||||
"relationshipName": "member",
|
||||
"otherEntityField": "id"
|
||||
}
|
||||
],
|
||||
"changelogDate": "20190403083739",
|
||||
"entityTableName": "share",
|
||||
"dto": "mapstruct",
|
||||
"pagination": "infinite-scroll",
|
||||
"service": "serviceClass",
|
||||
"jpaMetamodelFiltering": true,
|
||||
"fluentMethods": true,
|
||||
"clientRootFolder": "",
|
||||
"applications": "*"
|
||||
}
|
156
src/main/java/org/hostsharing/hsadminng/domain/Asset.java
Normal file
156
src/main/java/org/hostsharing/hsadminng/domain/Asset.java
Normal file
@ -0,0 +1,156 @@
|
||||
package org.hostsharing.hsadminng.domain;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.hostsharing.hsadminng.domain.enumeration.AssetAction;
|
||||
|
||||
/**
|
||||
* A Asset.
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "asset")
|
||||
public class Asset implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
|
||||
@SequenceGenerator(name = "sequenceGenerator")
|
||||
private Long id;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "jhi_date", nullable = false)
|
||||
private LocalDate date;
|
||||
|
||||
@NotNull
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "action", nullable = false)
|
||||
private AssetAction action;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "amount", precision = 10, scale = 2, nullable = false)
|
||||
private BigDecimal amount;
|
||||
|
||||
@Size(max = 160)
|
||||
@Column(name = "jhi_comment", length = 160)
|
||||
private String comment;
|
||||
|
||||
@ManyToOne
|
||||
@JsonIgnoreProperties("assets")
|
||||
private Membership member;
|
||||
|
||||
// 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 LocalDate getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public Asset date(LocalDate date) {
|
||||
this.date = date;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setDate(LocalDate date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public AssetAction getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public Asset action(AssetAction action) {
|
||||
this.action = action;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setAction(AssetAction action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public BigDecimal getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public Asset amount(BigDecimal amount) {
|
||||
this.amount = amount;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setAmount(BigDecimal amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
public Asset comment(String comment) {
|
||||
this.comment = comment;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
public Membership getMember() {
|
||||
return member;
|
||||
}
|
||||
|
||||
public Asset member(Membership membership) {
|
||||
this.member = membership;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setMember(Membership membership) {
|
||||
this.member = membership;
|
||||
}
|
||||
// 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;
|
||||
}
|
||||
Asset asset = (Asset) o;
|
||||
if (asset.getId() == null || getId() == null) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(getId(), asset.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Asset{" +
|
||||
"id=" + getId() +
|
||||
", date='" + getDate() + "'" +
|
||||
", action='" + getAction() + "'" +
|
||||
", amount=" + getAmount() +
|
||||
", comment='" + getComment() + "'" +
|
||||
"}";
|
||||
}
|
||||
}
|
148
src/main/java/org/hostsharing/hsadminng/domain/Contact.java
Normal file
148
src/main/java/org/hostsharing/hsadminng/domain/Contact.java
Normal file
@ -0,0 +1,148 @@
|
||||
package org.hostsharing.hsadminng.domain;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* A Contact.
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "contact")
|
||||
public class Contact implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
|
||||
@SequenceGenerator(name = "sequenceGenerator")
|
||||
private Long id;
|
||||
|
||||
@NotNull
|
||||
@Size(max = 80)
|
||||
@Column(name = "first_name", length = 80, nullable = false)
|
||||
private String firstName;
|
||||
|
||||
@NotNull
|
||||
@Size(max = 80)
|
||||
@Column(name = "last_name", length = 80, nullable = false)
|
||||
private String lastName;
|
||||
|
||||
@NotNull
|
||||
@Size(max = 80)
|
||||
@Column(name = "email", length = 80, nullable = false)
|
||||
private String email;
|
||||
|
||||
@OneToMany(mappedBy = "contact")
|
||||
private Set<CustomerContact> roles = 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 String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
|
||||
public Contact firstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setFirstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
|
||||
public Contact lastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setLastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public Contact email(String email) {
|
||||
this.email = email;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public Set<CustomerContact> getRoles() {
|
||||
return roles;
|
||||
}
|
||||
|
||||
public Contact roles(Set<CustomerContact> customerContacts) {
|
||||
this.roles = customerContacts;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Contact addRole(CustomerContact customerContact) {
|
||||
this.roles.add(customerContact);
|
||||
customerContact.setContact(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Contact removeRole(CustomerContact customerContact) {
|
||||
this.roles.remove(customerContact);
|
||||
customerContact.setContact(null);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setRoles(Set<CustomerContact> customerContacts) {
|
||||
this.roles = customerContacts;
|
||||
}
|
||||
// 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;
|
||||
}
|
||||
Contact contact = (Contact) o;
|
||||
if (contact.getId() == null || getId() == null) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(getId(), contact.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Contact{" +
|
||||
"id=" + getId() +
|
||||
", firstName='" + getFirstName() + "'" +
|
||||
", lastName='" + getLastName() + "'" +
|
||||
", email='" + getEmail() + "'" +
|
||||
"}";
|
||||
}
|
||||
}
|
157
src/main/java/org/hostsharing/hsadminng/domain/Customer.java
Normal file
157
src/main/java/org/hostsharing/hsadminng/domain/Customer.java
Normal file
@ -0,0 +1,157 @@
|
||||
package org.hostsharing.hsadminng.domain;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* A Customer.
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "customer")
|
||||
public class Customer implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
|
||||
@SequenceGenerator(name = "sequenceGenerator")
|
||||
private Long id;
|
||||
|
||||
@NotNull
|
||||
@Min(value = 10000)
|
||||
@Max(value = 99999)
|
||||
@Column(name = "jhi_number", nullable = false, unique = true)
|
||||
private Integer number;
|
||||
|
||||
@NotNull
|
||||
@Pattern(regexp = "[a-z][a-z0-9]+")
|
||||
@Column(name = "prefix", nullable = false, unique = true)
|
||||
private String prefix;
|
||||
|
||||
@OneToMany(mappedBy = "customer")
|
||||
private Set<Membership> memberships = new HashSet<>();
|
||||
@OneToMany(mappedBy = "customer")
|
||||
private Set<CustomerContact> roles = 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 Integer getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public Customer number(Integer number) {
|
||||
this.number = number;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setNumber(Integer number) {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public String getPrefix() {
|
||||
return prefix;
|
||||
}
|
||||
|
||||
public Customer prefix(String prefix) {
|
||||
this.prefix = prefix;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setPrefix(String prefix) {
|
||||
this.prefix = prefix;
|
||||
}
|
||||
|
||||
public Set<Membership> getMemberships() {
|
||||
return memberships;
|
||||
}
|
||||
|
||||
public Customer memberships(Set<Membership> memberships) {
|
||||
this.memberships = memberships;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Customer addMembership(Membership membership) {
|
||||
this.memberships.add(membership);
|
||||
membership.setCustomer(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Customer removeMembership(Membership membership) {
|
||||
this.memberships.remove(membership);
|
||||
membership.setCustomer(null);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setMemberships(Set<Membership> memberships) {
|
||||
this.memberships = memberships;
|
||||
}
|
||||
|
||||
public Set<CustomerContact> getRoles() {
|
||||
return roles;
|
||||
}
|
||||
|
||||
public Customer roles(Set<CustomerContact> customerContacts) {
|
||||
this.roles = customerContacts;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Customer addRole(CustomerContact customerContact) {
|
||||
this.roles.add(customerContact);
|
||||
customerContact.setCustomer(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Customer removeRole(CustomerContact customerContact) {
|
||||
this.roles.remove(customerContact);
|
||||
customerContact.setCustomer(null);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setRoles(Set<CustomerContact> customerContacts) {
|
||||
this.roles = customerContacts;
|
||||
}
|
||||
// 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;
|
||||
}
|
||||
Customer customer = (Customer) o;
|
||||
if (customer.getId() == null || getId() == null) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(getId(), customer.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Customer{" +
|
||||
"id=" + getId() +
|
||||
", number=" + getNumber() +
|
||||
", prefix='" + getPrefix() + "'" +
|
||||
"}";
|
||||
}
|
||||
}
|
@ -0,0 +1,119 @@
|
||||
package org.hostsharing.hsadminng.domain;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.hostsharing.hsadminng.domain.enumeration.CustomerContactRole;
|
||||
|
||||
/**
|
||||
* A CustomerContact.
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "customer_contact")
|
||||
public class CustomerContact implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
|
||||
@SequenceGenerator(name = "sequenceGenerator")
|
||||
private Long id;
|
||||
|
||||
@NotNull
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "jhi_role", nullable = false)
|
||||
private CustomerContactRole role;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
@NotNull
|
||||
@JsonIgnoreProperties("roles")
|
||||
private Contact contact;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
@NotNull
|
||||
@JsonIgnoreProperties("roles")
|
||||
private Customer customer;
|
||||
|
||||
// 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 CustomerContactRole getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public CustomerContact role(CustomerContactRole role) {
|
||||
this.role = role;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setRole(CustomerContactRole role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public Contact getContact() {
|
||||
return contact;
|
||||
}
|
||||
|
||||
public CustomerContact contact(Contact contact) {
|
||||
this.contact = contact;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setContact(Contact contact) {
|
||||
this.contact = contact;
|
||||
}
|
||||
|
||||
public Customer getCustomer() {
|
||||
return customer;
|
||||
}
|
||||
|
||||
public CustomerContact customer(Customer customer) {
|
||||
this.customer = customer;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setCustomer(Customer customer) {
|
||||
this.customer = customer;
|
||||
}
|
||||
// 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;
|
||||
}
|
||||
CustomerContact customerContact = (CustomerContact) o;
|
||||
if (customerContact.getId() == null || getId() == null) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(getId(), customerContact.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CustomerContact{" +
|
||||
"id=" + getId() +
|
||||
", role='" + getRole() + "'" +
|
||||
"}";
|
||||
}
|
||||
}
|
172
src/main/java/org/hostsharing/hsadminng/domain/Membership.java
Normal file
172
src/main/java/org/hostsharing/hsadminng/domain/Membership.java
Normal file
@ -0,0 +1,172 @@
|
||||
package org.hostsharing.hsadminng.domain;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* A Membership.
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "membership")
|
||||
public class Membership implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
|
||||
@SequenceGenerator(name = "sequenceGenerator")
|
||||
private Long id;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "since_date", nullable = false)
|
||||
private LocalDate sinceDate;
|
||||
|
||||
@Column(name = "until_date")
|
||||
private LocalDate untilDate;
|
||||
|
||||
@OneToMany(mappedBy = "member")
|
||||
private Set<Share> shares = new HashSet<>();
|
||||
@OneToMany(mappedBy = "member")
|
||||
private Set<Asset> assets = new HashSet<>();
|
||||
@ManyToOne
|
||||
@JsonIgnoreProperties("memberships")
|
||||
private Customer customer;
|
||||
|
||||
// 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 LocalDate getSinceDate() {
|
||||
return sinceDate;
|
||||
}
|
||||
|
||||
public Membership sinceDate(LocalDate sinceDate) {
|
||||
this.sinceDate = sinceDate;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setSinceDate(LocalDate sinceDate) {
|
||||
this.sinceDate = sinceDate;
|
||||
}
|
||||
|
||||
public LocalDate getUntilDate() {
|
||||
return untilDate;
|
||||
}
|
||||
|
||||
public Membership untilDate(LocalDate untilDate) {
|
||||
this.untilDate = untilDate;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setUntilDate(LocalDate untilDate) {
|
||||
this.untilDate = untilDate;
|
||||
}
|
||||
|
||||
public Set<Share> getShares() {
|
||||
return shares;
|
||||
}
|
||||
|
||||
public Membership shares(Set<Share> shares) {
|
||||
this.shares = shares;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Membership addShare(Share share) {
|
||||
this.shares.add(share);
|
||||
share.setMember(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Membership removeShare(Share share) {
|
||||
this.shares.remove(share);
|
||||
share.setMember(null);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setShares(Set<Share> shares) {
|
||||
this.shares = shares;
|
||||
}
|
||||
|
||||
public Set<Asset> getAssets() {
|
||||
return assets;
|
||||
}
|
||||
|
||||
public Membership assets(Set<Asset> assets) {
|
||||
this.assets = assets;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Membership addAsset(Asset asset) {
|
||||
this.assets.add(asset);
|
||||
asset.setMember(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Membership removeAsset(Asset asset) {
|
||||
this.assets.remove(asset);
|
||||
asset.setMember(null);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setAssets(Set<Asset> assets) {
|
||||
this.assets = assets;
|
||||
}
|
||||
|
||||
public Customer getCustomer() {
|
||||
return customer;
|
||||
}
|
||||
|
||||
public Membership customer(Customer customer) {
|
||||
this.customer = customer;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setCustomer(Customer customer) {
|
||||
this.customer = customer;
|
||||
}
|
||||
// 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;
|
||||
}
|
||||
Membership membership = (Membership) o;
|
||||
if (membership.getId() == null || getId() == null) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(getId(), membership.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Membership{" +
|
||||
"id=" + getId() +
|
||||
", sinceDate='" + getSinceDate() + "'" +
|
||||
", untilDate='" + getUntilDate() + "'" +
|
||||
"}";
|
||||
}
|
||||
}
|
155
src/main/java/org/hostsharing/hsadminng/domain/Share.java
Normal file
155
src/main/java/org/hostsharing/hsadminng/domain/Share.java
Normal file
@ -0,0 +1,155 @@
|
||||
package org.hostsharing.hsadminng.domain;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.hostsharing.hsadminng.domain.enumeration.ShareAction;
|
||||
|
||||
/**
|
||||
* A Share.
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "share")
|
||||
public class Share implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
|
||||
@SequenceGenerator(name = "sequenceGenerator")
|
||||
private Long id;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "jhi_date", nullable = false)
|
||||
private LocalDate date;
|
||||
|
||||
@NotNull
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "action", nullable = false)
|
||||
private ShareAction action;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "quantity", nullable = false)
|
||||
private Integer quantity;
|
||||
|
||||
@Size(max = 160)
|
||||
@Column(name = "jhi_comment", length = 160)
|
||||
private String comment;
|
||||
|
||||
@ManyToOne
|
||||
@JsonIgnoreProperties("shares")
|
||||
private Membership member;
|
||||
|
||||
// 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 LocalDate getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public Share date(LocalDate date) {
|
||||
this.date = date;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setDate(LocalDate date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public ShareAction getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public Share action(ShareAction action) {
|
||||
this.action = action;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setAction(ShareAction action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public Integer getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public Share quantity(Integer quantity) {
|
||||
this.quantity = quantity;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setQuantity(Integer quantity) {
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
public Share comment(String comment) {
|
||||
this.comment = comment;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
public Membership getMember() {
|
||||
return member;
|
||||
}
|
||||
|
||||
public Share member(Membership membership) {
|
||||
this.member = membership;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setMember(Membership membership) {
|
||||
this.member = membership;
|
||||
}
|
||||
// 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;
|
||||
}
|
||||
Share share = (Share) o;
|
||||
if (share.getId() == null || getId() == null) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(getId(), share.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Share{" +
|
||||
"id=" + getId() +
|
||||
", date='" + getDate() + "'" +
|
||||
", action='" + getAction() + "'" +
|
||||
", quantity=" + getQuantity() +
|
||||
", comment='" + getComment() + "'" +
|
||||
"}";
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package org.hostsharing.hsadminng.domain.enumeration;
|
||||
|
||||
/**
|
||||
* The AssetAction enumeration.
|
||||
*/
|
||||
public enum AssetAction {
|
||||
PAYMENT, HANDOVER, ADOPTION, LOSS, CLEARING, PAYBACK
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package org.hostsharing.hsadminng.domain.enumeration;
|
||||
|
||||
/**
|
||||
* The CustomerContactRole enumeration.
|
||||
*/
|
||||
public enum CustomerContactRole {
|
||||
CONTRACTUAL, TECHNICAL, FINANCIAL
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package org.hostsharing.hsadminng.domain.enumeration;
|
||||
|
||||
/**
|
||||
* The ShareAction enumeration.
|
||||
*/
|
||||
public enum ShareAction {
|
||||
SUBSCRIPTION, CANCELLATION
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.hostsharing.hsadminng.repository;
|
||||
|
||||
import org.hostsharing.hsadminng.domain.Asset;
|
||||
import org.springframework.data.jpa.repository.*;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
|
||||
/**
|
||||
* Spring Data repository for the Asset entity.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
@Repository
|
||||
public interface AssetRepository extends JpaRepository<Asset, Long>, JpaSpecificationExecutor<Asset> {
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.hostsharing.hsadminng.repository;
|
||||
|
||||
import org.hostsharing.hsadminng.domain.Contact;
|
||||
import org.springframework.data.jpa.repository.*;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
|
||||
/**
|
||||
* Spring Data repository for the Contact entity.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
@Repository
|
||||
public interface ContactRepository extends JpaRepository<Contact, Long>, JpaSpecificationExecutor<Contact> {
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.hostsharing.hsadminng.repository;
|
||||
|
||||
import org.hostsharing.hsadminng.domain.CustomerContact;
|
||||
import org.springframework.data.jpa.repository.*;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
|
||||
/**
|
||||
* Spring Data repository for the CustomerContact entity.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
@Repository
|
||||
public interface CustomerContactRepository extends JpaRepository<CustomerContact, Long>, JpaSpecificationExecutor<CustomerContact> {
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.hostsharing.hsadminng.repository;
|
||||
|
||||
import org.hostsharing.hsadminng.domain.Customer;
|
||||
import org.springframework.data.jpa.repository.*;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
|
||||
/**
|
||||
* Spring Data repository for the Customer entity.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
@Repository
|
||||
public interface CustomerRepository extends JpaRepository<Customer, Long>, JpaSpecificationExecutor<Customer> {
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.hostsharing.hsadminng.repository;
|
||||
|
||||
import org.hostsharing.hsadminng.domain.Membership;
|
||||
import org.springframework.data.jpa.repository.*;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
|
||||
/**
|
||||
* Spring Data repository for the Membership entity.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
@Repository
|
||||
public interface MembershipRepository extends JpaRepository<Membership, Long>, JpaSpecificationExecutor<Membership> {
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.hostsharing.hsadminng.repository;
|
||||
|
||||
import org.hostsharing.hsadminng.domain.Share;
|
||||
import org.springframework.data.jpa.repository.*;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
|
||||
/**
|
||||
* Spring Data repository for the Share entity.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
@Repository
|
||||
public interface ShareRepository extends JpaRepository<Share, Long>, JpaSpecificationExecutor<Share> {
|
||||
|
||||
}
|
@ -0,0 +1,111 @@
|
||||
package org.hostsharing.hsadminng.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.criteria.JoinType;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import io.github.jhipster.service.QueryService;
|
||||
|
||||
import org.hostsharing.hsadminng.domain.Asset;
|
||||
import org.hostsharing.hsadminng.domain.*; // for static metamodels
|
||||
import org.hostsharing.hsadminng.repository.AssetRepository;
|
||||
import org.hostsharing.hsadminng.service.dto.AssetCriteria;
|
||||
import org.hostsharing.hsadminng.service.dto.AssetDTO;
|
||||
import org.hostsharing.hsadminng.service.mapper.AssetMapper;
|
||||
|
||||
/**
|
||||
* Service for executing complex queries for Asset entities in the database.
|
||||
* The main input is a {@link AssetCriteria} which gets converted to {@link Specification},
|
||||
* in a way that all the filters must apply.
|
||||
* It returns a {@link List} of {@link AssetDTO} or a {@link Page} of {@link AssetDTO} which fulfills the criteria.
|
||||
*/
|
||||
@Service
|
||||
@Transactional(readOnly = true)
|
||||
public class AssetQueryService extends QueryService<Asset> {
|
||||
|
||||
private final Logger log = LoggerFactory.getLogger(AssetQueryService.class);
|
||||
|
||||
private final AssetRepository assetRepository;
|
||||
|
||||
private final AssetMapper assetMapper;
|
||||
|
||||
public AssetQueryService(AssetRepository assetRepository, AssetMapper assetMapper) {
|
||||
this.assetRepository = assetRepository;
|
||||
this.assetMapper = assetMapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a {@link List} of {@link AssetDTO} which matches the criteria from the database |