1
0

Merge branch 'jhipster-generated'

This commit is contained in:
Michael Hierweck
2019-04-18 10:51:02 +02:00
170 changed files with 3970 additions and 5250 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.
*/
@ -46,7 +47,7 @@ public class Asset implements Serializable {
@NotNull
@ManyToOne(optional = false)
@JsonIgnoreProperties("assets")
private Membership member;
private Membership membership;
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() {
@ -109,17 +110,17 @@ public class Asset implements Serializable {
this.comment = comment;
}
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

View File

@ -1,148 +0,0 @@
package org.hostsharing.hsadminng.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import java.util.Objects;
/**
* A Contact.
*/
@Entity
@Table(name = "contact")
public class Contact implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
@SequenceGenerator(name = "sequenceGenerator")
private Long id;
@NotNull
@Size(max = 80)
@Column(name = "first_name", length = 80, nullable = false)
private String firstName;
@NotNull
@Size(max = 80)
@Column(name = "last_name", length = 80, nullable = false)
private String lastName;
@NotNull
@Size(max = 80)
@Column(name = "email", length = 80, nullable = false)
private String email;
@OneToMany(mappedBy = "contact")
private Set<CustomerContact> roles = new HashSet<>();
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getFirstName() {
return firstName;
}
public Contact firstName(String firstName) {
this.firstName = firstName;
return this;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public Contact lastName(String lastName) {
this.lastName = lastName;
return this;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getEmail() {
return email;
}
public Contact email(String email) {
this.email = email;
return this;
}
public void setEmail(String email) {
this.email = email;
}
public Set<CustomerContact> getRoles() {
return roles;
}
public Contact roles(Set<CustomerContact> customerContacts) {
this.roles = customerContacts;
return this;
}
public Contact addRole(CustomerContact customerContact) {
this.roles.add(customerContact);
customerContact.setContact(this);
return this;
}
public Contact removeRole(CustomerContact customerContact) {
this.roles.remove(customerContact);
customerContact.setContact(null);
return this;
}
public void setRoles(Set<CustomerContact> customerContacts) {
this.roles = customerContacts;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Contact contact = (Contact) o;
if (contact.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), contact.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "Contact{" +
"id=" + getId() +
", firstName='" + getFirstName() + "'" +
", lastName='" + getLastName() + "'" +
", email='" + getEmail() + "'" +
"}";
}
}

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.
@ -38,29 +41,29 @@ 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;
@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;
@ -109,19 +112,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;
}
@ -135,17 +125,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() {
@ -161,29 +151,17 @@ 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);
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 setBillingAddress(String billingAddress) {
this.billingAddress = billingAddress;
}
public Set<Membership> getMemberships() {
@ -210,6 +188,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
@ -239,10 +242,10 @@ public class Customer implements Serializable {
", number=" + getNumber() +
", prefix='" + getPrefix() + "'" +
", name='" + getName() + "'" +
", contractualAddress='" + getContractualAddress() + "'" +
", contractualSalutation='" + getContractualSalutation() + "'" +
", billingAddress='" + getBillingAddress() + "'" +
", contractualAddress='" + getContractualAddress() + "'" +
", billingSalutation='" + getBillingSalutation() + "'" +
", billingAddress='" + getBillingAddress() + "'" +
"}";
}
}

View File

@ -1,119 +0,0 @@
package org.hostsharing.hsadminng.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.Objects;
import org.hostsharing.hsadminng.domain.enumeration.CustomerContactRole;
/**
* A CustomerContact.
*/
@Entity
@Table(name = "customer_contact")
public class CustomerContact implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
@SequenceGenerator(name = "sequenceGenerator")
private Long id;
@NotNull
@Enumerated(EnumType.STRING)
@Column(name = "jhi_role", nullable = false)
private CustomerContactRole role;
@ManyToOne(optional = false)
@NotNull
@JsonIgnoreProperties("roles")
private Contact contact;
@ManyToOne(optional = false)
@NotNull
@JsonIgnoreProperties("roles")
private Customer customer;
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public CustomerContactRole getRole() {
return role;
}
public CustomerContact role(CustomerContactRole role) {
this.role = role;
return this;
}
public void setRole(CustomerContactRole role) {
this.role = role;
}
public Contact getContact() {
return contact;
}
public CustomerContact contact(Contact contact) {
this.contact = contact;
return this;
}
public void setContact(Contact contact) {
this.contact = contact;
}
public Customer getCustomer() {
return customer;
}
public CustomerContact customer(Customer customer) {
this.customer = customer;
return this;
}
public void setCustomer(Customer customer) {
this.customer = customer;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CustomerContact customerContact = (CustomerContact) o;
if (customerContact.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), customerContact.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "CustomerContact{" +
"id=" + getId() +
", role='" + getRole() + "'" +
"}";
}
}

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.
@ -28,20 +30,24 @@ public class Membership implements Serializable {
private Long id;
@NotNull
@Column(name = "since_date", nullable = false)
private LocalDate sinceDate;
@Column(name = "jhi_from", nullable = false)
private LocalDate from;
@Column(name = "until_date")
private LocalDate untilDate;
@Column(name = "jhi_to")
private LocalDate to;
@OneToMany(mappedBy = "member")
@Size(max = 160)
@Column(name = "jhi_comment", length = 160)
private String comment;
@OneToMany(mappedBy = "membership")
private Set<Share> shares = new HashSet<>();
@OneToMany(mappedBy = "member")
@OneToMany(mappedBy = "membership")
private Set<Asset> assets = new HashSet<>();
@NotNull
@ManyToOne(optional = false)
@NotNull
@JsonIgnoreProperties("memberships")
private Customer customer;
@ -54,30 +60,43 @@ public class Membership implements Serializable {
this.id = id;
}
public LocalDate getSinceDate() {
return sinceDate;
public LocalDate getFrom() {
return from;
}
public Membership sinceDate(LocalDate sinceDate) {
this.sinceDate = sinceDate;
public Membership from(LocalDate from) {
this.from = from;
return this;
}
public void setSinceDate(LocalDate sinceDate) {
this.sinceDate = sinceDate;
public void setFrom(LocalDate from) {
this.from = from;
}
public LocalDate getUntilDate() {
return untilDate;
public LocalDate getTo() {
return to;
}
public Membership untilDate(LocalDate untilDate) {
this.untilDate = untilDate;
public Membership to(LocalDate to) {
this.to = to;
return this;
}
public void setUntilDate(LocalDate untilDate) {
this.untilDate = untilDate;
public void setTo(LocalDate to) {
this.to = to;
}
public String getComment() {
return comment;
}
public Membership comment(String comment) {
this.comment = comment;
return this;
}
public void setComment(String comment) {
this.comment = comment;
}
public Set<Share> getShares() {
@ -91,13 +110,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;
}
@ -116,13 +135,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;
}
@ -168,8 +187,9 @@ public class Membership implements Serializable {
public String toString() {
return "Membership{" +
"id=" + getId() +
", sinceDate='" + getSinceDate() + "'" +
", untilDate='" + getUntilDate() + "'" +
", from='" + getFrom() + "'" +
", to='" + getTo() + "'" +
", comment='" + getComment() + "'" +
"}";
}
}

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 = "created", nullable = false)
private LocalDate created;
@NotNull
@Column(name = "valid_from", nullable = false)
private LocalDate validFrom;
@Column(name = "valid_to")
private LocalDate validTo;
@Column(name = "last_used")
private LocalDate lastUsed;
@Column(name = "cancelled")
private LocalDate cancelled;
@Size(max = 160)
@Column(name = "jhi_comment", length = 160)
private String comment;
@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 getCreated() {
return created;
}
public SepaMandate created(LocalDate created) {
this.created = created;
return this;
}
public void setCreated(LocalDate created) {
this.created = created;
}
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 getValidTo() {
return validTo;
}
public SepaMandate validTo(LocalDate validTo) {
this.validTo = validTo;
return this;
}
public void setValidTo(LocalDate validTo) {
this.validTo = validTo;
}
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 getCancelled() {
return cancelled;
}
public SepaMandate cancelled(LocalDate cancelled) {
this.cancelled = cancelled;
return this;
}
public void setCancelled(LocalDate cancelled) {
this.cancelled = cancelled;
}
public String getComment() {
return comment;
}
public SepaMandate comment(String comment) {
this.comment = comment;
return this;
}
public void setComment(String comment) {
this.comment = comment;
}
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() + "'" +
", created='" + getCreated() + "'" +
", validFrom='" + getValidFrom() + "'" +
", validTo='" + getValidTo() + "'" +
", lastUsed='" + getLastUsed() + "'" +
", cancelled='" + getCancelled() + "'" +
", comment='" + getComment() + "'" +
"}";
}
}

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.
*/
@ -47,7 +48,7 @@ public class Share implements Serializable {
@NotNull
@ManyToOne(optional = false)
@JsonIgnoreProperties("shares")
private Membership member;
private Membership membership;
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() {
@ -110,17 +111,17 @@ public class Share implements Serializable {
this.comment = comment;
}
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

View File

@ -1,8 +0,0 @@
package org.hostsharing.hsadminng.domain.enumeration;
/**
* The CustomerContactRole enumeration.
*/
public enum CustomerContactRole {
CONTRACTUAL, TECHNICAL, FINANCIAL
}

View File

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

View File

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

View File

@ -16,6 +16,6 @@ import org.springframework.stereotype.Repository;
public interface MembershipRepository extends JpaRepository<Membership, Long>, JpaSpecificationExecutor<Membership> {
@Query("SELECT CASE WHEN COUNT(m)> 0 THEN TRUE ELSE FALSE END " +
" FROM Membership m WHERE m.customer.id=:customerId AND m.untilDate IS NULL")
" FROM Membership m WHERE m.customer.id=:customerId AND m.to IS NULL")
boolean hasUncancelledMembershipForCustomer(@Param("customerId") final long customerId);
}

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

@ -101,9 +101,9 @@ public class AssetQueryService extends QueryService<Asset> {
if (criteria.getComment() != null) {
specification = specification.and(buildStringSpecification(criteria.getComment(), Asset_.comment));
}
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,108 +0,0 @@
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.Contact;
import org.hostsharing.hsadminng.domain.*; // for static metamodels
import org.hostsharing.hsadminng.repository.ContactRepository;
import org.hostsharing.hsadminng.service.dto.ContactCriteria;
import org.hostsharing.hsadminng.service.dto.ContactDTO;
import org.hostsharing.hsadminng.service.mapper.ContactMapper;
/**
* Service for executing complex queries for Contact entities in the database.
* The main input is a {@link ContactCriteria} which gets converted to {@link Specification},
* in a way that all the filters must apply.
* It returns a {@link List} of {@link ContactDTO} or a {@link Page} of {@link ContactDTO} which fulfills the criteria.
*/
@Service
@Transactional(readOnly = true)
public class ContactQueryService extends QueryService<Contact> {
private final Logger log = LoggerFactory.getLogger(ContactQueryService.class);
private final ContactRepository contactRepository;
private final ContactMapper contactMapper;
public ContactQueryService(ContactRepository contactRepository, ContactMapper contactMapper) {
this.contactRepository = contactRepository;
this.contactMapper = contactMapper;
}
/**
* Return a {@link List} of {@link ContactDTO} 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<ContactDTO> findByCriteria(ContactCriteria criteria) {
log.debug("find by criteria : {}", criteria);
final Specification<Contact> specification = createSpecification(criteria);
return contactMapper.toDto(contactRepository.findAll(specification));
}
/**
* Return a {@link Page} of {@link ContactDTO} 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<ContactDTO> findByCriteria(ContactCriteria criteria, Pageable page) {
log.debug("find by criteria : {}, page: {}", criteria, page);
final Specification<Contact> specification = createSpecification(criteria);
return contactRepository.findAll(specification, page)
.map(contactMapper::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(ContactCriteria criteria) {
log.debug("count by criteria : {}", criteria);
final Specification<Contact> specification = createSpecification(criteria);
return contactRepository.count(specification);
}
/**
* Function to convert ContactCriteria to a {@link Specification}
*/
private Specification<Contact> createSpecification(ContactCriteria criteria) {
Specification<Contact> specification = Specification.where(null);
if (criteria != null) {
if (criteria.getId() != null) {
specification = specification.and(buildSpecification(criteria.getId(), Contact_.id));
}
if (criteria.getFirstName() != null) {
specification = specification.and(buildStringSpecification(criteria.getFirstName(), Contact_.firstName));
}
if (criteria.getLastName() != null) {
specification = specification.and(buildStringSpecification(criteria.getLastName(), Contact_.lastName));
}
if (criteria.getEmail() != null) {
specification = specification.and(buildStringSpecification(criteria.getEmail(), Contact_.email));
}
if (criteria.getRoleId() != null) {
specification = specification.and(buildSpecification(criteria.getRoleId(),
root -> root.join(Contact_.roles, JoinType.LEFT).get(CustomerContact_.id)));
}
}
return specification;
}
}

View File

@ -1,84 +0,0 @@
package org.hostsharing.hsadminng.service;
import org.hostsharing.hsadminng.domain.Contact;
import org.hostsharing.hsadminng.repository.ContactRepository;
import org.hostsharing.hsadminng.service.dto.ContactDTO;
import org.hostsharing.hsadminng.service.mapper.ContactMapper;
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 Contact.
*/
@Service
@Transactional
public class ContactService {
private final Logger log = LoggerFactory.getLogger(ContactService.class);
private final ContactRepository contactRepository;
private final ContactMapper contactMapper;
public ContactService(ContactRepository contactRepository, ContactMapper contactMapper) {
this.contactRepository = contactRepository;
this.contactMapper = contactMapper;
}
/**
* Save a contact.
*
* @param contactDTO the entity to save
* @return the persisted entity
*/
public ContactDTO save(ContactDTO contactDTO) {
log.debug("Request to save Contact : {}", contactDTO);
Contact contact = contactMapper.toEntity(contactDTO);
contact = contactRepository.save(contact);
return contactMapper.toDto(contact);
}
/**
* Get all the contacts.
*
* @param pageable the pagination information
* @return the list of entities
*/
@Transactional(readOnly = true)
public Page<ContactDTO> findAll(Pageable pageable) {
log.debug("Request to get all Contacts");
return contactRepository.findAll(pageable)
.map(contactMapper::toDto);
}
/**
* Get one contact by id.
*
* @param id the id of the entity
* @return the entity
*/
@Transactional(readOnly = true)
public Optional<ContactDTO> findOne(Long id) {
log.debug("Request to get Contact : {}", id);
return contactRepository.findById(id)
.map(contactMapper::toDto);
}
/**
* Delete the contact by id.
*
* @param id the id of the entity
*/
public void delete(Long id) {
log.debug("Request to delete Contact : {}", id);
contactRepository.deleteById(id);
}
}

View File

@ -1,106 +0,0 @@
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.CustomerContact;
import org.hostsharing.hsadminng.domain.*; // for static metamodels
import org.hostsharing.hsadminng.repository.CustomerContactRepository;
import org.hostsharing.hsadminng.service.dto.CustomerContactCriteria;
import org.hostsharing.hsadminng.service.dto.CustomerContactDTO;
import org.hostsharing.hsadminng.service.mapper.CustomerContactMapper;
/**
* Service for executing complex queries for CustomerContact entities in the database.
* The main input is a {@link CustomerContactCriteria} which gets converted to {@link Specification},
* in a way that all the filters must apply.
* It returns a {@link List} of {@link CustomerContactDTO} or a {@link Page} of {@link CustomerContactDTO} which fulfills the criteria.
*/
@Service
@Transactional(readOnly = true)
public class CustomerContactQueryService extends QueryService<CustomerContact> {
private final Logger log = LoggerFactory.getLogger(CustomerContactQueryService.class);
private final CustomerContactRepository customerContactRepository;
private final CustomerContactMapper customerContactMapper;
public CustomerContactQueryService(CustomerContactRepository customerContactRepository, CustomerContactMapper customerContactMapper) {
this.customerContactRepository = customerContactRepository;
this.customerContactMapper = customerContactMapper;
}
/**
* Return a {@link List} of {@link CustomerContactDTO} 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<CustomerContactDTO> findByCriteria(CustomerContactCriteria criteria) {
log.debug("find by criteria : {}", criteria);
final Specification<CustomerContact> specification = createSpecification(criteria);
return customerContactMapper.toDto(customerContactRepository.findAll(specification));
}
/**
* Return a {@link Page} of {@link CustomerContactDTO} 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<CustomerContactDTO> findByCriteria(CustomerContactCriteria criteria, Pageable page) {
log.debug("find by criteria : {}, page: {}", criteria, page);
final Specification<CustomerContact> specification = createSpecification(criteria);
return customerContactRepository.findAll(specification, page)
.map(customerContactMapper::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(CustomerContactCriteria criteria) {
log.debug("count by criteria : {}", criteria);
final Specification<CustomerContact> specification = createSpecification(criteria);
return customerContactRepository.count(specification);
}
/**
* Function to convert CustomerContactCriteria to a {@link Specification}
*/
private Specification<CustomerContact> createSpecification(CustomerContactCriteria criteria) {
Specification<CustomerContact> specification = Specification.where(null);
if (criteria != null) {
if (criteria.getId() != null) {
specification = specification.and(buildSpecification(criteria.getId(), CustomerContact_.id));
}
if (criteria.getRole() != null) {
specification = specification.and(buildSpecification(criteria.getRole(), CustomerContact_.role));
}
if (criteria.getContactId() != null) {
specification = specification.and(buildSpecification(criteria.getContactId(),
root -> root.join(CustomerContact_.contact, JoinType.LEFT).get(Contact_.id)));
}
if (criteria.getCustomerId() != null) {
specification = specification.and(buildSpecification(criteria.getCustomerId(),
root -> root.join(CustomerContact_.customer, JoinType.LEFT).get(Customer_.id)));
}
}
return specification;
}
}

View File

@ -1,84 +0,0 @@
package org.hostsharing.hsadminng.service;
import org.hostsharing.hsadminng.domain.CustomerContact;
import org.hostsharing.hsadminng.repository.CustomerContactRepository;
import org.hostsharing.hsadminng.service.dto.CustomerContactDTO;
import org.hostsharing.hsadminng.service.mapper.CustomerContactMapper;
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 CustomerContact.
*/
@Service
@Transactional
public class CustomerContactService {
private final Logger log = LoggerFactory.getLogger(CustomerContactService.class);
private final CustomerContactRepository customerContactRepository;
private final CustomerContactMapper customerContactMapper;
public CustomerContactService(CustomerContactRepository customerContactRepository, CustomerContactMapper customerContactMapper) {
this.customerContactRepository = customerContactRepository;
this.customerContactMapper = customerContactMapper;
}
/**
* Save a customerContact.
*
* @param customerContactDTO the entity to save
* @return the persisted entity
*/
public CustomerContactDTO save(CustomerContactDTO customerContactDTO) {
log.debug("Request to save CustomerContact : {}", customerContactDTO);
CustomerContact customerContact = customerContactMapper.toEntity(customerContactDTO);
customerContact = customerContactRepository.save(customerContact);
return customerContactMapper.toDto(customerContact);
}
/**
* Get all the customerContacts.
*
* @param pageable the pagination information
* @return the list of entities
*/
@Transactional(readOnly = true)
public Page<CustomerContactDTO> findAll(Pageable pageable) {
log.debug("Request to get all CustomerContacts");
return customerContactRepository.findAll(pageable)
.map(customerContactMapper::toDto);
}
/**
* Get one customerContact by id.
*
* @param id the id of the entity
* @return the entity
*/
@Transactional(readOnly = true)
public Optional<CustomerContactDTO> findOne(Long id) {
log.debug("Request to get CustomerContact : {}", id);
return customerContactRepository.findById(id)
.map(customerContactMapper::toDto);
}
/**
* Delete the customerContact by id.
*
* @param id the id of the entity
*/
public void delete(Long id) {
log.debug("Request to delete CustomerContact : {}", id);
customerContactRepository.deleteById(id);
}
}

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.
@ -97,26 +98,26 @@ 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.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,14 @@ 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.getFrom() != null) {
specification = specification.and(buildRangeSpecification(criteria.getFrom(), Membership_.from));
}
if (criteria.getUntilDate() != null) {
specification = specification.and(buildRangeSpecification(criteria.getUntilDate(), Membership_.untilDate));
if (criteria.getTo() != null) {
specification = specification.and(buildRangeSpecification(criteria.getTo(), Membership_.to));
}
if (criteria.getComment() != null) {
specification = specification.and(buildStringSpecification(criteria.getComment(), Membership_.comment));
}
if (criteria.getShareId() != null) {
specification = specification.and(buildSpecification(criteria.getShareId(),

View File

@ -14,7 +14,7 @@ public class MembershipValidator {
private MembershipRepository membershipRepository;
public void validate(final MembershipDTO membershipDTO) {
if (membershipDTO.getUntilDate() != null && !membershipDTO.getUntilDate().isAfter(membershipDTO.getSinceDate())) {
if (membershipDTO.getTo() != null && !membershipDTO.getTo().isAfter(membershipDTO.getFrom())) {
throw new BadRequestAlertException("Invalid untilDate", Membership.ENTITY_NAME, "untilDateMustBeAfterSinceDate");
}

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.getCreated() != null) {
specification = specification.and(buildRangeSpecification(criteria.getCreated(), SepaMandate_.created));
}
if (criteria.getValidFrom() != null) {
specification = specification.and(buildRangeSpecification(criteria.getValidFrom(), SepaMandate_.validFrom));
}
if (criteria.getValidTo() != null) {
specification = specification.and(buildRangeSpecification(criteria.getValidTo(), SepaMandate_.validTo));
}
if (criteria.getLastUsed() != null) {
specification = specification.and(buildRangeSpecification(criteria.getLastUsed(), SepaMandate_.lastUsed));
}
if (criteria.getCancelled() != null) {
specification = specification.and(buildRangeSpecification(criteria.getCancelled(), SepaMandate_.cancelled));
}
if (criteria.getComment() != null) {
specification = specification.and(buildStringSpecification(criteria.getComment(), SepaMandate_.comment));
}
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

@ -101,9 +101,9 @@ public class ShareQueryService extends QueryService<Share> {
if (criteria.getComment() != null) {
specification = specification.and(buildStringSpecification(criteria.getComment(), Share_.comment));
}
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

@ -40,7 +40,7 @@ public class AssetCriteria implements Serializable {
private StringFilter comment;
private LongFilter memberId;
private LongFilter membershipId;
public LongFilter getId() {
return id;
@ -82,12 +82,12 @@ public class AssetCriteria implements Serializable {
this.comment = comment;
}
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;
}
@ -106,7 +106,7 @@ public class AssetCriteria implements Serializable {
Objects.equals(action, that.action) &&
Objects.equals(amount, that.amount) &&
Objects.equals(comment, that.comment) &&
Objects.equals(memberId, that.memberId);
Objects.equals(membershipId, that.membershipId);
}
@Override
@ -117,7 +117,7 @@ public class AssetCriteria implements Serializable {
action,
amount,
comment,
memberId
membershipId
);
}
@ -129,7 +129,7 @@ public class AssetCriteria implements Serializable {
(action != null ? "action=" + action + ", " : "") +
(amount != null ? "amount=" + amount + ", " : "") +
(comment != null ? "comment=" + comment + ", " : "") +
(memberId != null ? "memberId=" + memberId + ", " : "") +
(membershipId != null ? "membershipId=" + membershipId + ", " : "") +
"}";
}

View File

@ -1,13 +1,10 @@
package org.hostsharing.hsadminng.service.dto;
import org.hostsharing.hsadminng.domain.enumeration.AssetAction;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDate;
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 DTO for the Asset entity.
@ -28,8 +25,10 @@ public class AssetDTO implements Serializable {
@Size(max = 160)
private String comment;
@NotNull
private Long memberId;
private Long membershipId;
private String membershipFrom;
public Long getId() {
return id;
@ -71,12 +70,20 @@ public class AssetDTO implements Serializable {
this.comment = comment;
}
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 getMembershipFrom() {
return membershipFrom;
}
public void setMembershipFrom(String membershipFrom) {
this.membershipFrom = membershipFrom;
}
@Override
@ -108,7 +115,8 @@ public class AssetDTO implements Serializable {
", action='" + getAction() + "'" +
", amount=" + getAmount() +
", comment='" + getComment() + "'" +
", member=" + getMemberId() +
", membership=" + getMembershipId() +
", membership='" + getMembershipFrom() + "'" +
"}";
}
}

View File

@ -1,115 +0,0 @@
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;
/**
* Criteria class for the Contact entity. This class is used in ContactResource to
* receive all the possible filtering options from the Http GET request parameters.
* For example the following could be a valid requests:
* <code> /contacts?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 ContactCriteria implements Serializable {
private static final long serialVersionUID = 1L;
private LongFilter id;
private StringFilter firstName;
private StringFilter lastName;
private StringFilter email;
private LongFilter roleId;
public LongFilter getId() {
return id;
}
public void setId(LongFilter id) {
this.id = id;
}
public StringFilter getFirstName() {
return firstName;
}
public void setFirstName(StringFilter firstName) {
this.firstName = firstName;
}
public StringFilter getLastName() {
return lastName;
}
public void setLastName(StringFilter lastName) {
this.lastName = lastName;
}
public StringFilter getEmail() {
return email;
}
public void setEmail(StringFilter email) {
this.email = email;
}
public LongFilter getRoleId() {
return roleId;
}
public void setRoleId(LongFilter roleId) {
this.roleId = roleId;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final ContactCriteria that = (ContactCriteria) o;
return
Objects.equals(id, that.id) &&
Objects.equals(firstName, that.firstName) &&
Objects.equals(lastName, that.lastName) &&
Objects.equals(email, that.email) &&
Objects.equals(roleId, that.roleId);
}
@Override
public int hashCode() {
return Objects.hash(
id,
firstName,
lastName,
email,
roleId
);
}
@Override
public String toString() {
return "ContactCriteria{" +
(id != null ? "id=" + id + ", " : "") +
(firstName != null ? "firstName=" + firstName + ", " : "") +
(lastName != null ? "lastName=" + lastName + ", " : "") +
(email != null ? "email=" + email + ", " : "") +
(roleId != null ? "roleId=" + roleId + ", " : "") +
"}";
}
}

View File

@ -1,88 +0,0 @@
package org.hostsharing.hsadminng.service.dto;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.Objects;
/**
* A DTO for the Contact entity.
*/
public class ContactDTO implements Serializable {
private Long id;
@NotNull
@Size(max = 80)
private String firstName;
@NotNull
@Size(max = 80)
private String lastName;
@NotNull
@Size(max = 80)
private String email;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ContactDTO contactDTO = (ContactDTO) o;
if (contactDTO.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), contactDTO.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "ContactDTO{" +
"id=" + getId() +
", firstName='" + getFirstName() + "'" +
", lastName='" + getLastName() + "'" +
", email='" + getEmail() + "'" +
"}";
}
}

View File

@ -1,108 +0,0 @@
package org.hostsharing.hsadminng.service.dto;
import java.io.Serializable;
import java.util.Objects;
import org.hostsharing.hsadminng.domain.enumeration.CustomerContactRole;
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 CustomerContact entity. This class is used in CustomerContactResource to
* receive all the possible filtering options from the Http GET request parameters.
* For example the following could be a valid requests:
* <code> /customer-contacts?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 CustomerContactCriteria implements Serializable {
/**
* Class for filtering CustomerContactRole
*/
public static class CustomerContactRoleFilter extends Filter<CustomerContactRole> {
}
private static final long serialVersionUID = 1L;
private LongFilter id;
private CustomerContactRoleFilter role;
private LongFilter contactId;
private LongFilter customerId;
public LongFilter getId() {
return id;
}
public void setId(LongFilter id) {
this.id = id;
}
public CustomerContactRoleFilter getRole() {
return role;
}
public void setRole(CustomerContactRoleFilter role) {
this.role = role;
}
public LongFilter getContactId() {
return contactId;
}
public void setContactId(LongFilter contactId) {
this.contactId = contactId;
}
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 CustomerContactCriteria that = (CustomerContactCriteria) o;
return
Objects.equals(id, that.id) &&
Objects.equals(role, that.role) &&
Objects.equals(contactId, that.contactId) &&
Objects.equals(customerId, that.customerId);
}
@Override
public int hashCode() {
return Objects.hash(
id,
role,
contactId,
customerId
);
}
@Override
public String toString() {
return "CustomerContactCriteria{" +
(id != null ? "id=" + id + ", " : "") +
(role != null ? "role=" + role + ", " : "") +
(contactId != null ? "contactId=" + contactId + ", " : "") +
(customerId != null ? "customerId=" + customerId + ", " : "") +
"}";
}
}

View File

@ -1,106 +0,0 @@
package org.hostsharing.hsadminng.service.dto;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.Objects;
import org.hostsharing.hsadminng.domain.enumeration.CustomerContactRole;
/**
* A DTO for the CustomerContact entity.
*/
public class CustomerContactDTO implements Serializable {
private Long id;
@NotNull
private CustomerContactRole role;
private Long contactId;
private String contactEmail;
private Long customerId;
private String customerPrefix;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public CustomerContactRole getRole() {
return role;
}
public void setRole(CustomerContactRole role) {
this.role = role;
}
public Long getContactId() {
return contactId;
}
public void setContactId(Long contactId) {
this.contactId = contactId;
}
public String getContactEmail() {
return contactEmail;
}
public void setContactEmail(String contactEmail) {
this.contactEmail = contactEmail;
}
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;
}
CustomerContactDTO customerContactDTO = (CustomerContactDTO) o;
if (customerContactDTO.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), customerContactDTO.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "CustomerContactDTO{" +
"id=" + getId() +
", role='" + getRole() + "'" +
", contact=" + getContactId() +
", contact='" + getContactEmail() + "'" +
", customer=" + getCustomerId() +
", customer='" + getCustomerPrefix() + "'" +
"}";
}
}

View File

@ -1,13 +1,12 @@
package org.hostsharing.hsadminng.service.dto;
import java.io.Serializable;
import java.util.Objects;
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;
/**
* 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,18 +27,18 @@ public class CustomerCriteria implements Serializable {
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 LongFilter membershipId;
private LongFilter sepamandateId;
public LongFilter getId() {
return id;
}
@ -72,14 +71,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 +79,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 +95,12 @@ 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 LongFilter getMembershipId() {
@ -120,6 +111,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) {
@ -135,12 +134,12 @@ public class CustomerCriteria implements Serializable {
Objects.equals(number, that.number) &&
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(contractualAddress, that.contractualAddress) &&
Objects.equals(billingSalutation, that.billingSalutation) &&
Objects.equals(roleId, that.roleId) &&
Objects.equals(membershipId, that.membershipId);
Objects.equals(billingAddress, that.billingAddress) &&
Objects.equals(membershipId, that.membershipId) &&
Objects.equals(sepamandateId, that.sepamandateId);
}
@Override
@ -150,12 +149,12 @@ public class CustomerCriteria implements Serializable {
number,
prefix,
name,
contractualAddress,
contractualSalutation,
billingAddress,
contractualAddress,
billingSalutation,
roleId,
membershipId
billingAddress,
membershipId,
sepamandateId
);
}
@ -166,12 +165,12 @@ public class CustomerCriteria implements Serializable {
(number != null ? "number=" + number + ", " : "") +
(prefix != null ? "prefix=" + prefix + ", " : "") +
(name != null ? "name=" + name + ", " : "") +
(contractualAddress != null ? "contractualAddress=" + contractualAddress + ", " : "") +
(contractualSalutation != null ? "contractualSalutation=" + contractualSalutation + ", " : "") +
(billingAddress != null ? "billingAddress=" + billingAddress + ", " : "") +
(contractualAddress != null ? "contractualAddress=" + contractualAddress + ", " : "") +
(billingSalutation != null ? "billingSalutation=" + billingSalutation + ", " : "") +
(roleId != null ? "roleId=" + roleId + ", " : "") +
(membershipId != null ? "membershipId=" + membershipId + ", " : "") +
(billingAddress != null ? "billingAddress=" + billingAddress + ", " : "") +
(membershipId != null ? "membershipId=" + membershipId + ", " : "") +
(sepamandateId != null ? "sepamandateId=" + sepamandateId + ", " : "") +
"}";
}

View File

@ -23,19 +23,19 @@ 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;
public Long getId() {
return id;
@ -69,14 +69,6 @@ public class CustomerDTO implements Serializable {
this.name = name;
}
public String getContractualAddress() {
return contractualAddress;
}
public void setContractualAddress(String contractualAddress) {
this.contractualAddress = contractualAddress;
}
public String getContractualSalutation() {
return contractualSalutation;
}
@ -85,12 +77,12 @@ public class CustomerDTO implements Serializable {
this.contractualSalutation = contractualSalutation;
}
public String getBillingAddress() {
return billingAddress;
public String getContractualAddress() {
return contractualAddress;
}
public void setBillingAddress(String billingAddress) {
this.billingAddress = billingAddress;
public void setContractualAddress(String contractualAddress) {
this.contractualAddress = contractualAddress;
}
public String getBillingSalutation() {
@ -101,6 +93,14 @@ public class CustomerDTO implements Serializable {
this.billingSalutation = billingSalutation;
}
public String getBillingAddress() {
return billingAddress;
}
public void setBillingAddress(String billingAddress) {
this.billingAddress = billingAddress;
}
@Override
public boolean equals(Object o) {
if (this == o) {
@ -129,10 +129,10 @@ public class CustomerDTO implements Serializable {
", number=" + getNumber() +
", prefix='" + getPrefix() + "'" +
", name='" + getName() + "'" +
", contractualAddress='" + getContractualAddress() + "'" +
", contractualSalutation='" + getContractualSalutation() + "'" +
", billingAddress='" + getBillingAddress() + "'" +
", contractualAddress='" + getContractualAddress() + "'" +
", billingSalutation='" + getBillingSalutation() + "'" +
", billingAddress='" + getBillingAddress() + "'" +
"}";
}
}

View File

@ -25,9 +25,11 @@ public class MembershipCriteria implements Serializable {
private LongFilter id;
private LocalDateFilter sinceDate;
private LocalDateFilter from;
private LocalDateFilter untilDate;
private LocalDateFilter to;
private StringFilter comment;
private LongFilter shareId;
@ -43,20 +45,28 @@ public class MembershipCriteria implements Serializable {
this.id = id;
}
public LocalDateFilter getSinceDate() {
return sinceDate;
public LocalDateFilter getFrom() {
return from;
}
public void setSinceDate(LocalDateFilter sinceDate) {
this.sinceDate = sinceDate;
public void setFrom(LocalDateFilter from) {
this.from = from;
}
public LocalDateFilter getUntilDate() {
return untilDate;
public LocalDateFilter getTo() {
return to;
}
public void setUntilDate(LocalDateFilter untilDate) {
this.untilDate = untilDate;
public void setTo(LocalDateFilter to) {
this.to = to;
}
public StringFilter getComment() {
return comment;
}
public void setComment(StringFilter comment) {
this.comment = comment;
}
public LongFilter getShareId() {
@ -95,8 +105,9 @@ 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(from, that.from) &&
Objects.equals(to, that.to) &&
Objects.equals(comment, that.comment) &&
Objects.equals(shareId, that.shareId) &&
Objects.equals(assetId, that.assetId) &&
Objects.equals(customerId, that.customerId);
@ -106,8 +117,9 @@ public class MembershipCriteria implements Serializable {
public int hashCode() {
return Objects.hash(
id,
sinceDate,
untilDate,
from,
to,
comment,
shareId,
assetId,
customerId
@ -118,8 +130,9 @@ public class MembershipCriteria implements Serializable {
public String toString() {
return "MembershipCriteria{" +
(id != null ? "id=" + id + ", " : "") +
(sinceDate != null ? "sinceDate=" + sinceDate + ", " : "") +
(untilDate != null ? "untilDate=" + untilDate + ", " : "") +
(from != null ? "from=" + from + ", " : "") +
(to != null ? "to=" + to + ", " : "") +
(comment != null ? "comment=" + comment + ", " : "") +
(shareId != null ? "shareId=" + shareId + ", " : "") +
(assetId != null ? "assetId=" + assetId + ", " : "") +
(customerId != null ? "customerId=" + customerId + ", " : "") +

View File

@ -1,6 +1,7 @@
package org.hostsharing.hsadminng.service.dto;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.Objects;
@ -14,9 +15,12 @@ public class MembershipDTO implements Serializable {
private Long id;
@NotNull
private LocalDate sinceDate;
private LocalDate from;
private LocalDate untilDate;
private LocalDate to;
@Size(max = 160)
private String comment;
@NotNull
private Long customerId;
@ -37,20 +41,28 @@ public class MembershipDTO implements Serializable {
this.id = id;
}
public LocalDate getSinceDate() {
return sinceDate;
public LocalDate getFrom() {
return from;
}
public void setSinceDate(LocalDate sinceDate) {
this.sinceDate = sinceDate;
public void setFrom(LocalDate from) {
this.from = from;
}
public LocalDate getUntilDate() {
return untilDate;
public LocalDate getTo() {
return to;
}
public void setUntilDate(LocalDate untilDate) {
this.untilDate = untilDate;
public void setTo(LocalDate to) {
this.to = to;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public Long getCustomerId() {
@ -94,8 +106,9 @@ public class MembershipDTO implements Serializable {
public String toString() {
return "MembershipDTO{" +
"id=" + getId() +
", sinceDate='" + getSinceDate() + "'" +
", untilDate='" + getUntilDate() + "'" +
", from='" + getFrom() + "'" +
", to='" + getTo() + "'" +
", comment='" + getComment() + "'" +
", 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 created;
private LocalDateFilter validFrom;
private LocalDateFilter validTo;
private LocalDateFilter lastUsed;
private LocalDateFilter cancelled;
private StringFilter comment;
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 getCreated() {
return created;
}
public void setCreated(LocalDateFilter created) {
this.created = created;
}
public LocalDateFilter getValidFrom() {
return validFrom;
}
public void setValidFrom(LocalDateFilter validFrom) {
this.validFrom = validFrom;
}
public LocalDateFilter getValidTo() {
return validTo;
}
public void setValidTo(LocalDateFilter validTo) {
this.validTo = validTo;
}
public LocalDateFilter getLastUsed() {
return lastUsed;
}
public void setLastUsed(LocalDateFilter lastUsed) {
this.lastUsed = lastUsed;
}
public LocalDateFilter getCancelled() {
return cancelled;
}
public void setCancelled(LocalDateFilter cancelled) {
this.cancelled = cancelled;
}
public StringFilter getComment() {
return comment;
}
public void setComment(StringFilter comment) {
this.comment = comment;
}
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(created, that.created) &&
Objects.equals(validFrom, that.validFrom) &&
Objects.equals(validTo, that.validTo) &&
Objects.equals(lastUsed, that.lastUsed) &&
Objects.equals(cancelled, that.cancelled) &&
Objects.equals(comment, that.comment) &&
Objects.equals(customerId, that.customerId);
}
@Override
public int hashCode() {
return Objects.hash(
id,
reference,
iban,
bic,
created,
validFrom,
validTo,
lastUsed,
cancelled,
comment,
customerId
);
}
@Override
public String toString() {
return "SepaMandateCriteria{" +
(id != null ? "id=" + id + ", " : "") +
(reference != null ? "reference=" + reference + ", " : "") +
(iban != null ? "iban=" + iban + ", " : "") +
(bic != null ? "bic=" + bic + ", " : "") +
(created != null ? "created=" + created + ", " : "") +
(validFrom != null ? "validFrom=" + validFrom + ", " : "") +
(validTo != null ? "validTo=" + validTo + ", " : "") +
(lastUsed != null ? "lastUsed=" + lastUsed + ", " : "") +
(cancelled != null ? "cancelled=" + cancelled + ", " : "") +
(comment != null ? "comment=" + comment + ", " : "") +
(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 created;
@NotNull
private LocalDate validFrom;
private LocalDate validTo;
private LocalDate lastUsed;
private LocalDate cancelled;
@Size(max = 160)
private String comment;
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 getCreated() {
return created;
}
public void setCreated(LocalDate created) {
this.created = created;
}
public LocalDate getValidFrom() {
return validFrom;
}
public void setValidFrom(LocalDate validFrom) {
this.validFrom = validFrom;
}
public LocalDate getValidTo() {
return validTo;
}
public void setValidTo(LocalDate validTo) {
this.validTo = validTo;
}
public LocalDate getLastUsed() {
return lastUsed;
}
public void setLastUsed(LocalDate lastUsed) {
this.lastUsed = lastUsed;
}
public LocalDate getCancelled() {
return cancelled;
}
public void setCancelled(LocalDate cancelled) {
this.cancelled = cancelled;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
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() + "'" +
", created='" + getCreated() + "'" +
", validFrom='" + getValidFrom() + "'" +
", validTo='" + getValidTo() + "'" +
", lastUsed='" + getLastUsed() + "'" +
", cancelled='" + getCancelled() + "'" +
", comment='" + getComment() + "'" +
", customer=" + getCustomerId() +
", customer='" + getCustomerPrefix() + "'" +
"}";
}
}

View File

@ -39,7 +39,7 @@ public class ShareCriteria implements Serializable {
private StringFilter comment;
private LongFilter memberId;
private LongFilter membershipId;
public LongFilter getId() {
return id;
@ -81,12 +81,12 @@ public class ShareCriteria implements Serializable {
this.comment = comment;
}
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;
}
@ -105,7 +105,7 @@ public class ShareCriteria implements Serializable {
Objects.equals(action, that.action) &&
Objects.equals(quantity, that.quantity) &&
Objects.equals(comment, that.comment) &&
Objects.equals(memberId, that.memberId);
Objects.equals(membershipId, that.membershipId);
}
@Override
@ -116,7 +116,7 @@ public class ShareCriteria implements Serializable {
action,
quantity,
comment,
memberId
membershipId
);
}
@ -128,7 +128,7 @@ public class ShareCriteria implements Serializable {
(action != null ? "action=" + action + ", " : "") +
(quantity != null ? "quantity=" + quantity + ", " : "") +
(comment != null ? "comment=" + comment + ", " : "") +
(memberId != null ? "memberId=" + memberId + ", " : "") +
(membershipId != null ? "membershipId=" + membershipId + ", " : "") +
"}";
}

View File

@ -1,12 +1,9 @@
package org.hostsharing.hsadminng.service.dto;
import org.hostsharing.hsadminng.domain.enumeration.ShareAction;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.time.LocalDate;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.Objects;
import org.hostsharing.hsadminng.domain.enumeration.ShareAction;
/**
* A DTO for the Share entity.
@ -27,8 +24,10 @@ public class ShareDTO implements Serializable {
@Size(max = 160)
private String comment;
@NotNull
private Long memberId;
private Long membershipId;
private String membershipFrom;
public Long getId() {
return id;
@ -70,12 +69,20 @@ public class ShareDTO implements Serializable {
this.comment = comment;
}
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 getMembershipFrom() {
return membershipFrom;
}
public void setMembershipFrom(String membershipFrom) {
this.membershipFrom = membershipFrom;
}
@Override
@ -107,7 +114,8 @@ public class ShareDTO implements Serializable {
", action='" + getAction() + "'" +
", quantity=" + getQuantity() +
", comment='" + getComment() + "'" +
", member=" + getMemberId() +
", membership=" + getMembershipId() +
", membership='" + getMembershipFrom() + "'" +
"}";
}
}

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.from", target = "membershipFrom")
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,26 +0,0 @@
package org.hostsharing.hsadminng.service.mapper;
import org.hostsharing.hsadminng.domain.*;
import org.hostsharing.hsadminng.service.dto.ContactDTO;
import org.mapstruct.*;
/**
* Mapper for the entity Contact and its DTO ContactDTO.
*/
@Mapper(componentModel = "spring", uses = {})
public interface ContactMapper extends EntityMapper<ContactDTO, Contact> {
@Mapping(target = "roles", ignore = true)
Contact toEntity(ContactDTO contactDTO);
default Contact fromId(Long id) {
if (id == null) {
return null;
}
Contact contact = new Contact();
contact.setId(id);
return contact;
}
}

View File

@ -1,32 +0,0 @@
package org.hostsharing.hsadminng.service.mapper;
import org.hostsharing.hsadminng.domain.*;
import org.hostsharing.hsadminng.service.dto.CustomerContactDTO;
import org.mapstruct.*;
/**
* Mapper for the entity CustomerContact and its DTO CustomerContactDTO.
*/
@Mapper(componentModel = "spring", uses = {ContactMapper.class, CustomerMapper.class})
public interface CustomerContactMapper extends EntityMapper<CustomerContactDTO, CustomerContact> {
@Mapping(source = "contact.id", target = "contactId")
@Mapping(source = "contact.email", target = "contactEmail")
@Mapping(source = "customer.id", target = "customerId")
@Mapping(source = "customer.prefix", target = "customerPrefix")
CustomerContactDTO toDto(CustomerContact customerContact);
@Mapping(source = "contactId", target = "contact")
@Mapping(source = "customerId", target = "customer")
CustomerContact toEntity(CustomerContactDTO customerContactDTO);
default CustomerContact fromId(Long id) {
if (id == null) {
return null;
}
CustomerContact customerContact = new CustomerContact();
customerContact.setId(id);
return customerContact;
}
}

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.from", target = "membershipFrom")
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

@ -1,138 +0,0 @@
package org.hostsharing.hsadminng.web.rest;
import org.hostsharing.hsadminng.service.ContactService;
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.ContactDTO;
import org.hostsharing.hsadminng.service.dto.ContactCriteria;
import org.hostsharing.hsadminng.service.ContactQueryService;
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 Contact.
*/
@RestController
@RequestMapping("/api")
public class ContactResource {
private final Logger log = LoggerFactory.getLogger(ContactResource.class);
private static final String ENTITY_NAME = "contact";
private final ContactService contactService;
private final ContactQueryService contactQueryService;
public ContactResource(ContactService contactService, ContactQueryService contactQueryService) {
this.contactService = contactService;
this.contactQueryService = contactQueryService;
}
/**
* POST /contacts : Create a new contact.
*
* @param contactDTO the contactDTO to create
* @return the ResponseEntity with status 201 (Created) and with body the new contactDTO, or with status 400 (Bad Request) if the contact has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/contacts")
public ResponseEntity<ContactDTO> createContact(@Valid @RequestBody ContactDTO contactDTO) throws URISyntaxException {
log.debug("REST request to save Contact : {}", contactDTO);
if (contactDTO.getId() != null) {
throw new BadRequestAlertException("A new contact cannot already have an ID", ENTITY_NAME, "idexists");
}
ContactDTO result = contactService.save(contactDTO);
return ResponseEntity.created(new URI("/api/contacts/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
.body(result);
}
/**
* PUT /contacts : Updates an existing contact.
*
* @param contactDTO the contactDTO to update
* @return the ResponseEntity with status 200 (OK) and with body the updated contactDTO,
* or with status 400 (Bad Request) if the contactDTO is not valid,
* or with status 500 (Internal Server Error) if the contactDTO couldn't be updated
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PutMapping("/contacts")
public ResponseEntity<ContactDTO> updateContact(@Valid @RequestBody ContactDTO contactDTO) throws URISyntaxException {
log.debug("REST request to update Contact : {}", contactDTO);
if (contactDTO.getId() == null) {
throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
}
ContactDTO result = contactService.save(contactDTO);
return ResponseEntity.ok()
.headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, contactDTO.getId().toString()))
.body(result);
}
/**
* GET /contacts : get all the contacts.
*
* @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 contacts in body
*/
@GetMapping("/contacts")
public ResponseEntity<List<ContactDTO>> getAllContacts(ContactCriteria criteria, Pageable pageable) {
log.debug("REST request to get Contacts by criteria: {}", criteria);
Page<ContactDTO> page = contactQueryService.findByCriteria(criteria, pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/contacts");
return ResponseEntity.ok().headers(headers).body(page.getContent());
}
/**
* GET /contacts/count : count all the contacts.
*
* @param criteria the criterias which the requested entities should match
* @return the ResponseEntity with status 200 (OK) and the count in body
*/
@GetMapping("/contacts/count")
public ResponseEntity<Long> countContacts(ContactCriteria criteria) {
log.debug("REST request to count Contacts by criteria: {}", criteria);
return ResponseEntity.ok().body(contactQueryService.countByCriteria(criteria));
}
/**
* GET /contacts/:id : get the "id" contact.
*
* @param id the id of the contactDTO to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the contactDTO, or with status 404 (Not Found)
*/
@GetMapping("/contacts/{id}")
public ResponseEntity<ContactDTO> getContact(@PathVariable Long id) {
log.debug("REST request to get Contact : {}", id);
Optional<ContactDTO> contactDTO = contactService.findOne(id);
return ResponseUtil.wrapOrNotFound(contactDTO);
}
/**
* DELETE /contacts/:id : delete the "id" contact.
*
* @param id the id of the contactDTO to delete
* @return the ResponseEntity with status 200 (OK)
*/
@DeleteMapping("/contacts/{id}")
public ResponseEntity<Void> deleteContact(@PathVariable Long id) {
log.debug("REST request to delete Contact : {}", id);
contactService.delete(id);
return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
}
}

View File

@ -1,138 +0,0 @@
package org.hostsharing.hsadminng.web.rest;
import org.hostsharing.hsadminng.service.CustomerContactService;
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.CustomerContactDTO;
import org.hostsharing.hsadminng.service.dto.CustomerContactCriteria;
import org.hostsharing.hsadminng.service.CustomerContactQueryService;
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 CustomerContact.
*/
@RestController
@RequestMapping("/api")
public class CustomerContactResource {
private final Logger log = LoggerFactory.getLogger(CustomerContactResource.class);
private static final String ENTITY_NAME = "customerContact";
private final CustomerContactService customerContactService;
private final CustomerContactQueryService customerContactQueryService;
public CustomerContactResource(CustomerContactService customerContactService, CustomerContactQueryService customerContactQueryService) {
this.customerContactService = customerContactService;
this.customerContactQueryService = customerContactQueryService;
}
/**
* POST /customer-contacts : Create a new customerContact.
*
* @param customerContactDTO the customerContactDTO to create
* @return the ResponseEntity with status 201 (Created) and with body the new customerContactDTO, or with status 400 (Bad Request) if the customerContact has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/customer-contacts")
public ResponseEntity<CustomerContactDTO> createCustomerContact(@Valid @RequestBody CustomerContactDTO customerContactDTO) throws URISyntaxException {
log.debug("REST request to save CustomerContact : {}", customerContactDTO);
if (customerContactDTO.getId() != null) {
throw new BadRequestAlertException("A new customerContact cannot already have an ID", ENTITY_NAME, "idexists");
}
CustomerContactDTO result = customerContactService.save(customerContactDTO);
return ResponseEntity.created(new URI("/api/customer-contacts/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
.body(result);
}
/**
* PUT /customer-contacts : Updates an existing customerContact.
*
* @param customerContactDTO the customerContactDTO to update
* @return the ResponseEntity with status 200 (OK) and with body the updated customerContactDTO,
* or with status 400 (Bad Request) if the customerContactDTO is not valid,
* or with status 500 (Internal Server Error) if the customerContactDTO couldn't be updated
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PutMapping("/customer-contacts")
public ResponseEntity<CustomerContactDTO> updateCustomerContact(@Valid @RequestBody CustomerContactDTO customerContactDTO) throws URISyntaxException {
log.debug("REST request to update CustomerContact : {}", customerContactDTO);
if (customerContactDTO.getId() == null) {
throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
}
CustomerContactDTO result = customerContactService.save(customerContactDTO);
return ResponseEntity.ok()
.headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, customerContactDTO.getId().toString()))
.body(result);
}
/**
* GET /customer-contacts : get all the customerContacts.
*
* @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 customerContacts in body
*/
@GetMapping("/customer-contacts")
public ResponseEntity<List<CustomerContactDTO>> getAllCustomerContacts(CustomerContactCriteria criteria, Pageable pageable) {
log.debug("REST request to get CustomerContacts by criteria: {}", criteria);
Page<CustomerContactDTO> page = customerContactQueryService.findByCriteria(criteria, pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/customer-contacts");
return ResponseEntity.ok().headers(headers).body(page.getContent());
}
/**
* GET /customer-contacts/count : count all the customerContacts.
*
* @param criteria the criterias which the requested entities should match
* @return the ResponseEntity with status 200 (OK) and the count in body
*/
@GetMapping("/customer-contacts/count")
public ResponseEntity<Long> countCustomerContacts(CustomerContactCriteria criteria) {
log.debug("REST request to count CustomerContacts by criteria: {}", criteria);
return ResponseEntity.ok().body(customerContactQueryService.countByCriteria(criteria));
}
/**
* GET /customer-contacts/:id : get the "id" customerContact.
*
* @param id the id of the customerContactDTO to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the customerContactDTO, or with status 404 (Not Found)
*/
@GetMapping("/customer-contacts/{id}")
public ResponseEntity<CustomerContactDTO> getCustomerContact(@PathVariable Long id) {
log.debug("REST request to get CustomerContact : {}", id);
Optional<CustomerContactDTO> customerContactDTO = customerContactService.findOne(id);
return ResponseUtil.wrapOrNotFound(customerContactDTO);
}
/**
* DELETE /customer-contacts/:id : delete the "id" customerContact.
*
* @param id the id of the customerContactDTO to delete
* @return the ResponseEntity with status 200 (OK)
*/
@DeleteMapping("/customer-contacts/{id}")
public ResponseEntity<Void> deleteCustomerContact(@PathVariable Long id) {
log.debug("REST request to delete CustomerContact : {}", id);
customerContactService.delete(id);
return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
}
}

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();
}
}