1
0

Model customers.

This commit is contained in:
Michael Hierweck
2019-04-17 16:45:43 +02:00
parent bd5bb859d9
commit 2459dd3b64
109 changed files with 5513 additions and 1091 deletions

View File

@ -2,16 +2,17 @@ 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.NotNull;
import javax.validation.constraints.Size;
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.
*/
@ -27,8 +28,12 @@ public class Asset implements Serializable {
private Long id;
@NotNull
@Column(name = "jhi_date", nullable = false)
private LocalDate date;
@Column(name = "document_date", nullable = false)
private LocalDate documentDate;
@NotNull
@Column(name = "value_date", nullable = false)
private LocalDate valueDate;
@NotNull
@Enumerated(EnumType.STRING)
@ -40,13 +45,13 @@ public class Asset implements Serializable {
private BigDecimal amount;
@Size(max = 160)
@Column(name = "jhi_comment", length = 160)
private String comment;
@Column(name = "remark", length = 160)
private String remark;
@ManyToOne(optional = false)
@NotNull
@JsonIgnoreProperties("assets")
private Membership member;
private Membership membership;
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() {
@ -57,17 +62,30 @@ public class Asset implements Serializable {
this.id = id;
}
public LocalDate getDate() {
return date;
public LocalDate getDocumentDate() {
return documentDate;
}
public Asset date(LocalDate date) {
this.date = date;
public Asset documentDate(LocalDate documentDate) {
this.documentDate = documentDate;
return this;
}
public void setDate(LocalDate date) {
this.date = date;
public void setDocumentDate(LocalDate documentDate) {
this.documentDate = documentDate;
}
public LocalDate getValueDate() {
return valueDate;
}
public Asset valueDate(LocalDate valueDate) {
this.valueDate = valueDate;
return this;
}
public void setValueDate(LocalDate valueDate) {
this.valueDate = valueDate;
}
public AssetAction getAction() {
@ -96,30 +114,30 @@ public class Asset implements Serializable {
this.amount = amount;
}
public String getComment() {
return comment;
public String getRemark() {
return remark;
}
public Asset comment(String comment) {
this.comment = comment;
public Asset remark(String remark) {
this.remark = remark;
return this;
}
public void setComment(String comment) {
this.comment = comment;
public void setRemark(String remark) {
this.remark = remark;
}
public Membership getMember() {
return member;
public Membership getMembership() {
return membership;
}
public Asset member(Membership membership) {
this.member = membership;
public Asset membership(Membership membership) {
this.membership = membership;
return this;
}
public void setMember(Membership membership) {
this.member = membership;
public void setMembership(Membership membership) {
this.membership = membership;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
@ -147,10 +165,11 @@ public class Asset implements Serializable {
public String toString() {
return "Asset{" +
"id=" + getId() +
", date='" + getDate() + "'" +
", documentDate='" + getDocumentDate() + "'" +
", valueDate='" + getValueDate() + "'" +
", action='" + getAction() + "'" +
", amount=" + getAmount() +
", comment='" + getComment() + "'" +
", remark='" + getRemark() + "'" +
"}";
}
}

View File

@ -1,12 +1,15 @@
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.Objects;
import java.util.Set;
import java.util.Objects;
/**
* A Customer.
@ -25,12 +28,13 @@ public class Customer implements Serializable {
@NotNull
@Min(value = 10000)
@Max(value = 99999)
@Column(name = "jhi_number", nullable = false, unique = true)
private Integer number;
@Column(name = "reference", nullable = false, unique = true)
private Integer reference;
@NotNull
@Size(max = 3)
@Pattern(regexp = "[a-z][a-z0-9]+")
@Column(name = "prefix", nullable = false, unique = true)
@Column(name = "prefix", length = 3, nullable = false, unique = true)
private String prefix;
@NotNull
@ -38,27 +42,31 @@ public class Customer implements Serializable {
@Column(name = "name", length = 80, nullable = false)
private String name;
@Size(max = 80)
@Column(name = "contractual_salutation", length = 80)
private String contractualSalutation;
@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;
@Column(name = "billing_salutation", length = 80)
private String billingSalutation;
@Size(max = 400)
@Column(name = "billing_address", length = 400)
private String billingAddress;
@Size(max = 80)
@Column(name = "billing_salutation", length = 80)
private String billingSalutation;
@Size(max = 160)
@Column(name = "remark", length = 160)
private String remark;
@OneToMany(mappedBy = "customer")
private Set<CustomerContact> roles = new HashSet<>();
@OneToMany(mappedBy = "customer")
private Set<Membership> memberships = new HashSet<>();
@OneToMany(mappedBy = "customer")
private Set<SepaMandate> sepamandates = new HashSet<>();
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() {
return id;
@ -68,17 +76,17 @@ public class Customer implements Serializable {
this.id = id;
}
public Integer getNumber() {
return number;
public Integer getReference() {
return reference;
}
public Customer number(Integer number) {
this.number = number;
public Customer reference(Integer reference) {
this.reference = reference;
return this;
}
public void setNumber(Integer number) {
this.number = number;
public void setReference(Integer reference) {
this.reference = reference;
}
public String getPrefix() {
@ -107,19 +115,6 @@ public class Customer implements Serializable {
this.name = name;
}
public String getContractualAddress() {
return contractualAddress;
}
public Customer contractualAddress(String contractualAddress) {
this.contractualAddress = contractualAddress;
return this;
}
public void setContractualAddress(String contractualAddress) {
this.contractualAddress = contractualAddress;
}
public String getContractualSalutation() {
return contractualSalutation;
}
@ -133,17 +128,17 @@ public class Customer implements Serializable {
this.contractualSalutation = contractualSalutation;
}
public String getBillingAddress() {
return billingAddress;
public String getContractualAddress() {
return contractualAddress;
}
public Customer billingAddress(String billingAddress) {
this.billingAddress = billingAddress;
public Customer contractualAddress(String contractualAddress) {
this.contractualAddress = contractualAddress;
return this;
}
public void setBillingAddress(String billingAddress) {
this.billingAddress = billingAddress;
public void setContractualAddress(String contractualAddress) {
this.contractualAddress = contractualAddress;
}
public String getBillingSalutation() {
@ -159,29 +154,30 @@ public class Customer implements Serializable {
this.billingSalutation = billingSalutation;
}
public Set<CustomerContact> getRoles() {
return roles;
public String getBillingAddress() {
return billingAddress;
}
public Customer roles(Set<CustomerContact> customerContacts) {
this.roles = customerContacts;
public Customer billingAddress(String billingAddress) {
this.billingAddress = billingAddress;
return this;
}
public Customer addRole(CustomerContact customerContact) {
this.roles.add(customerContact);
customerContact.setCustomer(this);
public void setBillingAddress(String billingAddress) {
this.billingAddress = billingAddress;
}
public String getRemark() {
return remark;
}
public Customer remark(String remark) {
this.remark = remark;
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;
public void setRemark(String remark) {
this.remark = remark;
}
public Set<Membership> getMemberships() {
@ -208,6 +204,31 @@ public class Customer implements Serializable {
public void setMemberships(Set<Membership> memberships) {
this.memberships = memberships;
}
public Set<SepaMandate> getSepamandates() {
return sepamandates;
}
public Customer sepamandates(Set<SepaMandate> sepaMandates) {
this.sepamandates = sepaMandates;
return this;
}
public Customer addSepamandate(SepaMandate sepaMandate) {
this.sepamandates.add(sepaMandate);
sepaMandate.setCustomer(this);
return this;
}
public Customer removeSepamandate(SepaMandate sepaMandate) {
this.sepamandates.remove(sepaMandate);
sepaMandate.setCustomer(null);
return this;
}
public void setSepamandates(Set<SepaMandate> sepaMandates) {
this.sepamandates = sepaMandates;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
@Override
@ -234,13 +255,14 @@ public class Customer implements Serializable {
public String toString() {
return "Customer{" +
"id=" + getId() +
", number=" + getNumber() +
", reference=" + getReference() +
", prefix='" + getPrefix() + "'" +
", name='" + getName() + "'" +
", contractualAddress='" + getContractualAddress() + "'" +
", contractualSalutation='" + getContractualSalutation() + "'" +
", billingAddress='" + getBillingAddress() + "'" +
", contractualAddress='" + getContractualAddress() + "'" +
", billingSalutation='" + getBillingSalutation() + "'" +
", billingAddress='" + getBillingAddress() + "'" +
", remark='" + getRemark() + "'" +
"}";
}
}

View File

@ -1,15 +1,17 @@
package org.hostsharing.hsadminng.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
import java.util.Objects;
/**
* A Membership.
@ -26,15 +28,23 @@ public class Membership implements Serializable {
private Long id;
@NotNull
@Column(name = "since_date", nullable = false)
private LocalDate sinceDate;
@Column(name = "document_date", nullable = false)
private LocalDate documentDate;
@Column(name = "until_date")
private LocalDate untilDate;
@NotNull
@Column(name = "member_from", nullable = false)
private LocalDate memberFrom;
@OneToMany(mappedBy = "member")
@Column(name = "member_until")
private LocalDate memberUntil;
@Size(max = 160)
@Column(name = "remark", length = 160)
private String remark;
@OneToMany(mappedBy = "membership")
private Set<Share> shares = new HashSet<>();
@OneToMany(mappedBy = "member")
@OneToMany(mappedBy = "membership")
private Set<Asset> assets = new HashSet<>();
@ManyToOne(optional = false)
@NotNull
@ -50,30 +60,56 @@ public class Membership implements Serializable {
this.id = id;
}
public LocalDate getSinceDate() {
return sinceDate;
public LocalDate getDocumentDate() {
return documentDate;
}
public Membership sinceDate(LocalDate sinceDate) {
this.sinceDate = sinceDate;
public Membership documentDate(LocalDate documentDate) {
this.documentDate = documentDate;
return this;
}
public void setSinceDate(LocalDate sinceDate) {
this.sinceDate = sinceDate;
public void setDocumentDate(LocalDate documentDate) {
this.documentDate = documentDate;
}
public LocalDate getUntilDate() {
return untilDate;
public LocalDate getMemberFrom() {
return memberFrom;
}
public Membership untilDate(LocalDate untilDate) {
this.untilDate = untilDate;
public Membership memberFrom(LocalDate memberFrom) {
this.memberFrom = memberFrom;
return this;
}
public void setUntilDate(LocalDate untilDate) {
this.untilDate = untilDate;
public void setMemberFrom(LocalDate memberFrom) {
this.memberFrom = memberFrom;
}
public LocalDate getMemberUntil() {
return memberUntil;
}
public Membership memberUntil(LocalDate memberUntil) {
this.memberUntil = memberUntil;
return this;
}
public void setMemberUntil(LocalDate memberUntil) {
this.memberUntil = memberUntil;
}
public String getRemark() {
return remark;
}
public Membership remark(String remark) {
this.remark = remark;
return this;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Set<Share> getShares() {
@ -87,13 +123,13 @@ public class Membership implements Serializable {
public Membership addShare(Share share) {
this.shares.add(share);
share.setMember(this);
share.setMembership(this);
return this;
}
public Membership removeShare(Share share) {
this.shares.remove(share);
share.setMember(null);
share.setMembership(null);
return this;
}
@ -112,13 +148,13 @@ public class Membership implements Serializable {
public Membership addAsset(Asset asset) {
this.assets.add(asset);
asset.setMember(this);
asset.setMembership(this);
return this;
}
public Membership removeAsset(Asset asset) {
this.assets.remove(asset);
asset.setMember(null);
asset.setMembership(null);
return this;
}
@ -164,8 +200,10 @@ public class Membership implements Serializable {
public String toString() {
return "Membership{" +
"id=" + getId() +
", sinceDate='" + getSinceDate() + "'" +
", untilDate='" + getUntilDate() + "'" +
", documentDate='" + getDocumentDate() + "'" +
", memberFrom='" + getMemberFrom() + "'" +
", memberUntil='" + getMemberUntil() + "'" +
", remark='" + getRemark() + "'" +
"}";
}
}

View File

@ -0,0 +1,241 @@
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;
/**
* A SepaMandate.
*/
@Entity
@Table(name = "sepa_mandate")
public class SepaMandate implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
@SequenceGenerator(name = "sequenceGenerator")
private Long id;
@NotNull
@Size(max = 40)
@Column(name = "reference", length = 40, nullable = false, unique = true)
private String reference;
@Size(max = 34)
@Column(name = "iban", length = 34)
private String iban;
@Size(max = 11)
@Column(name = "bic", length = 11)
private String bic;
@NotNull
@Column(name = "document_date", nullable = false)
private LocalDate documentDate;
@NotNull
@Column(name = "valid_from", nullable = false)
private LocalDate validFrom;
@Column(name = "valid_until")
private LocalDate validUntil;
@Column(name = "last_used")
private LocalDate lastUsed;
@Column(name = "cancellation_date")
private LocalDate cancellationDate;
@Size(max = 160)
@Column(name = "remark", length = 160)
private String remark;
@ManyToOne(optional = false)
@NotNull
@JsonIgnoreProperties("sepamandates")
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 String getReference() {
return reference;
}
public SepaMandate reference(String reference) {
this.reference = reference;
return this;
}
public void setReference(String reference) {
this.reference = reference;
}
public String getIban() {
return iban;
}
public SepaMandate iban(String iban) {
this.iban = iban;
return this;
}
public void setIban(String iban) {
this.iban = iban;
}
public String getBic() {
return bic;
}
public SepaMandate bic(String bic) {
this.bic = bic;
return this;
}
public void setBic(String bic) {
this.bic = bic;
}
public LocalDate getDocumentDate() {
return documentDate;
}
public SepaMandate documentDate(LocalDate documentDate) {
this.documentDate = documentDate;
return this;
}
public void setDocumentDate(LocalDate documentDate) {
this.documentDate = documentDate;
}
public LocalDate getValidFrom() {
return validFrom;
}
public SepaMandate validFrom(LocalDate validFrom) {
this.validFrom = validFrom;
return this;
}
public void setValidFrom(LocalDate validFrom) {
this.validFrom = validFrom;
}
public LocalDate getValidUntil() {
return validUntil;
}
public SepaMandate validUntil(LocalDate validUntil) {
this.validUntil = validUntil;
return this;
}
public void setValidUntil(LocalDate validUntil) {
this.validUntil = validUntil;
}
public LocalDate getLastUsed() {
return lastUsed;
}
public SepaMandate lastUsed(LocalDate lastUsed) {
this.lastUsed = lastUsed;
return this;
}
public void setLastUsed(LocalDate lastUsed) {
this.lastUsed = lastUsed;
}
public LocalDate getCancellationDate() {
return cancellationDate;
}
public SepaMandate cancellationDate(LocalDate cancellationDate) {
this.cancellationDate = cancellationDate;
return this;
}
public void setCancellationDate(LocalDate cancellationDate) {
this.cancellationDate = cancellationDate;
}
public String getRemark() {
return remark;
}
public SepaMandate remark(String remark) {
this.remark = remark;
return this;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Customer getCustomer() {
return customer;
}
public SepaMandate 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;
}
SepaMandate sepaMandate = (SepaMandate) o;
if (sepaMandate.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), sepaMandate.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "SepaMandate{" +
"id=" + getId() +
", reference='" + getReference() + "'" +
", iban='" + getIban() + "'" +
", bic='" + getBic() + "'" +
", documentDate='" + getDocumentDate() + "'" +
", validFrom='" + getValidFrom() + "'" +
", validUntil='" + getValidUntil() + "'" +
", lastUsed='" + getLastUsed() + "'" +
", cancellationDate='" + getCancellationDate() + "'" +
", remark='" + getRemark() + "'" +
"}";
}
}

View File

@ -2,15 +2,16 @@ 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.NotNull;
import javax.validation.constraints.Size;
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.
*/
@ -26,8 +27,12 @@ public class Share implements Serializable {
private Long id;
@NotNull
@Column(name = "jhi_date", nullable = false)
private LocalDate date;
@Column(name = "document_date", nullable = false)
private LocalDate documentDate;
@NotNull
@Column(name = "value_date", nullable = false)
private LocalDate valueDate;
@NotNull
@Enumerated(EnumType.STRING)
@ -39,13 +44,13 @@ public class Share implements Serializable {
private Integer quantity;
@Size(max = 160)
@Column(name = "jhi_comment", length = 160)
private String comment;
@Column(name = "remark", length = 160)
private String remark;
@ManyToOne(optional = false)
@NotNull
@JsonIgnoreProperties("shares")
private Membership member;
private Membership membership;
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() {
@ -56,17 +61,30 @@ public class Share implements Serializable {
this.id = id;
}
public LocalDate getDate() {
return date;
public LocalDate getDocumentDate() {
return documentDate;
}
public Share date(LocalDate date) {
this.date = date;
public Share documentDate(LocalDate documentDate) {
this.documentDate = documentDate;
return this;
}
public void setDate(LocalDate date) {
this.date = date;
public void setDocumentDate(LocalDate documentDate) {
this.documentDate = documentDate;
}
public LocalDate getValueDate() {
return valueDate;
}
public Share valueDate(LocalDate valueDate) {
this.valueDate = valueDate;
return this;
}
public void setValueDate(LocalDate valueDate) {
this.valueDate = valueDate;
}
public ShareAction getAction() {
@ -95,30 +113,30 @@ public class Share implements Serializable {
this.quantity = quantity;
}
public String getComment() {
return comment;
public String getRemark() {
return remark;
}
public Share comment(String comment) {
this.comment = comment;
public Share remark(String remark) {
this.remark = remark;
return this;
}
public void setComment(String comment) {
this.comment = comment;
public void setRemark(String remark) {
this.remark = remark;
}
public Membership getMember() {
return member;
public Membership getMembership() {
return membership;
}
public Share member(Membership membership) {
this.member = membership;
public Share membership(Membership membership) {
this.membership = membership;
return this;
}
public void setMember(Membership membership) {
this.member = membership;
public void setMembership(Membership membership) {
this.membership = membership;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
@ -146,10 +164,11 @@ public class Share implements Serializable {
public String toString() {
return "Share{" +
"id=" + getId() +
", date='" + getDate() + "'" +
", documentDate='" + getDocumentDate() + "'" +
", valueDate='" + getValueDate() + "'" +
", action='" + getAction() + "'" +
", quantity=" + getQuantity() +
", comment='" + getComment() + "'" +
", remark='" + getRemark() + "'" +
"}";
}
}

View File

@ -0,0 +1,15 @@
package org.hostsharing.hsadminng.repository;
import org.hostsharing.hsadminng.domain.SepaMandate;
import org.springframework.data.jpa.repository.*;
import org.springframework.stereotype.Repository;
/**
* Spring Data repository for the SepaMandate entity.
*/
@SuppressWarnings("unused")
@Repository
public interface SepaMandateRepository extends JpaRepository<SepaMandate, Long>, JpaSpecificationExecutor<SepaMandate> {
}

View File

@ -89,8 +89,11 @@ public class AssetQueryService extends QueryService<Asset> {
if (criteria.getId() != null) {
specification = specification.and(buildSpecification(criteria.getId(), Asset_.id));
}
if (criteria.getDate() != null) {
specification = specification.and(buildRangeSpecification(criteria.getDate(), Asset_.date));
if (criteria.getDocumentDate() != null) {
specification = specification.and(buildRangeSpecification(criteria.getDocumentDate(), Asset_.documentDate));
}
if (criteria.getValueDate() != null) {
specification = specification.and(buildRangeSpecification(criteria.getValueDate(), Asset_.valueDate));
}
if (criteria.getAction() != null) {
specification = specification.and(buildSpecification(criteria.getAction(), Asset_.action));
@ -98,12 +101,12 @@ public class AssetQueryService extends QueryService<Asset> {
if (criteria.getAmount() != null) {
specification = specification.and(buildRangeSpecification(criteria.getAmount(), Asset_.amount));
}
if (criteria.getComment() != null) {
specification = specification.and(buildStringSpecification(criteria.getComment(), Asset_.comment));
if (criteria.getRemark() != null) {
specification = specification.and(buildStringSpecification(criteria.getRemark(), Asset_.remark));
}
if (criteria.getMemberId() != null) {
specification = specification.and(buildSpecification(criteria.getMemberId(),
root -> root.join(Asset_.member, JoinType.LEFT).get(Membership_.id)));
if (criteria.getMembershipId() != null) {
specification = specification.and(buildSpecification(criteria.getMembershipId(),
root -> root.join(Asset_.membership, JoinType.LEFT).get(Membership_.id)));
}
}
return specification;

View File

@ -1,14 +1,9 @@
package org.hostsharing.hsadminng.service;
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 java.util.List;
import javax.persistence.criteria.JoinType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
@ -17,8 +12,14 @@ import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.criteria.JoinType;
import java.util.List;
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;
/**
* Service for executing complex queries for Customer entities in the database.
@ -88,8 +89,8 @@ public class CustomerQueryService extends QueryService<Customer> {
if (criteria.getId() != null) {
specification = specification.and(buildSpecification(criteria.getId(), Customer_.id));
}
if (criteria.getNumber() != null) {
specification = specification.and(buildRangeSpecification(criteria.getNumber(), Customer_.number));
if (criteria.getReference() != null) {
specification = specification.and(buildRangeSpecification(criteria.getReference(), Customer_.reference));
}
if (criteria.getPrefix() != null) {
specification = specification.and(buildStringSpecification(criteria.getPrefix(), Customer_.prefix));
@ -97,26 +98,29 @@ public class CustomerQueryService extends QueryService<Customer> {
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.getContractualAddress() != null) {
specification = specification.and(buildStringSpecification(criteria.getContractualAddress(), Customer_.contractualAddress));
}
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.getBillingAddress() != null) {
specification = specification.and(buildStringSpecification(criteria.getBillingAddress(), Customer_.billingAddress));
}
if (criteria.getRemark() != null) {
specification = specification.and(buildStringSpecification(criteria.getRemark(), Customer_.remark));
}
if (criteria.getMembershipId() != null) {
specification = specification.and(buildSpecification(criteria.getMembershipId(),
root -> root.join(Customer_.memberships, JoinType.LEFT).get(Membership_.id)));
}
if (criteria.getSepamandateId() != null) {
specification = specification.and(buildSpecification(criteria.getSepamandateId(),
root -> root.join(Customer_.sepamandates, JoinType.LEFT).get(SepaMandate_.id)));
}
}
return specification;
}

View File

@ -89,11 +89,17 @@ public class MembershipQueryService extends QueryService<Membership> {
if (criteria.getId() != null) {
specification = specification.and(buildSpecification(criteria.getId(), Membership_.id));
}
if (criteria.getSinceDate() != null) {
specification = specification.and(buildRangeSpecification(criteria.getSinceDate(), Membership_.sinceDate));
if (criteria.getDocumentDate() != null) {
specification = specification.and(buildRangeSpecification(criteria.getDocumentDate(), Membership_.documentDate));
}
if (criteria.getUntilDate() != null) {
specification = specification.and(buildRangeSpecification(criteria.getUntilDate(), Membership_.untilDate));
if (criteria.getMemberFrom() != null) {
specification = specification.and(buildRangeSpecification(criteria.getMemberFrom(), Membership_.memberFrom));
}
if (criteria.getMemberUntil() != null) {
specification = specification.and(buildRangeSpecification(criteria.getMemberUntil(), Membership_.memberUntil));
}
if (criteria.getRemark() != null) {
specification = specification.and(buildStringSpecification(criteria.getRemark(), Membership_.remark));
}
if (criteria.getShareId() != null) {
specification = specification.and(buildSpecification(criteria.getShareId(),

View File

@ -0,0 +1,126 @@
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.SepaMandate;
import org.hostsharing.hsadminng.domain.*; // for static metamodels
import org.hostsharing.hsadminng.repository.SepaMandateRepository;
import org.hostsharing.hsadminng.service.dto.SepaMandateCriteria;
import org.hostsharing.hsadminng.service.dto.SepaMandateDTO;
import org.hostsharing.hsadminng.service.mapper.SepaMandateMapper;
/**
* Service for executing complex queries for SepaMandate entities in the database.
* The main input is a {@link SepaMandateCriteria} which gets converted to {@link Specification},
* in a way that all the filters must apply.
* It returns a {@link List} of {@link SepaMandateDTO} or a {@link Page} of {@link SepaMandateDTO} which fulfills the criteria.
*/
@Service
@Transactional(readOnly = true)
public class SepaMandateQueryService extends QueryService<SepaMandate> {
private final Logger log = LoggerFactory.getLogger(SepaMandateQueryService.class);
private final SepaMandateRepository sepaMandateRepository;
private final SepaMandateMapper sepaMandateMapper;
public SepaMandateQueryService(SepaMandateRepository sepaMandateRepository, SepaMandateMapper sepaMandateMapper) {
this.sepaMandateRepository = sepaMandateRepository;
this.sepaMandateMapper = sepaMandateMapper;
}
/**
* Return a {@link List} of {@link SepaMandateDTO} which matches the criteria from the database
* @param criteria The object which holds all the filters, which the entities should match.
* @return the matching entities.
*/
@Transactional(readOnly = true)
public List<SepaMandateDTO> findByCriteria(SepaMandateCriteria criteria) {
log.debug("find by criteria : {}", criteria);
final Specification<SepaMandate> specification = createSpecification(criteria);
return sepaMandateMapper.toDto(sepaMandateRepository.findAll(specification));
}
/**
* Return a {@link Page} of {@link SepaMandateDTO} which matches the criteria from the database
* @param criteria The object which holds all the filters, which the entities should match.
* @param page The page, which should be returned.
* @return the matching entities.
*/
@Transactional(readOnly = true)
public Page<SepaMandateDTO> findByCriteria(SepaMandateCriteria criteria, Pageable page) {
log.debug("find by criteria : {}, page: {}", criteria, page);
final Specification<SepaMandate> specification = createSpecification(criteria);
return sepaMandateRepository.findAll(specification, page)
.map(sepaMandateMapper::toDto);
}
/**
* Return the number of matching entities in the database
* @param criteria The object which holds all the filters, which the entities should match.
* @return the number of matching entities.
*/
@Transactional(readOnly = true)
public long countByCriteria(SepaMandateCriteria criteria) {
log.debug("count by criteria : {}", criteria);
final Specification<SepaMandate> specification = createSpecification(criteria);
return sepaMandateRepository.count(specification);
}
/**
* Function to convert SepaMandateCriteria to a {@link Specification}
*/
private Specification<SepaMandate> createSpecification(SepaMandateCriteria criteria) {
Specification<SepaMandate> specification = Specification.where(null);
if (criteria != null) {
if (criteria.getId() != null) {
specification = specification.and(buildSpecification(criteria.getId(), SepaMandate_.id));
}
if (criteria.getReference() != null) {
specification = specification.and(buildStringSpecification(criteria.getReference(), SepaMandate_.reference));
}
if (criteria.getIban() != null) {
specification = specification.and(buildStringSpecification(criteria.getIban(), SepaMandate_.iban));
}
if (criteria.getBic() != null) {
specification = specification.and(buildStringSpecification(criteria.getBic(), SepaMandate_.bic));
}
if (criteria.getDocumentDate() != null) {
specification = specification.and(buildRangeSpecification(criteria.getDocumentDate(), SepaMandate_.documentDate));
}
if (criteria.getValidFrom() != null) {
specification = specification.and(buildRangeSpecification(criteria.getValidFrom(), SepaMandate_.validFrom));
}
if (criteria.getValidUntil() != null) {
specification = specification.and(buildRangeSpecification(criteria.getValidUntil(), SepaMandate_.validUntil));
}
if (criteria.getLastUsed() != null) {
specification = specification.and(buildRangeSpecification(criteria.getLastUsed(), SepaMandate_.lastUsed));
}
if (criteria.getCancellationDate() != null) {
specification = specification.and(buildRangeSpecification(criteria.getCancellationDate(), SepaMandate_.cancellationDate));
}
if (criteria.getRemark() != null) {
specification = specification.and(buildStringSpecification(criteria.getRemark(), SepaMandate_.remark));
}
if (criteria.getCustomerId() != null) {
specification = specification.and(buildSpecification(criteria.getCustomerId(),
root -> root.join(SepaMandate_.customer, JoinType.LEFT).get(Customer_.id)));
}
}
return specification;
}
}

View File

@ -0,0 +1,84 @@
package org.hostsharing.hsadminng.service;
import org.hostsharing.hsadminng.domain.SepaMandate;
import org.hostsharing.hsadminng.repository.SepaMandateRepository;
import org.hostsharing.hsadminng.service.dto.SepaMandateDTO;
import org.hostsharing.hsadminng.service.mapper.SepaMandateMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Optional;
/**
* Service Implementation for managing SepaMandate.
*/
@Service
@Transactional
public class SepaMandateService {
private final Logger log = LoggerFactory.getLogger(SepaMandateService.class);
private final SepaMandateRepository sepaMandateRepository;
private final SepaMandateMapper sepaMandateMapper;
public SepaMandateService(SepaMandateRepository sepaMandateRepository, SepaMandateMapper sepaMandateMapper) {
this.sepaMandateRepository = sepaMandateRepository;
this.sepaMandateMapper = sepaMandateMapper;
}
/**
* Save a sepaMandate.
*
* @param sepaMandateDTO the entity to save
* @return the persisted entity
*/
public SepaMandateDTO save(SepaMandateDTO sepaMandateDTO) {
log.debug("Request to save SepaMandate : {}", sepaMandateDTO);
SepaMandate sepaMandate = sepaMandateMapper.toEntity(sepaMandateDTO);
sepaMandate = sepaMandateRepository.save(sepaMandate);
return sepaMandateMapper.toDto(sepaMandate);
}
/**
* Get all the sepaMandates.
*
* @param pageable the pagination information
* @return the list of entities
*/
@Transactional(readOnly = true)
public Page<SepaMandateDTO> findAll(Pageable pageable) {
log.debug("Request to get all SepaMandates");
return sepaMandateRepository.findAll(pageable)
.map(sepaMandateMapper::toDto);
}
/**
* Get one sepaMandate by id.
*
* @param id the id of the entity
* @return the entity
*/
@Transactional(readOnly = true)
public Optional<SepaMandateDTO> findOne(Long id) {
log.debug("Request to get SepaMandate : {}", id);
return sepaMandateRepository.findById(id)
.map(sepaMandateMapper::toDto);
}
/**
* Delete the sepaMandate by id.
*
* @param id the id of the entity
*/
public void delete(Long id) {
log.debug("Request to delete SepaMandate : {}", id);
sepaMandateRepository.deleteById(id);
}
}

View File

@ -89,8 +89,11 @@ public class ShareQueryService extends QueryService<Share> {
if (criteria.getId() != null) {
specification = specification.and(buildSpecification(criteria.getId(), Share_.id));
}
if (criteria.getDate() != null) {
specification = specification.and(buildRangeSpecification(criteria.getDate(), Share_.date));
if (criteria.getDocumentDate() != null) {
specification = specification.and(buildRangeSpecification(criteria.getDocumentDate(), Share_.documentDate));
}
if (criteria.getValueDate() != null) {
specification = specification.and(buildRangeSpecification(criteria.getValueDate(), Share_.valueDate));
}
if (criteria.getAction() != null) {
specification = specification.and(buildSpecification(criteria.getAction(), Share_.action));
@ -98,12 +101,12 @@ public class ShareQueryService extends QueryService<Share> {
if (criteria.getQuantity() != null) {
specification = specification.and(buildRangeSpecification(criteria.getQuantity(), Share_.quantity));
}
if (criteria.getComment() != null) {
specification = specification.and(buildStringSpecification(criteria.getComment(), Share_.comment));
if (criteria.getRemark() != null) {
specification = specification.and(buildStringSpecification(criteria.getRemark(), Share_.remark));
}
if (criteria.getMemberId() != null) {
specification = specification.and(buildSpecification(criteria.getMemberId(),
root -> root.join(Share_.member, JoinType.LEFT).get(Membership_.id)));
if (criteria.getMembershipId() != null) {
specification = specification.and(buildSpecification(criteria.getMembershipId(),
root -> root.join(Share_.membership, JoinType.LEFT).get(Membership_.id)));
}
}
return specification;

View File

@ -32,15 +32,17 @@ public class AssetCriteria implements Serializable {
private LongFilter id;
private LocalDateFilter date;
private LocalDateFilter documentDate;
private LocalDateFilter valueDate;
private AssetActionFilter action;
private BigDecimalFilter amount;
private StringFilter comment;
private StringFilter remark;
private LongFilter memberId;
private LongFilter membershipId;
public LongFilter getId() {
return id;
@ -50,12 +52,20 @@ public class AssetCriteria implements Serializable {
this.id = id;
}
public LocalDateFilter getDate() {
return date;
public LocalDateFilter getDocumentDate() {
return documentDate;
}
public void setDate(LocalDateFilter date) {
this.date = date;
public void setDocumentDate(LocalDateFilter documentDate) {
this.documentDate = documentDate;
}
public LocalDateFilter getValueDate() {
return valueDate;
}
public void setValueDate(LocalDateFilter valueDate) {
this.valueDate = valueDate;
}
public AssetActionFilter getAction() {
@ -74,20 +84,20 @@ public class AssetCriteria implements Serializable {
this.amount = amount;
}
public StringFilter getComment() {
return comment;
public StringFilter getRemark() {
return remark;
}
public void setComment(StringFilter comment) {
this.comment = comment;
public void setRemark(StringFilter remark) {
this.remark = remark;
}
public LongFilter getMemberId() {
return memberId;
public LongFilter getMembershipId() {
return membershipId;
}
public void setMemberId(LongFilter memberId) {
this.memberId = memberId;
public void setMembershipId(LongFilter membershipId) {
this.membershipId = membershipId;
}
@ -102,22 +112,24 @@ public class AssetCriteria implements Serializable {
final AssetCriteria that = (AssetCriteria) o;
return
Objects.equals(id, that.id) &&
Objects.equals(date, that.date) &&
Objects.equals(documentDate, that.documentDate) &&
Objects.equals(valueDate, that.valueDate) &&
Objects.equals(action, that.action) &&
Objects.equals(amount, that.amount) &&
Objects.equals(comment, that.comment) &&
Objects.equals(memberId, that.memberId);
Objects.equals(remark, that.remark) &&
Objects.equals(membershipId, that.membershipId);
}
@Override
public int hashCode() {
return Objects.hash(
id,
date,
documentDate,
valueDate,
action,
amount,
comment,
memberId
remark,
membershipId
);
}
@ -125,11 +137,12 @@ public class AssetCriteria implements Serializable {
public String toString() {
return "AssetCriteria{" +
(id != null ? "id=" + id + ", " : "") +
(date != null ? "date=" + date + ", " : "") +
(documentDate != null ? "documentDate=" + documentDate + ", " : "") +
(valueDate != null ? "valueDate=" + valueDate + ", " : "") +
(action != null ? "action=" + action + ", " : "") +
(amount != null ? "amount=" + amount + ", " : "") +
(comment != null ? "comment=" + comment + ", " : "") +
(memberId != null ? "memberId=" + memberId + ", " : "") +
(remark != null ? "remark=" + remark + ", " : "") +
(membershipId != null ? "membershipId=" + membershipId + ", " : "") +
"}";
}

View File

@ -14,7 +14,10 @@ public class AssetDTO implements Serializable {
private Long id;
@NotNull
private LocalDate date;
private LocalDate documentDate;
@NotNull
private LocalDate valueDate;
@NotNull
private AssetAction action;
@ -23,10 +26,12 @@ public class AssetDTO implements Serializable {
private BigDecimal amount;
@Size(max = 160)
private String comment;
private String remark;
private Long memberId;
private Long membershipId;
private String membershipDocumentDate;
public Long getId() {
return id;
@ -36,12 +41,20 @@ public class AssetDTO implements Serializable {
this.id = id;
}
public LocalDate getDate() {
return date;
public LocalDate getDocumentDate() {
return documentDate;
}
public void setDate(LocalDate date) {
this.date = date;
public void setDocumentDate(LocalDate documentDate) {
this.documentDate = documentDate;
}
public LocalDate getValueDate() {
return valueDate;
}
public void setValueDate(LocalDate valueDate) {
this.valueDate = valueDate;
}
public AssetAction getAction() {
@ -60,20 +73,28 @@ public class AssetDTO implements Serializable {
this.amount = amount;
}
public String getComment() {
return comment;
public String getRemark() {
return remark;
}
public void setComment(String comment) {
this.comment = comment;
public void setRemark(String remark) {
this.remark = remark;
}
public Long getMemberId() {
return memberId;
public Long getMembershipId() {
return membershipId;
}
public void setMemberId(Long membershipId) {
this.memberId = membershipId;
public void setMembershipId(Long membershipId) {
this.membershipId = membershipId;
}
public String getMembershipDocumentDate() {
return membershipDocumentDate;
}
public void setMembershipDocumentDate(String membershipDocumentDate) {
this.membershipDocumentDate = membershipDocumentDate;
}
@Override
@ -101,11 +122,13 @@ public class AssetDTO implements Serializable {
public String toString() {
return "AssetDTO{" +
"id=" + getId() +
", date='" + getDate() + "'" +
", documentDate='" + getDocumentDate() + "'" +
", valueDate='" + getValueDate() + "'" +
", action='" + getAction() + "'" +
", amount=" + getAmount() +
", comment='" + getComment() + "'" +
", member=" + getMemberId() +
", remark='" + getRemark() + "'" +
", membership=" + getMembershipId() +
", membership='" + getMembershipDocumentDate() + "'" +
"}";
}
}

View File

@ -1,12 +1,14 @@
package org.hostsharing.hsadminng.service.dto;
import io.github.jhipster.service.filter.Filter;
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;
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;
/**
* Criteria class for the Customer entity. This class is used in CustomerResource to
@ -22,24 +24,26 @@ public class CustomerCriteria implements Serializable {
private LongFilter id;
private IntegerFilter number;
private IntegerFilter reference;
private StringFilter prefix;
private StringFilter name;
private StringFilter contractualAddress;
private StringFilter contractualSalutation;
private StringFilter billingAddress;
private StringFilter contractualAddress;
private StringFilter billingSalutation;
private LongFilter roleId;
private StringFilter billingAddress;
private StringFilter remark;
private LongFilter membershipId;
private LongFilter sepamandateId;
public LongFilter getId() {
return id;
}
@ -48,12 +52,12 @@ public class CustomerCriteria implements Serializable {
this.id = id;
}
public IntegerFilter getNumber() {
return number;
public IntegerFilter getReference() {
return reference;
}
public void setNumber(IntegerFilter number) {
this.number = number;
public void setReference(IntegerFilter reference) {
this.reference = reference;
}
public StringFilter getPrefix() {
@ -72,14 +76,6 @@ public class CustomerCriteria implements Serializable {
this.name = name;
}
public StringFilter getContractualAddress() {
return contractualAddress;
}
public void setContractualAddress(StringFilter contractualAddress) {
this.contractualAddress = contractualAddress;
}
public StringFilter getContractualSalutation() {
return contractualSalutation;
}
@ -88,12 +84,12 @@ public class CustomerCriteria implements Serializable {
this.contractualSalutation = contractualSalutation;
}
public StringFilter getBillingAddress() {
return billingAddress;
public StringFilter getContractualAddress() {
return contractualAddress;
}
public void setBillingAddress(StringFilter billingAddress) {
this.billingAddress = billingAddress;
public void setContractualAddress(StringFilter contractualAddress) {
this.contractualAddress = contractualAddress;
}
public StringFilter getBillingSalutation() {
@ -104,12 +100,20 @@ public class CustomerCriteria implements Serializable {
this.billingSalutation = billingSalutation;
}
public LongFilter getRoleId() {
return roleId;
public StringFilter getBillingAddress() {
return billingAddress;
}
public void setRoleId(LongFilter roleId) {
this.roleId = roleId;
public void setBillingAddress(StringFilter billingAddress) {
this.billingAddress = billingAddress;
}
public StringFilter getRemark() {
return remark;
}
public void setRemark(StringFilter remark) {
this.remark = remark;
}
public LongFilter getMembershipId() {
@ -120,6 +124,14 @@ public class CustomerCriteria implements Serializable {
this.membershipId = membershipId;
}
public LongFilter getSepamandateId() {
return sepamandateId;
}
public void setSepamandateId(LongFilter sepamandateId) {
this.sepamandateId = sepamandateId;
}
@Override
public boolean equals(Object o) {
@ -132,30 +144,32 @@ public class CustomerCriteria implements Serializable {
final CustomerCriteria that = (CustomerCriteria) o;
return
Objects.equals(id, that.id) &&
Objects.equals(number, that.number) &&
Objects.equals(reference, that.reference) &&
Objects.equals(prefix, that.prefix) &&
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);
Objects.equals(name, that.name) &&
Objects.equals(contractualSalutation, that.contractualSalutation) &&
Objects.equals(contractualAddress, that.contractualAddress) &&
Objects.equals(billingSalutation, that.billingSalutation) &&
Objects.equals(billingAddress, that.billingAddress) &&
Objects.equals(remark, that.remark) &&
Objects.equals(membershipId, that.membershipId) &&
Objects.equals(sepamandateId, that.sepamandateId);
}
@Override
public int hashCode() {
return Objects.hash(
id,
number,
reference,
prefix,
name,
contractualAddress,
contractualSalutation,
billingAddress,
billingSalutation,
roleId,
membershipId
name,
contractualSalutation,
contractualAddress,
billingSalutation,
billingAddress,
remark,
membershipId,
sepamandateId
);
}
@ -163,15 +177,16 @@ public class CustomerCriteria implements Serializable {
public String toString() {
return "CustomerCriteria{" +
(id != null ? "id=" + id + ", " : "") +
(number != null ? "number=" + number + ", " : "") +
(reference != null ? "reference=" + reference + ", " : "") +
(prefix != null ? "prefix=" + prefix + ", " : "") +
(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 + ", " : "") +
(name != null ? "name=" + name + ", " : "") +
(contractualSalutation != null ? "contractualSalutation=" + contractualSalutation + ", " : "") +
(contractualAddress != null ? "contractualAddress=" + contractualAddress + ", " : "") +
(billingSalutation != null ? "billingSalutation=" + billingSalutation + ", " : "") +
(billingAddress != null ? "billingAddress=" + billingAddress + ", " : "") +
(remark != null ? "remark=" + remark + ", " : "") +
(membershipId != null ? "membershipId=" + membershipId + ", " : "") +
(sepamandateId != null ? "sepamandateId=" + sepamandateId + ", " : "") +
"}";
}

View File

@ -13,9 +13,10 @@ public class CustomerDTO implements Serializable {
@NotNull
@Min(value = 10000)
@Max(value = 99999)
private Integer number;
private Integer reference;
@NotNull
@Size(max = 3)
@Pattern(regexp = "[a-z][a-z0-9]+")
private String prefix;
@ -23,18 +24,21 @@ public class CustomerDTO implements Serializable {
@Size(max = 80)
private String name;
@Size(max = 80)
private String contractualSalutation;
@NotNull
@Size(max = 400)
private String contractualAddress;
@Size(max = 80)
private String contractualSalutation;
private String billingSalutation;
@Size(max = 400)
private String billingAddress;
@Size(max = 80)
private String billingSalutation;
@Size(max = 160)
private String remark;
public Long getId() {
@ -45,12 +49,12 @@ public class CustomerDTO implements Serializable {
this.id = id;
}
public Integer getNumber() {
return number;
public Integer getReference() {
return reference;
}
public void setNumber(Integer number) {
this.number = number;
public void setReference(Integer reference) {
this.reference = reference;
}
public String getPrefix() {
@ -69,6 +73,14 @@ public class CustomerDTO implements Serializable {
this.name = name;
}
public String getContractualSalutation() {
return contractualSalutation;
}
public void setContractualSalutation(String contractualSalutation) {
this.contractualSalutation = contractualSalutation;
}
public String getContractualAddress() {
return contractualAddress;
}
@ -77,12 +89,12 @@ public class CustomerDTO implements Serializable {
this.contractualAddress = contractualAddress;
}
public String getContractualSalutation() {
return contractualSalutation;
public String getBillingSalutation() {
return billingSalutation;
}
public void setContractualSalutation(String contractualSalutation) {
this.contractualSalutation = contractualSalutation;
public void setBillingSalutation(String billingSalutation) {
this.billingSalutation = billingSalutation;
}
public String getBillingAddress() {
@ -93,12 +105,12 @@ public class CustomerDTO implements Serializable {
this.billingAddress = billingAddress;
}
public String getBillingSalutation() {
return billingSalutation;
public String getRemark() {
return remark;
}
public void setBillingSalutation(String billingSalutation) {
this.billingSalutation = billingSalutation;
public void setRemark(String remark) {
this.remark = remark;
}
@Override
@ -126,13 +138,14 @@ public class CustomerDTO implements Serializable {
public String toString() {
return "CustomerDTO{" +
"id=" + getId() +
", number=" + getNumber() +
", reference=" + getReference() +
", prefix='" + getPrefix() + "'" +
", name='" + getName() + "'" +
", contractualAddress='" + getContractualAddress() + "'" +
", contractualSalutation='" + getContractualSalutation() + "'" +
", billingAddress='" + getBillingAddress() + "'" +
", contractualAddress='" + getContractualAddress() + "'" +
", billingSalutation='" + getBillingSalutation() + "'" +
", billingAddress='" + getBillingAddress() + "'" +
", remark='" + getRemark() + "'" +
"}";
}
}

View File

@ -25,9 +25,13 @@ public class MembershipCriteria implements Serializable {
private LongFilter id;
private LocalDateFilter sinceDate;
private LocalDateFilter documentDate;
private LocalDateFilter untilDate;
private LocalDateFilter memberFrom;
private LocalDateFilter memberUntil;
private StringFilter remark;
private LongFilter shareId;
@ -43,20 +47,36 @@ public class MembershipCriteria implements Serializable {
this.id = id;
}
public LocalDateFilter getSinceDate() {
return sinceDate;
public LocalDateFilter getDocumentDate() {
return documentDate;
}
public void setSinceDate(LocalDateFilter sinceDate) {
this.sinceDate = sinceDate;
public void setDocumentDate(LocalDateFilter documentDate) {
this.documentDate = documentDate;
}
public LocalDateFilter getUntilDate() {
return untilDate;
public LocalDateFilter getMemberFrom() {
return memberFrom;
}
public void setUntilDate(LocalDateFilter untilDate) {
this.untilDate = untilDate;
public void setMemberFrom(LocalDateFilter memberFrom) {
this.memberFrom = memberFrom;
}
public LocalDateFilter getMemberUntil() {
return memberUntil;
}
public void setMemberUntil(LocalDateFilter memberUntil) {
this.memberUntil = memberUntil;
}
public StringFilter getRemark() {
return remark;
}
public void setRemark(StringFilter remark) {
this.remark = remark;
}
public LongFilter getShareId() {
@ -95,8 +115,10 @@ public class MembershipCriteria implements Serializable {
final MembershipCriteria that = (MembershipCriteria) o;
return
Objects.equals(id, that.id) &&
Objects.equals(sinceDate, that.sinceDate) &&
Objects.equals(untilDate, that.untilDate) &&
Objects.equals(documentDate, that.documentDate) &&
Objects.equals(memberFrom, that.memberFrom) &&
Objects.equals(memberUntil, that.memberUntil) &&
Objects.equals(remark, that.remark) &&
Objects.equals(shareId, that.shareId) &&
Objects.equals(assetId, that.assetId) &&
Objects.equals(customerId, that.customerId);
@ -106,8 +128,10 @@ public class MembershipCriteria implements Serializable {
public int hashCode() {
return Objects.hash(
id,
sinceDate,
untilDate,
documentDate,
memberFrom,
memberUntil,
remark,
shareId,
assetId,
customerId
@ -118,8 +142,10 @@ public class MembershipCriteria implements Serializable {
public String toString() {
return "MembershipCriteria{" +
(id != null ? "id=" + id + ", " : "") +
(sinceDate != null ? "sinceDate=" + sinceDate + ", " : "") +
(untilDate != null ? "untilDate=" + untilDate + ", " : "") +
(documentDate != null ? "documentDate=" + documentDate + ", " : "") +
(memberFrom != null ? "memberFrom=" + memberFrom + ", " : "") +
(memberUntil != null ? "memberUntil=" + memberUntil + ", " : "") +
(remark != null ? "remark=" + remark + ", " : "") +
(shareId != null ? "shareId=" + shareId + ", " : "") +
(assetId != null ? "assetId=" + assetId + ", " : "") +
(customerId != null ? "customerId=" + customerId + ", " : "") +

View File

@ -12,9 +12,15 @@ public class MembershipDTO implements Serializable {
private Long id;
@NotNull
private LocalDate sinceDate;
private LocalDate documentDate;
private LocalDate untilDate;
@NotNull
private LocalDate memberFrom;
private LocalDate memberUntil;
@Size(max = 160)
private String remark;
private Long customerId;
@ -29,20 +35,36 @@ public class MembershipDTO implements Serializable {
this.id = id;
}
public LocalDate getSinceDate() {
return sinceDate;
public LocalDate getDocumentDate() {
return documentDate;
}
public void setSinceDate(LocalDate sinceDate) {
this.sinceDate = sinceDate;
public void setDocumentDate(LocalDate documentDate) {
this.documentDate = documentDate;
}
public LocalDate getUntilDate() {
return untilDate;
public LocalDate getMemberFrom() {
return memberFrom;
}
public void setUntilDate(LocalDate untilDate) {
this.untilDate = untilDate;
public void setMemberFrom(LocalDate memberFrom) {
this.memberFrom = memberFrom;
}
public LocalDate getMemberUntil() {
return memberUntil;
}
public void setMemberUntil(LocalDate memberUntil) {
this.memberUntil = memberUntil;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Long getCustomerId() {
@ -86,8 +108,10 @@ public class MembershipDTO implements Serializable {
public String toString() {
return "MembershipDTO{" +
"id=" + getId() +
", sinceDate='" + getSinceDate() + "'" +
", untilDate='" + getUntilDate() + "'" +
", documentDate='" + getDocumentDate() + "'" +
", memberFrom='" + getMemberFrom() + "'" +
", memberUntil='" + getMemberUntil() + "'" +
", remark='" + getRemark() + "'" +
", customer=" + getCustomerId() +
", customer='" + getCustomerPrefix() + "'" +
"}";

View File

@ -0,0 +1,194 @@
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 io.github.jhipster.service.filter.LocalDateFilter;
/**
* Criteria class for the SepaMandate entity. This class is used in SepaMandateResource to
* receive all the possible filtering options from the Http GET request parameters.
* For example the following could be a valid requests:
* <code> /sepa-mandates?id.greaterThan=5&amp;attr1.contains=something&amp;attr2.specified=false</code>
* As Spring is unable to properly convert the types, unless specific {@link Filter} class are used, we need to use
* fix type specific filters.
*/
public class SepaMandateCriteria implements Serializable {
private static final long serialVersionUID = 1L;
private LongFilter id;
private StringFilter reference;
private StringFilter iban;
private StringFilter bic;
private LocalDateFilter documentDate;
private LocalDateFilter validFrom;
private LocalDateFilter validUntil;
private LocalDateFilter lastUsed;
private LocalDateFilter cancellationDate;
private StringFilter remark;
private LongFilter customerId;
public LongFilter getId() {
return id;
}
public void setId(LongFilter id) {
this.id = id;
}
public StringFilter getReference() {
return reference;
}
public void setReference(StringFilter reference) {
this.reference = reference;
}
public StringFilter getIban() {
return iban;
}
public void setIban(StringFilter iban) {
this.iban = iban;
}
public StringFilter getBic() {
return bic;
}
public void setBic(StringFilter bic) {
this.bic = bic;
}
public LocalDateFilter getDocumentDate() {
return documentDate;
}
public void setDocumentDate(LocalDateFilter documentDate) {
this.documentDate = documentDate;
}
public LocalDateFilter getValidFrom() {
return validFrom;
}
public void setValidFrom(LocalDateFilter validFrom) {
this.validFrom = validFrom;
}
public LocalDateFilter getValidUntil() {
return validUntil;
}
public void setValidUntil(LocalDateFilter validUntil) {
this.validUntil = validUntil;
}
public LocalDateFilter getLastUsed() {
return lastUsed;
}
public void setLastUsed(LocalDateFilter lastUsed) {
this.lastUsed = lastUsed;
}
public LocalDateFilter getCancellationDate() {
return cancellationDate;
}
public void setCancellationDate(LocalDateFilter cancellationDate) {
this.cancellationDate = cancellationDate;
}
public StringFilter getRemark() {
return remark;
}
public void setRemark(StringFilter remark) {
this.remark = remark;
}
public LongFilter getCustomerId() {
return customerId;
}
public void setCustomerId(LongFilter customerId) {
this.customerId = customerId;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final SepaMandateCriteria that = (SepaMandateCriteria) o;
return
Objects.equals(id, that.id) &&
Objects.equals(reference, that.reference) &&
Objects.equals(iban, that.iban) &&
Objects.equals(bic, that.bic) &&
Objects.equals(documentDate, that.documentDate) &&
Objects.equals(validFrom, that.validFrom) &&
Objects.equals(validUntil, that.validUntil) &&
Objects.equals(lastUsed, that.lastUsed) &&
Objects.equals(cancellationDate, that.cancellationDate) &&
Objects.equals(remark, that.remark) &&
Objects.equals(customerId, that.customerId);
}
@Override
public int hashCode() {
return Objects.hash(
id,
reference,
iban,
bic,
documentDate,
validFrom,
validUntil,
lastUsed,
cancellationDate,
remark,
customerId
);
}
@Override
public String toString() {
return "SepaMandateCriteria{" +
(id != null ? "id=" + id + ", " : "") +
(reference != null ? "reference=" + reference + ", " : "") +
(iban != null ? "iban=" + iban + ", " : "") +
(bic != null ? "bic=" + bic + ", " : "") +
(documentDate != null ? "documentDate=" + documentDate + ", " : "") +
(validFrom != null ? "validFrom=" + validFrom + ", " : "") +
(validUntil != null ? "validUntil=" + validUntil + ", " : "") +
(lastUsed != null ? "lastUsed=" + lastUsed + ", " : "") +
(cancellationDate != null ? "cancellationDate=" + cancellationDate + ", " : "") +
(remark != null ? "remark=" + remark + ", " : "") +
(customerId != null ? "customerId=" + customerId + ", " : "") +
"}";
}
}

View File

@ -0,0 +1,178 @@
package org.hostsharing.hsadminng.service.dto;
import java.time.LocalDate;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.Objects;
/**
* A DTO for the SepaMandate entity.
*/
public class SepaMandateDTO implements Serializable {
private Long id;
@NotNull
@Size(max = 40)
private String reference;
@Size(max = 34)
private String iban;
@Size(max = 11)
private String bic;
@NotNull
private LocalDate documentDate;
@NotNull
private LocalDate validFrom;
private LocalDate validUntil;
private LocalDate lastUsed;
private LocalDate cancellationDate;
@Size(max = 160)
private String remark;
private Long customerId;
private String customerPrefix;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
public String getIban() {
return iban;
}
public void setIban(String iban) {
this.iban = iban;
}
public String getBic() {
return bic;
}
public void setBic(String bic) {
this.bic = bic;
}
public LocalDate getDocumentDate() {
return documentDate;
}
public void setDocumentDate(LocalDate documentDate) {
this.documentDate = documentDate;
}
public LocalDate getValidFrom() {
return validFrom;
}
public void setValidFrom(LocalDate validFrom) {
this.validFrom = validFrom;
}
public LocalDate getValidUntil() {
return validUntil;
}
public void setValidUntil(LocalDate validUntil) {
this.validUntil = validUntil;
}
public LocalDate getLastUsed() {
return lastUsed;
}
public void setLastUsed(LocalDate lastUsed) {
this.lastUsed = lastUsed;
}
public LocalDate getCancellationDate() {
return cancellationDate;
}
public void setCancellationDate(LocalDate cancellationDate) {
this.cancellationDate = cancellationDate;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Long getCustomerId() {
return customerId;
}
public void setCustomerId(Long customerId) {
this.customerId = customerId;
}
public String getCustomerPrefix() {
return customerPrefix;
}
public void setCustomerPrefix(String customerPrefix) {
this.customerPrefix = customerPrefix;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SepaMandateDTO sepaMandateDTO = (SepaMandateDTO) o;
if (sepaMandateDTO.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), sepaMandateDTO.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "SepaMandateDTO{" +
"id=" + getId() +
", reference='" + getReference() + "'" +
", iban='" + getIban() + "'" +
", bic='" + getBic() + "'" +
", documentDate='" + getDocumentDate() + "'" +
", validFrom='" + getValidFrom() + "'" +
", validUntil='" + getValidUntil() + "'" +
", lastUsed='" + getLastUsed() + "'" +
", cancellationDate='" + getCancellationDate() + "'" +
", remark='" + getRemark() + "'" +
", customer=" + getCustomerId() +
", customer='" + getCustomerPrefix() + "'" +
"}";
}
}

View File

@ -31,15 +31,17 @@ public class ShareCriteria implements Serializable {
private LongFilter id;
private LocalDateFilter date;
private LocalDateFilter documentDate;
private LocalDateFilter valueDate;
private ShareActionFilter action;
private IntegerFilter quantity;
private StringFilter comment;
private StringFilter remark;
private LongFilter memberId;
private LongFilter membershipId;
public LongFilter getId() {
return id;
@ -49,12 +51,20 @@ public class ShareCriteria implements Serializable {
this.id = id;
}
public LocalDateFilter getDate() {
return date;
public LocalDateFilter getDocumentDate() {
return documentDate;
}
public void setDate(LocalDateFilter date) {
this.date = date;
public void setDocumentDate(LocalDateFilter documentDate) {
this.documentDate = documentDate;
}
public LocalDateFilter getValueDate() {
return valueDate;
}
public void setValueDate(LocalDateFilter valueDate) {
this.valueDate = valueDate;
}
public ShareActionFilter getAction() {
@ -73,20 +83,20 @@ public class ShareCriteria implements Serializable {
this.quantity = quantity;
}
public StringFilter getComment() {
return comment;
public StringFilter getRemark() {
return remark;
}
public void setComment(StringFilter comment) {
this.comment = comment;
public void setRemark(StringFilter remark) {
this.remark = remark;
}
public LongFilter getMemberId() {
return memberId;
public LongFilter getMembershipId() {
return membershipId;
}
public void setMemberId(LongFilter memberId) {
this.memberId = memberId;
public void setMembershipId(LongFilter membershipId) {
this.membershipId = membershipId;
}
@ -101,22 +111,24 @@ public class ShareCriteria implements Serializable {
final ShareCriteria that = (ShareCriteria) o;
return
Objects.equals(id, that.id) &&
Objects.equals(date, that.date) &&
Objects.equals(documentDate, that.documentDate) &&
Objects.equals(valueDate, that.valueDate) &&
Objects.equals(action, that.action) &&
Objects.equals(quantity, that.quantity) &&
Objects.equals(comment, that.comment) &&
Objects.equals(memberId, that.memberId);
Objects.equals(remark, that.remark) &&
Objects.equals(membershipId, that.membershipId);
}
@Override
public int hashCode() {
return Objects.hash(
id,
date,
documentDate,
valueDate,
action,
quantity,
comment,
memberId
remark,
membershipId
);
}
@ -124,11 +136,12 @@ public class ShareCriteria implements Serializable {
public String toString() {
return "ShareCriteria{" +
(id != null ? "id=" + id + ", " : "") +
(date != null ? "date=" + date + ", " : "") +
(documentDate != null ? "documentDate=" + documentDate + ", " : "") +
(valueDate != null ? "valueDate=" + valueDate + ", " : "") +
(action != null ? "action=" + action + ", " : "") +
(quantity != null ? "quantity=" + quantity + ", " : "") +
(comment != null ? "comment=" + comment + ", " : "") +
(memberId != null ? "memberId=" + memberId + ", " : "") +
(remark != null ? "remark=" + remark + ", " : "") +
(membershipId != null ? "membershipId=" + membershipId + ", " : "") +
"}";
}

View File

@ -13,7 +13,10 @@ public class ShareDTO implements Serializable {
private Long id;
@NotNull
private LocalDate date;
private LocalDate documentDate;
@NotNull
private LocalDate valueDate;
@NotNull
private ShareAction action;
@ -22,10 +25,12 @@ public class ShareDTO implements Serializable {
private Integer quantity;
@Size(max = 160)
private String comment;
private String remark;
private Long memberId;
private Long membershipId;
private String membershipDocumentDate;
public Long getId() {
return id;
@ -35,12 +40,20 @@ public class ShareDTO implements Serializable {
this.id = id;
}
public LocalDate getDate() {
return date;
public LocalDate getDocumentDate() {
return documentDate;
}
public void setDate(LocalDate date) {
this.date = date;
public void setDocumentDate(LocalDate documentDate) {
this.documentDate = documentDate;
}
public LocalDate getValueDate() {
return valueDate;
}
public void setValueDate(LocalDate valueDate) {
this.valueDate = valueDate;
}
public ShareAction getAction() {
@ -59,20 +72,28 @@ public class ShareDTO implements Serializable {
this.quantity = quantity;
}
public String getComment() {
return comment;
public String getRemark() {
return remark;
}
public void setComment(String comment) {
this.comment = comment;
public void setRemark(String remark) {
this.remark = remark;
}
public Long getMemberId() {
return memberId;
public Long getMembershipId() {
return membershipId;
}
public void setMemberId(Long membershipId) {
this.memberId = membershipId;
public void setMembershipId(Long membershipId) {
this.membershipId = membershipId;
}
public String getMembershipDocumentDate() {
return membershipDocumentDate;
}
public void setMembershipDocumentDate(String membershipDocumentDate) {
this.membershipDocumentDate = membershipDocumentDate;
}
@Override
@ -100,11 +121,13 @@ public class ShareDTO implements Serializable {
public String toString() {
return "ShareDTO{" +
"id=" + getId() +
", date='" + getDate() + "'" +
", documentDate='" + getDocumentDate() + "'" +
", valueDate='" + getValueDate() + "'" +
", action='" + getAction() + "'" +
", quantity=" + getQuantity() +
", comment='" + getComment() + "'" +
", member=" + getMemberId() +
", remark='" + getRemark() + "'" +
", membership=" + getMembershipId() +
", membership='" + getMembershipDocumentDate() + "'" +
"}";
}
}

View File

@ -11,10 +11,11 @@ import org.mapstruct.*;
@Mapper(componentModel = "spring", uses = {MembershipMapper.class})
public interface AssetMapper extends EntityMapper<AssetDTO, Asset> {
@Mapping(source = "member.id", target = "memberId")
@Mapping(source = "membership.id", target = "membershipId")
@Mapping(source = "membership.documentDate", target = "membershipDocumentDate")
AssetDTO toDto(Asset asset);
@Mapping(source = "memberId", target = "member")
@Mapping(source = "membershipId", target = "membership")
Asset toEntity(AssetDTO assetDTO);
default Asset fromId(Long id) {

View File

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

View File

@ -0,0 +1,29 @@
package org.hostsharing.hsadminng.service.mapper;
import org.hostsharing.hsadminng.domain.*;
import org.hostsharing.hsadminng.service.dto.SepaMandateDTO;
import org.mapstruct.*;
/**
* Mapper for the entity SepaMandate and its DTO SepaMandateDTO.
*/
@Mapper(componentModel = "spring", uses = {CustomerMapper.class})
public interface SepaMandateMapper extends EntityMapper<SepaMandateDTO, SepaMandate> {
@Mapping(source = "customer.id", target = "customerId")
@Mapping(source = "customer.prefix", target = "customerPrefix")
SepaMandateDTO toDto(SepaMandate sepaMandate);
@Mapping(source = "customerId", target = "customer")
SepaMandate toEntity(SepaMandateDTO sepaMandateDTO);
default SepaMandate fromId(Long id) {
if (id == null) {
return null;
}
SepaMandate sepaMandate = new SepaMandate();
sepaMandate.setId(id);
return sepaMandate;
}
}

View File

@ -11,10 +11,11 @@ import org.mapstruct.*;
@Mapper(componentModel = "spring", uses = {MembershipMapper.class})
public interface ShareMapper extends EntityMapper<ShareDTO, Share> {
@Mapping(source = "member.id", target = "memberId")
@Mapping(source = "membership.id", target = "membershipId")
@Mapping(source = "membership.documentDate", target = "membershipDocumentDate")
ShareDTO toDto(Share share);
@Mapping(source = "memberId", target = "member")
@Mapping(source = "membershipId", target = "membership")
Share toEntity(ShareDTO shareDTO);
default Share fromId(Long id) {

View File

@ -0,0 +1,138 @@
package org.hostsharing.hsadminng.web.rest;
import org.hostsharing.hsadminng.service.SepaMandateService;
import org.hostsharing.hsadminng.web.rest.errors.BadRequestAlertException;
import org.hostsharing.hsadminng.web.rest.util.HeaderUtil;
import org.hostsharing.hsadminng.web.rest.util.PaginationUtil;
import org.hostsharing.hsadminng.service.dto.SepaMandateDTO;
import org.hostsharing.hsadminng.service.dto.SepaMandateCriteria;
import org.hostsharing.hsadminng.service.SepaMandateQueryService;
import io.github.jhipster.web.util.ResponseUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;
/**
* REST controller for managing SepaMandate.
*/
@RestController
@RequestMapping("/api")
public class SepaMandateResource {
private final Logger log = LoggerFactory.getLogger(SepaMandateResource.class);
private static final String ENTITY_NAME = "sepaMandate";
private final SepaMandateService sepaMandateService;
private final SepaMandateQueryService sepaMandateQueryService;
public SepaMandateResource(SepaMandateService sepaMandateService, SepaMandateQueryService sepaMandateQueryService) {
this.sepaMandateService = sepaMandateService;
this.sepaMandateQueryService = sepaMandateQueryService;
}
/**
* POST /sepa-mandates : Create a new sepaMandate.
*
* @param sepaMandateDTO the sepaMandateDTO to create
* @return the ResponseEntity with status 201 (Created) and with body the new sepaMandateDTO, or with status 400 (Bad Request) if the sepaMandate has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/sepa-mandates")
public ResponseEntity<SepaMandateDTO> createSepaMandate(@Valid @RequestBody SepaMandateDTO sepaMandateDTO) throws URISyntaxException {
log.debug("REST request to save SepaMandate : {}", sepaMandateDTO);
if (sepaMandateDTO.getId() != null) {
throw new BadRequestAlertException("A new sepaMandate cannot already have an ID", ENTITY_NAME, "idexists");
}
SepaMandateDTO result = sepaMandateService.save(sepaMandateDTO);
return ResponseEntity.created(new URI("/api/sepa-mandates/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
.body(result);
}
/**
* PUT /sepa-mandates : Updates an existing sepaMandate.
*
* @param sepaMandateDTO the sepaMandateDTO to update
* @return the ResponseEntity with status 200 (OK) and with body the updated sepaMandateDTO,
* or with status 400 (Bad Request) if the sepaMandateDTO is not valid,
* or with status 500 (Internal Server Error) if the sepaMandateDTO couldn't be updated
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PutMapping("/sepa-mandates")
public ResponseEntity<SepaMandateDTO> updateSepaMandate(@Valid @RequestBody SepaMandateDTO sepaMandateDTO) throws URISyntaxException {
log.debug("REST request to update SepaMandate : {}", sepaMandateDTO);
if (sepaMandateDTO.getId() == null) {
throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
}
SepaMandateDTO result = sepaMandateService.save(sepaMandateDTO);
return ResponseEntity.ok()
.headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, sepaMandateDTO.getId().toString()))
.body(result);
}
/**
* GET /sepa-mandates : get all the sepaMandates.
*
* @param pageable the pagination information
* @param criteria the criterias which the requested entities should match
* @return the ResponseEntity with status 200 (OK) and the list of sepaMandates in body
*/
@GetMapping("/sepa-mandates")
public ResponseEntity<List<SepaMandateDTO>> getAllSepaMandates(SepaMandateCriteria criteria, Pageable pageable) {
log.debug("REST request to get SepaMandates by criteria: {}", criteria);
Page<SepaMandateDTO> page = sepaMandateQueryService.findByCriteria(criteria, pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/sepa-mandates");
return ResponseEntity.ok().headers(headers).body(page.getContent());
}
/**
* GET /sepa-mandates/count : count all the sepaMandates.
*
* @param criteria the criterias which the requested entities should match
* @return the ResponseEntity with status 200 (OK) and the count in body
*/
@GetMapping("/sepa-mandates/count")
public ResponseEntity<Long> countSepaMandates(SepaMandateCriteria criteria) {
log.debug("REST request to count SepaMandates by criteria: {}", criteria);
return ResponseEntity.ok().body(sepaMandateQueryService.countByCriteria(criteria));
}
/**
* GET /sepa-mandates/:id : get the "id" sepaMandate.
*
* @param id the id of the sepaMandateDTO to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the sepaMandateDTO, or with status 404 (Not Found)
*/
@GetMapping("/sepa-mandates/{id}")
public ResponseEntity<SepaMandateDTO> getSepaMandate(@PathVariable Long id) {
log.debug("REST request to get SepaMandate : {}", id);
Optional<SepaMandateDTO> sepaMandateDTO = sepaMandateService.findOne(id);
return ResponseUtil.wrapOrNotFound(sepaMandateDTO);
}
/**
* DELETE /sepa-mandates/:id : delete the "id" sepaMandate.
*
* @param id the id of the sepaMandateDTO to delete
* @return the ResponseEntity with status 200 (OK)
*/
@DeleteMapping("/sepa-mandates/{id}")
public ResponseEntity<Void> deleteSepaMandate(@PathVariable Long id) {
log.debug("REST request to delete SepaMandate : {}", id);
sepaMandateService.delete(id);
return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
}
}