several 'required' flags added to jdl and re-import
This commit is contained in:
@ -44,7 +44,7 @@ public class Asset implements Serializable {
|
||||
private String comment;
|
||||
|
||||
@NotNull
|
||||
@ManyToOne
|
||||
@ManyToOne(optional = false)
|
||||
@JsonIgnoreProperties("assets")
|
||||
private Membership member;
|
||||
|
||||
|
@ -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.
|
||||
@ -58,10 +55,12 @@ public class Customer implements Serializable {
|
||||
@Column(name = "billing_salutation", length = 80)
|
||||
private String billingSalutation;
|
||||
|
||||
@OneToMany(mappedBy = "customer")
|
||||
private Set<Membership> memberships = new HashSet<>();
|
||||
@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;
|
||||
@ -162,31 +161,6 @@ public class Customer implements Serializable {
|
||||
this.billingSalutation = billingSalutation;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
@ -211,6 +185,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
|
||||
|
@ -41,7 +41,7 @@ public class Membership implements Serializable {
|
||||
private Set<Asset> assets = new HashSet<>();
|
||||
|
||||
@NotNull
|
||||
@ManyToOne
|
||||
@ManyToOne(optional = false)
|
||||
@JsonIgnoreProperties("memberships")
|
||||
private Customer customer;
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class Share implements Serializable {
|
||||
private String comment;
|
||||
|
||||
@NotNull
|
||||
@ManyToOne
|
||||
@ManyToOne(optional = false)
|
||||
@JsonIgnoreProperties("shares")
|
||||
private Membership member;
|
||||
|
||||
|
@ -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.
|
||||
@ -110,14 +109,14 @@ public class CustomerQueryService extends QueryService<Customer> {
|
||||
if (criteria.getBillingSalutation() != null) {
|
||||
specification = specification.and(buildStringSpecification(criteria.getBillingSalutation(), Customer_.billingSalutation));
|
||||
}
|
||||
if (criteria.getMembershipId() != null) {
|
||||
specification = specification.and(buildSpecification(criteria.getMembershipId(),
|
||||
root -> root.join(Customer_.memberships, JoinType.LEFT).get(Membership_.id)));
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
@ -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.
|
||||
@ -38,10 +36,10 @@ public class CustomerCriteria implements Serializable {
|
||||
|
||||
private StringFilter billingSalutation;
|
||||
|
||||
private LongFilter membershipId;
|
||||
|
||||
private LongFilter roleId;
|
||||
|
||||
private LongFilter membershipId;
|
||||
|
||||
public LongFilter getId() {
|
||||
return id;
|
||||
}
|
||||
@ -106,14 +104,6 @@ public class CustomerCriteria implements Serializable {
|
||||
this.billingSalutation = billingSalutation;
|
||||
}
|
||||
|
||||
public LongFilter getMembershipId() {
|
||||
return membershipId;
|
||||
}
|
||||
|
||||
public void setMembershipId(LongFilter membershipId) {
|
||||
this.membershipId = membershipId;
|
||||
}
|
||||
|
||||
public LongFilter getRoleId() {
|
||||
return roleId;
|
||||
}
|
||||
@ -122,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) {
|
||||
@ -141,8 +139,8 @@ public class CustomerCriteria implements Serializable {
|
||||
Objects.equals(contractualSalutation, that.contractualSalutation) &&
|
||||
Objects.equals(billingAddress, that.billingAddress) &&
|
||||
Objects.equals(billingSalutation, that.billingSalutation) &&
|
||||
Objects.equals(membershipId, that.membershipId) &&
|
||||
Objects.equals(roleId, that.roleId);
|
||||
Objects.equals(roleId, that.roleId) &&
|
||||
Objects.equals(membershipId, that.membershipId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -156,8 +154,8 @@ public class CustomerCriteria implements Serializable {
|
||||
contractualSalutation,
|
||||
billingAddress,
|
||||
billingSalutation,
|
||||
membershipId,
|
||||
roleId
|
||||
roleId,
|
||||
membershipId
|
||||
);
|
||||
}
|
||||
|
||||
@ -172,8 +170,8 @@ public class CustomerCriteria implements Serializable {
|
||||
(contractualSalutation != null ? "contractualSalutation=" + contractualSalutation + ", " : "") +
|
||||
(billingAddress != null ? "billingAddress=" + billingAddress + ", " : "") +
|
||||
(billingSalutation != null ? "billingSalutation=" + billingSalutation + ", " : "") +
|
||||
(membershipId != null ? "membershipId=" + membershipId + ", " : "") +
|
||||
(roleId != null ? "roleId=" + roleId + ", " : "") +
|
||||
(membershipId != null ? "membershipId=" + membershipId + ", " : "") +
|
||||
"}";
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
Reference in New Issue
Block a user