1
0

re-importing latest customer.jdl from master branch

This commit is contained in:
Michael Hoennig
2019-04-12 16:46:43 +02:00
parent 1e7b801e22
commit bd5bb859d9
36 changed files with 927 additions and 175 deletions

View File

@ -2,17 +2,16 @@ package org.hostsharing.hsadminng.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.hostsharing.hsadminng.domain.enumeration.AssetAction;
import javax.persistence.*;
import javax.validation.constraints.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
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.
*/
@ -44,7 +43,8 @@ public class Asset implements Serializable {
@Column(name = "jhi_comment", length = 160)
private String comment;
@ManyToOne
@ManyToOne(optional = false)
@NotNull
@JsonIgnoreProperties("assets")
private Membership member;

View File

@ -1,15 +1,12 @@
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;
import java.util.Set;
/**
* A Customer.
@ -36,10 +33,32 @@ public class Customer implements Serializable {
@Column(name = "prefix", nullable = false, unique = true)
private String prefix;
@OneToMany(mappedBy = "customer")
private Set<Membership> memberships = new HashSet<>();
@NotNull
@Size(max = 80)
@Column(name = "name", length = 80, nullable = false)
private String name;
@NotNull
@Size(max = 400)
@Column(name = "contractual_address", length = 400, nullable = false)
private String contractualAddress;
@Size(max = 80)
@Column(name = "contractual_salutation", length = 80)
private String contractualSalutation;
@Size(max = 400)
@Column(name = "billing_address", length = 400)
private String billingAddress;
@Size(max = 80)
@Column(name = "billing_salutation", length = 80)
private String billingSalutation;
@OneToMany(mappedBy = "customer")
private Set<CustomerContact> roles = new HashSet<>();
@OneToMany(mappedBy = "customer")
private Set<Membership> memberships = new HashSet<>();
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() {
return id;
@ -75,29 +94,69 @@ public class Customer implements Serializable {
this.prefix = prefix;
}
public Set<Membership> getMemberships() {
return memberships;
public String getName() {
return name;
}
public Customer memberships(Set<Membership> memberships) {
this.memberships = memberships;
public Customer name(String name) {
this.name = name;
return this;
}
public Customer addMembership(Membership membership) {
this.memberships.add(membership);
membership.setCustomer(this);
public void setName(String name) {
this.name = name;
}
public String getContractualAddress() {
return contractualAddress;
}
public Customer contractualAddress(String contractualAddress) {
this.contractualAddress = contractualAddress;
return this;
}
public Customer removeMembership(Membership membership) {
this.memberships.remove(membership);
membership.setCustomer(null);
public void setContractualAddress(String contractualAddress) {
this.contractualAddress = contractualAddress;
}
public String getContractualSalutation() {
return contractualSalutation;
}
public Customer contractualSalutation(String contractualSalutation) {
this.contractualSalutation = contractualSalutation;
return this;
}
public void setMemberships(Set<Membership> memberships) {
this.memberships = memberships;
public void setContractualSalutation(String contractualSalutation) {
this.contractualSalutation = contractualSalutation;
}
public String getBillingAddress() {
return billingAddress;
}
public Customer billingAddress(String billingAddress) {
this.billingAddress = billingAddress;
return this;
}
public void setBillingAddress(String billingAddress) {
this.billingAddress = billingAddress;
}
public String getBillingSalutation() {
return billingSalutation;
}
public Customer billingSalutation(String billingSalutation) {
this.billingSalutation = billingSalutation;
return this;
}
public void setBillingSalutation(String billingSalutation) {
this.billingSalutation = billingSalutation;
}
public Set<CustomerContact> getRoles() {
@ -124,6 +183,31 @@ public class Customer implements Serializable {
public void setRoles(Set<CustomerContact> customerContacts) {
this.roles = customerContacts;
}
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;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
@Override
@ -152,6 +236,11 @@ public class Customer implements Serializable {
"id=" + getId() +
", number=" + getNumber() +
", prefix='" + getPrefix() + "'" +
", name='" + getName() + "'" +
", contractualAddress='" + getContractualAddress() + "'" +
", contractualSalutation='" + getContractualSalutation() + "'" +
", billingAddress='" + getBillingAddress() + "'" +
", billingSalutation='" + getBillingSalutation() + "'" +
"}";
}
}

View File

@ -1,17 +1,15 @@
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 javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.HashSet;
import java.util.Set;
import java.util.Objects;
import java.util.Set;
/**
* A Membership.
@ -38,7 +36,8 @@ public class Membership implements Serializable {
private Set<Share> shares = new HashSet<>();
@OneToMany(mappedBy = "member")
private Set<Asset> assets = new HashSet<>();
@ManyToOne
@ManyToOne(optional = false)
@NotNull
@JsonIgnoreProperties("memberships")
private Customer customer;

View File

@ -2,16 +2,15 @@ package org.hostsharing.hsadminng.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.hostsharing.hsadminng.domain.enumeration.ShareAction;
import javax.persistence.*;
import javax.validation.constraints.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.Objects;
import org.hostsharing.hsadminng.domain.enumeration.ShareAction;
/**
* A Share.
*/
@ -43,7 +42,8 @@ public class Share implements Serializable {
@Column(name = "jhi_comment", length = 160)
private String comment;
@ManyToOne
@ManyToOne(optional = false)
@NotNull
@JsonIgnoreProperties("shares")
private Membership member;

View File

@ -1,9 +1,14 @@
package org.hostsharing.hsadminng.service;
import java.util.List;
import javax.persistence.criteria.JoinType;
import io.github.jhipster.service.QueryService;
import org.hostsharing.hsadminng.domain.Customer;
import org.hostsharing.hsadminng.domain.CustomerContact_;
import org.hostsharing.hsadminng.domain.Customer_;
import org.hostsharing.hsadminng.domain.Membership_;
import org.hostsharing.hsadminng.repository.CustomerRepository;
import org.hostsharing.hsadminng.service.dto.CustomerCriteria;
import org.hostsharing.hsadminng.service.dto.CustomerDTO;
import org.hostsharing.hsadminng.service.mapper.CustomerMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
@ -12,14 +17,8 @@ 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.Customer;
import org.hostsharing.hsadminng.domain.*; // for static metamodels
import org.hostsharing.hsadminng.repository.CustomerRepository;
import org.hostsharing.hsadminng.service.dto.CustomerCriteria;
import org.hostsharing.hsadminng.service.dto.CustomerDTO;
import org.hostsharing.hsadminng.service.mapper.CustomerMapper;
import javax.persistence.criteria.JoinType;
import java.util.List;
/**
* Service for executing complex queries for Customer entities in the database.
@ -95,14 +94,29 @@ public class CustomerQueryService extends QueryService<Customer> {
if (criteria.getPrefix() != null) {
specification = specification.and(buildStringSpecification(criteria.getPrefix(), Customer_.prefix));
}
if (criteria.getMembershipId() != null) {
specification = specification.and(buildSpecification(criteria.getMembershipId(),
root -> root.join(Customer_.memberships, JoinType.LEFT).get(Membership_.id)));
if (criteria.getName() != null) {
specification = specification.and(buildStringSpecification(criteria.getName(), Customer_.name));
}
if (criteria.getContractualAddress() != null) {
specification = specification.and(buildStringSpecification(criteria.getContractualAddress(), Customer_.contractualAddress));
}
if (criteria.getContractualSalutation() != null) {
specification = specification.and(buildStringSpecification(criteria.getContractualSalutation(), Customer_.contractualSalutation));
}
if (criteria.getBillingAddress() != null) {
specification = specification.and(buildStringSpecification(criteria.getBillingAddress(), Customer_.billingAddress));
}
if (criteria.getBillingSalutation() != null) {
specification = specification.and(buildStringSpecification(criteria.getBillingSalutation(), Customer_.billingSalutation));
}
if (criteria.getRoleId() != null) {
specification = specification.and(buildSpecification(criteria.getRoleId(),
root -> root.join(Customer_.roles, JoinType.LEFT).get(CustomerContact_.id)));
}
if (criteria.getMembershipId() != null) {
specification = specification.and(buildSpecification(criteria.getMembershipId(),
root -> root.join(Customer_.memberships, JoinType.LEFT).get(Membership_.id)));
}
}
return specification;
}

View File

@ -1,15 +1,13 @@
package org.hostsharing.hsadminng.service.dto;
import java.io.Serializable;
import java.util.Objects;
import io.github.jhipster.service.filter.BooleanFilter;
import io.github.jhipster.service.filter.DoubleFilter;
import io.github.jhipster.service.filter.Filter;
import io.github.jhipster.service.filter.FloatFilter;
import io.github.jhipster.service.filter.IntegerFilter;
import io.github.jhipster.service.filter.LongFilter;
import io.github.jhipster.service.filter.StringFilter;
import java.io.Serializable;
import java.util.Objects;
/**
* Criteria class for the Customer entity. This class is used in CustomerResource to
* receive all the possible filtering options from the Http GET request parameters.
@ -28,10 +26,20 @@ public class CustomerCriteria implements Serializable {
private StringFilter prefix;
private LongFilter membershipId;
private StringFilter name;
private StringFilter contractualAddress;
private StringFilter contractualSalutation;
private StringFilter billingAddress;
private StringFilter billingSalutation;
private LongFilter roleId;
private LongFilter membershipId;
public LongFilter getId() {
return id;
}
@ -56,12 +64,44 @@ public class CustomerCriteria implements Serializable {
this.prefix = prefix;
}
public LongFilter getMembershipId() {
return membershipId;
public StringFilter getName() {
return name;
}
public void setMembershipId(LongFilter membershipId) {
this.membershipId = membershipId;
public void setName(StringFilter name) {
this.name = name;
}
public StringFilter getContractualAddress() {
return contractualAddress;
}
public void setContractualAddress(StringFilter contractualAddress) {
this.contractualAddress = contractualAddress;
}
public StringFilter getContractualSalutation() {
return contractualSalutation;
}
public void setContractualSalutation(StringFilter contractualSalutation) {
this.contractualSalutation = contractualSalutation;
}
public StringFilter getBillingAddress() {
return billingAddress;
}
public void setBillingAddress(StringFilter billingAddress) {
this.billingAddress = billingAddress;
}
public StringFilter getBillingSalutation() {
return billingSalutation;
}
public void setBillingSalutation(StringFilter billingSalutation) {
this.billingSalutation = billingSalutation;
}
public LongFilter getRoleId() {
@ -72,6 +112,14 @@ public class CustomerCriteria implements Serializable {
this.roleId = roleId;
}
public LongFilter getMembershipId() {
return membershipId;
}
public void setMembershipId(LongFilter membershipId) {
this.membershipId = membershipId;
}
@Override
public boolean equals(Object o) {
@ -86,8 +134,13 @@ public class CustomerCriteria implements Serializable {
Objects.equals(id, that.id) &&
Objects.equals(number, that.number) &&
Objects.equals(prefix, that.prefix) &&
Objects.equals(membershipId, that.membershipId) &&
Objects.equals(roleId, that.roleId);
Objects.equals(name, that.name) &&
Objects.equals(contractualAddress, that.contractualAddress) &&
Objects.equals(contractualSalutation, that.contractualSalutation) &&
Objects.equals(billingAddress, that.billingAddress) &&
Objects.equals(billingSalutation, that.billingSalutation) &&
Objects.equals(roleId, that.roleId) &&
Objects.equals(membershipId, that.membershipId);
}
@Override
@ -96,8 +149,13 @@ public class CustomerCriteria implements Serializable {
id,
number,
prefix,
membershipId,
roleId
name,
contractualAddress,
contractualSalutation,
billingAddress,
billingSalutation,
roleId,
membershipId
);
}
@ -107,8 +165,13 @@ public class CustomerCriteria implements Serializable {
(id != null ? "id=" + id + ", " : "") +
(number != null ? "number=" + number + ", " : "") +
(prefix != null ? "prefix=" + prefix + ", " : "") +
(membershipId != null ? "membershipId=" + membershipId + ", " : "") +
(name != null ? "name=" + name + ", " : "") +
(contractualAddress != null ? "contractualAddress=" + contractualAddress + ", " : "") +
(contractualSalutation != null ? "contractualSalutation=" + contractualSalutation + ", " : "") +
(billingAddress != null ? "billingAddress=" + billingAddress + ", " : "") +
(billingSalutation != null ? "billingSalutation=" + billingSalutation + ", " : "") +
(roleId != null ? "roleId=" + roleId + ", " : "") +
(membershipId != null ? "membershipId=" + membershipId + ", " : "") +
"}";
}

View File

@ -19,6 +19,23 @@ public class CustomerDTO implements Serializable {
@Pattern(regexp = "[a-z][a-z0-9]+")
private String prefix;
@NotNull
@Size(max = 80)
private String name;
@NotNull
@Size(max = 400)
private String contractualAddress;
@Size(max = 80)
private String contractualSalutation;
@Size(max = 400)
private String billingAddress;
@Size(max = 80)
private String billingSalutation;
public Long getId() {
return id;
@ -44,6 +61,46 @@ public class CustomerDTO implements Serializable {
this.prefix = prefix;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getContractualAddress() {
return contractualAddress;
}
public void setContractualAddress(String contractualAddress) {
this.contractualAddress = contractualAddress;
}
public String getContractualSalutation() {
return contractualSalutation;
}
public void setContractualSalutation(String contractualSalutation) {
this.contractualSalutation = contractualSalutation;
}
public String getBillingAddress() {
return billingAddress;
}
public void setBillingAddress(String billingAddress) {
this.billingAddress = billingAddress;
}
public String getBillingSalutation() {
return billingSalutation;
}
public void setBillingSalutation(String billingSalutation) {
this.billingSalutation = billingSalutation;
}
@Override
public boolean equals(Object o) {
if (this == o) {
@ -71,6 +128,11 @@ public class CustomerDTO implements Serializable {
"id=" + getId() +
", number=" + getNumber() +
", prefix='" + getPrefix() + "'" +
", name='" + getName() + "'" +
", contractualAddress='" + getContractualAddress() + "'" +
", contractualSalutation='" + getContractualSalutation() + "'" +
", billingAddress='" + getBillingAddress() + "'" +
", billingSalutation='" + getBillingSalutation() + "'" +
"}";
}
}

View File

@ -1,9 +1,9 @@
package org.hostsharing.hsadminng.service.mapper;
import org.hostsharing.hsadminng.domain.*;
import org.hostsharing.hsadminng.domain.Customer;
import org.hostsharing.hsadminng.service.dto.CustomerDTO;
import org.mapstruct.*;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
/**
* Mapper for the entity Customer and its DTO CustomerDTO.
@ -12,8 +12,8 @@ import org.mapstruct.*;
public interface CustomerMapper extends EntityMapper<CustomerDTO, Customer> {
@Mapping(target = "memberships", ignore = true)
@Mapping(target = "roles", ignore = true)
@Mapping(target = "memberships", ignore = true)
Customer toEntity(CustomerDTO customerDTO);
default Customer fromId(Long id) {