Model customers.

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

View File

@ -2,7 +2,14 @@
"name": "Asset",
"fields": [
{
"fieldName": "date",
"fieldName": "documentDate",
"fieldType": "LocalDate",
"fieldValidateRules": [
"required"
]
},
{
"fieldName": "valueDate",
"fieldType": "LocalDate",
"fieldValidateRules": [
"required"
@ -24,7 +31,7 @@
]
},
{
"fieldName": "comment",
"fieldName": "remark",
"fieldType": "String",
"fieldValidateRules": [
"maxlength"
@ -38,8 +45,8 @@
"otherEntityName": "membership",
"otherEntityRelationshipName": "asset",
"relationshipValidateRules": "required",
"relationshipName": "member",
"otherEntityField": "id"
"relationshipName": "membership",
"otherEntityField": "documentDate"
}
],
"changelogDate": "20190403083740",

View File

@ -2,7 +2,7 @@
"name": "Customer",
"fields": [
{
"fieldName": "number",
"fieldName": "reference",
"fieldType": "Integer",
"fieldValidateRules": [
"required",
@ -18,9 +18,11 @@
"fieldType": "String",
"fieldValidateRules": [
"required",
"maxlength",
"unique",
"pattern"
],
"fieldValidateRulesMaxlength": 3,
"fieldValidateRulesPattern": "[a-z][a-z0-9]+"
},
{
@ -32,6 +34,14 @@
],
"fieldValidateRulesMaxlength": 80
},
{
"fieldName": "contractualSalutation",
"fieldType": "String",
"fieldValidateRules": [
"maxlength"
],
"fieldValidateRulesMaxlength": 80
},
{
"fieldName": "contractualAddress",
"fieldType": "String",
@ -42,7 +52,7 @@
"fieldValidateRulesMaxlength": 400
},
{
"fieldName": "contractualSalutation",
"fieldName": "billingSalutation",
"fieldType": "String",
"fieldValidateRules": [
"maxlength"
@ -58,26 +68,26 @@
"fieldValidateRulesMaxlength": 400
},
{
"fieldName": "billingSalutation",
"fieldName": "remark",
"fieldType": "String",
"fieldValidateRules": [
"maxlength"
],
"fieldValidateRulesMaxlength": 80
"fieldValidateRulesMaxlength": 160
}
],
"relationships": [
{
"relationshipType": "one-to-many",
"otherEntityName": "customerContact",
"otherEntityRelationshipName": "customer",
"relationshipName": "role"
},
{
"relationshipType": "one-to-many",
"otherEntityName": "membership",
"otherEntityRelationshipName": "customer",
"relationshipName": "membership"
},
{
"relationshipType": "one-to-many",
"otherEntityName": "sepaMandate",
"otherEntityRelationshipName": "customer",
"relationshipName": "sepamandate"
}
],
"changelogDate": "20190403083735",

View File

@ -2,28 +2,43 @@
"name": "Membership",
"fields": [
{
"fieldName": "sinceDate",
"fieldName": "documentDate",
"fieldType": "LocalDate",
"fieldValidateRules": [
"required"
]
},
{
"fieldName": "untilDate",
"fieldName": "memberFrom",
"fieldType": "LocalDate",
"fieldValidateRules": [
"required"
]
},
{
"fieldName": "memberUntil",
"fieldType": "LocalDate"
},
{
"fieldName": "remark",
"fieldType": "String",
"fieldValidateRules": [
"maxlength"
],
"fieldValidateRulesMaxlength": 160
}
],
"relationships": [
{
"relationshipType": "one-to-many",
"otherEntityName": "share",
"otherEntityRelationshipName": "member",
"otherEntityRelationshipName": "membership",
"relationshipName": "share"
},
{
"relationshipType": "one-to-many",
"otherEntityName": "asset",
"otherEntityRelationshipName": "member",
"otherEntityRelationshipName": "membership",
"relationshipName": "asset"
},
{

View File

@ -0,0 +1,84 @@
{
"name": "SepaMandate",
"fields": [
{
"fieldName": "reference",
"fieldType": "String",
"fieldValidateRules": [
"maxlength",
"unique",
"required"
],
"fieldValidateRulesMaxlength": 40
},
{
"fieldName": "iban",
"fieldType": "String",
"fieldValidateRules": [
"maxlength"
],
"fieldValidateRulesMaxlength": 34
},
{
"fieldName": "bic",
"fieldType": "String",
"fieldValidateRules": [
"maxlength"
],
"fieldValidateRulesMaxlength": 11
},
{
"fieldName": "documentDate",
"fieldType": "LocalDate",
"fieldValidateRules": [
"required"
]
},
{
"fieldName": "validFrom",
"fieldType": "LocalDate",
"fieldValidateRules": [
"required"
]
},
{
"fieldName": "validUntil",
"fieldType": "LocalDate"
},
{
"fieldName": "lastUsed",
"fieldType": "LocalDate"
},
{
"fieldName": "cancellationDate",
"fieldType": "LocalDate"
},
{
"fieldName": "remark",
"fieldType": "String",
"fieldValidateRules": [
"maxlength"
],
"fieldValidateRulesMaxlength": 160
}
],
"relationships": [
{
"relationshipType": "many-to-one",
"otherEntityName": "customer",
"otherEntityRelationshipName": "sepamandate",
"relationshipValidateRules": "required",
"relationshipName": "customer",
"otherEntityField": "prefix"
}
],
"changelogDate": "20190418100951",
"entityTableName": "sepa_mandate",
"dto": "mapstruct",
"pagination": "infinite-scroll",
"service": "serviceClass",
"jpaMetamodelFiltering": true,
"fluentMethods": true,
"clientRootFolder": "",
"applications": "*"
}

View File

@ -2,7 +2,14 @@
"name": "Share",
"fields": [
{
"fieldName": "date",
"fieldName": "documentDate",
"fieldType": "LocalDate",
"fieldValidateRules": [
"required"
]
},
{
"fieldName": "valueDate",
"fieldType": "LocalDate",
"fieldValidateRules": [
"required"
@ -24,7 +31,7 @@
]
},
{
"fieldName": "comment",
"fieldName": "remark",
"fieldType": "String",
"fieldValidateRules": [
"maxlength"
@ -38,8 +45,8 @@
"otherEntityName": "membership",
"otherEntityRelationshipName": "share",
"relationshipValidateRules": "required",
"relationshipName": "member",
"otherEntityField": "id"
"relationshipName": "membership",
"otherEntityField": "documentDate"
}
],
"changelogDate": "20190403083739",

View File

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

View File

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

View File

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

View File

@ -0,0 +1,241 @@
package org.hostsharing.hsadminng.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.Objects;
/**
* A SepaMandate.
*/
@Entity
@Table(name = "sepa_mandate")
public class SepaMandate implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
@SequenceGenerator(name = "sequenceGenerator")
private Long id;
@NotNull
@Size(max = 40)
@Column(name = "reference", length = 40, nullable = false, unique = true)
private String reference;
@Size(max = 34)
@Column(name = "iban", length = 34)
private String iban;
@Size(max = 11)
@Column(name = "bic", length = 11)
private String bic;
@NotNull
@Column(name = "document_date", nullable = false)
private LocalDate documentDate;
@NotNull
@Column(name = "valid_from", nullable = false)
private LocalDate validFrom;
@Column(name = "valid_until")
private LocalDate validUntil;
@Column(name = "last_used")
private LocalDate lastUsed;
@Column(name = "cancellation_date")
private LocalDate cancellationDate;
@Size(max = 160)
@Column(name = "remark", length = 160)
private String remark;
@ManyToOne(optional = false)
@NotNull
@JsonIgnoreProperties("sepamandates")
private Customer customer;
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getReference() {
return reference;
}
public SepaMandate reference(String reference) {
this.reference = reference;
return this;
}
public void setReference(String reference) {
this.reference = reference;
}
public String getIban() {
return iban;
}
public SepaMandate iban(String iban) {
this.iban = iban;
return this;
}
public void setIban(String iban) {
this.iban = iban;
}
public String getBic() {
return bic;
}
public SepaMandate bic(String bic) {
this.bic = bic;
return this;
}
public void setBic(String bic) {
this.bic = bic;
}
public LocalDate getDocumentDate() {
return documentDate;
}
public SepaMandate documentDate(LocalDate documentDate) {
this.documentDate = documentDate;
return this;
}
public void setDocumentDate(LocalDate documentDate) {
this.documentDate = documentDate;
}
public LocalDate getValidFrom() {
return validFrom;
}
public SepaMandate validFrom(LocalDate validFrom) {
this.validFrom = validFrom;
return this;
}
public void setValidFrom(LocalDate validFrom) {
this.validFrom = validFrom;
}
public LocalDate getValidUntil() {
return validUntil;
}
public SepaMandate validUntil(LocalDate validUntil) {
this.validUntil = validUntil;
return this;
}
public void setValidUntil(LocalDate validUntil) {
this.validUntil = validUntil;
}
public LocalDate getLastUsed() {
return lastUsed;
}
public SepaMandate lastUsed(LocalDate lastUsed) {
this.lastUsed = lastUsed;
return this;
}
public void setLastUsed(LocalDate lastUsed) {
this.lastUsed = lastUsed;
}
public LocalDate getCancellationDate() {
return cancellationDate;
}
public SepaMandate cancellationDate(LocalDate cancellationDate) {
this.cancellationDate = cancellationDate;
return this;
}
public void setCancellationDate(LocalDate cancellationDate) {
this.cancellationDate = cancellationDate;
}
public String getRemark() {
return remark;
}
public SepaMandate remark(String remark) {
this.remark = remark;
return this;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Customer getCustomer() {
return customer;
}
public SepaMandate customer(Customer customer) {
this.customer = customer;
return this;
}
public void setCustomer(Customer customer) {
this.customer = customer;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SepaMandate sepaMandate = (SepaMandate) o;
if (sepaMandate.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), sepaMandate.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "SepaMandate{" +
"id=" + getId() +
", reference='" + getReference() + "'" +
", iban='" + getIban() + "'" +
", bic='" + getBic() + "'" +
", documentDate='" + getDocumentDate() + "'" +
", validFrom='" + getValidFrom() + "'" +
", validUntil='" + getValidUntil() + "'" +
", lastUsed='" + getLastUsed() + "'" +
", cancellationDate='" + getCancellationDate() + "'" +
", remark='" + getRemark() + "'" +
"}";
}
}

View File

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

View File

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

View File

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

View File

@ -1,14 +1,9 @@
package org.hostsharing.hsadminng.service;
import io.github.jhipster.service.QueryService;
import org.hostsharing.hsadminng.domain.Customer;
import org.hostsharing.hsadminng.domain.CustomerContact_;
import org.hostsharing.hsadminng.domain.Customer_;
import org.hostsharing.hsadminng.domain.Membership_;
import org.hostsharing.hsadminng.repository.CustomerRepository;
import org.hostsharing.hsadminng.service.dto.CustomerCriteria;
import org.hostsharing.hsadminng.service.dto.CustomerDTO;
import org.hostsharing.hsadminng.service.mapper.CustomerMapper;
import java.util.List;
import javax.persistence.criteria.JoinType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
@ -17,8 +12,14 @@ import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.criteria.JoinType;
import java.util.List;
import io.github.jhipster.service.QueryService;
import org.hostsharing.hsadminng.domain.Customer;
import org.hostsharing.hsadminng.domain.*; // for static metamodels
import org.hostsharing.hsadminng.repository.CustomerRepository;
import org.hostsharing.hsadminng.service.dto.CustomerCriteria;
import org.hostsharing.hsadminng.service.dto.CustomerDTO;
import org.hostsharing.hsadminng.service.mapper.CustomerMapper;
/**
* Service for executing complex queries for Customer entities in the database.
@ -88,8 +89,8 @@ public class CustomerQueryService extends QueryService<Customer> {
if (criteria.getId() != null) {
specification = specification.and(buildSpecification(criteria.getId(), Customer_.id));
}
if (criteria.getNumber() != null) {
specification = specification.and(buildRangeSpecification(criteria.getNumber(), Customer_.number));
if (criteria.getReference() != null) {
specification = specification.and(buildRangeSpecification(criteria.getReference(), Customer_.reference));
}
if (criteria.getPrefix() != null) {
specification = specification.and(buildStringSpecification(criteria.getPrefix(), Customer_.prefix));
@ -97,26 +98,29 @@ public class CustomerQueryService extends QueryService<Customer> {
if (criteria.getName() != null) {
specification = specification.and(buildStringSpecification(criteria.getName(), Customer_.name));
}
if (criteria.getContractualAddress() != null) {
specification = specification.and(buildStringSpecification(criteria.getContractualAddress(), Customer_.contractualAddress));
}
if (criteria.getContractualSalutation() != null) {
specification = specification.and(buildStringSpecification(criteria.getContractualSalutation(), Customer_.contractualSalutation));
}
if (criteria.getBillingAddress() != null) {
specification = specification.and(buildStringSpecification(criteria.getBillingAddress(), Customer_.billingAddress));
if (criteria.getContractualAddress() != null) {
specification = specification.and(buildStringSpecification(criteria.getContractualAddress(), Customer_.contractualAddress));
}
if (criteria.getBillingSalutation() != null) {
specification = specification.and(buildStringSpecification(criteria.getBillingSalutation(), Customer_.billingSalutation));
}
if (criteria.getRoleId() != null) {
specification = specification.and(buildSpecification(criteria.getRoleId(),
root -> root.join(Customer_.roles, JoinType.LEFT).get(CustomerContact_.id)));
if (criteria.getBillingAddress() != null) {
specification = specification.and(buildStringSpecification(criteria.getBillingAddress(), Customer_.billingAddress));
}
if (criteria.getRemark() != null) {
specification = specification.and(buildStringSpecification(criteria.getRemark(), Customer_.remark));
}
if (criteria.getMembershipId() != null) {
specification = specification.and(buildSpecification(criteria.getMembershipId(),
root -> root.join(Customer_.memberships, JoinType.LEFT).get(Membership_.id)));
}
if (criteria.getSepamandateId() != null) {
specification = specification.and(buildSpecification(criteria.getSepamandateId(),
root -> root.join(Customer_.sepamandates, JoinType.LEFT).get(SepaMandate_.id)));
}
}
return specification;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,37 +1,24 @@
filter all
dto all with mapstruct
service all with serviceClass
paginate all with infinite-scroll
paginate all with infinite-scroll
entity Customer {
number Integer required unique min(10000) max(99999),
prefix String required unique pattern(/[a-z][a-z0-9]+/),
reference Integer required unique min(10000) max(99999),
prefix String required maxlength(3) unique pattern(/[a-z][a-z0-9]+/),
name String required maxlength(80),
contractualAddress String required maxlength(400),
contractualSalutation String maxlength(80),
contractualAddress String required maxlength(400),
billingSalutation String maxlength(80),
billingAddress String maxlength(400),
billingSalutation String maxlength(80)
}
entity Contact {
firstName String required maxlength(80),
lastName String required maxlength(80),
email String required maxlength(80)
}
enum CustomerContactRole {
CONTRACTUAL,
TECHNICAL,
FINANCIAL
}
entity CustomerContact {
role CustomerContactRole required
remark String maxlength(160)
}
entity Membership {
sinceDate LocalDate required,
untilDate LocalDate
documentDate LocalDate required,
memberFrom LocalDate required,
memberUntil LocalDate,
remark String maxlength(160)
}
enum ShareAction {
@ -40,10 +27,11 @@ enum ShareAction {
}
entity Share {
date LocalDate required,
documentDate LocalDate required,
valueDate LocalDate required,
action ShareAction required,
quantity Integer required,
comment String maxlength(160)
remark String maxlength(160)
}
enum AssetAction {
@ -56,17 +44,28 @@ enum AssetAction {
}
entity Asset {
date LocalDate required,
documentDate LocalDate required,
valueDate LocalDate required,
action AssetAction required,
amount BigDecimal required,
comment String maxlength(160)
remark String maxlength(160)
}
entity SepaMandate {
reference String maxlength(40) unique required,
iban String maxlength(34),
bic String maxlength(11),
documentDate LocalDate required,
validFrom LocalDate required,
validUntil LocalDate,
lastUsed LocalDate,
cancellationDate LocalDate,
remark String maxlength(160)
}
relationship OneToMany {
Contact{role} to CustomerContact{contact(email) required},
Customer{role} to CustomerContact{customer(prefix) required},
Customer to Membership{customer(prefix) required},
Membership to Share{member required},
Membership to Asset{member required}
Customer{membership} to Membership{customer(prefix) required},
Customer{sepamandate} to SepaMandate{customer(prefix) required},
Membership{share} to Share{membership(documentDate) required},
Membership{asset} to Asset{membership(documentDate) required}
}

View File

@ -1,8 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<property name="now" value="now()" dbms="h2"/>
@ -19,32 +21,36 @@
<column name="id" type="bigint" autoIncrement="${autoIncrement}">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="jhi_number" type="integer">
<constraints nullable="false" unique="true" uniqueConstraintName="ux_customer_jhi_number" />
<column name="reference" type="integer">
<constraints nullable="false" unique="true" uniqueConstraintName="ux_customer_reference" />
</column>
<column name="prefix" type="varchar(255)">
<column name="prefix" type="varchar(3)">
<constraints nullable="false" unique="true" uniqueConstraintName="ux_customer_prefix" />
</column>
<column name="name" type="varchar(80)">
<constraints nullable="false"/>
</column>
<column name="contractual_address" type="varchar(400)">
<constraints nullable="false"/>
<constraints nullable="false" />
</column>
<column name="contractual_salutation" type="varchar(80)">
<constraints nullable="true"/>
<constraints nullable="true" />
</column>
<column name="billing_address" type="varchar(400)">
<constraints nullable="true"/>
<column name="contractual_address" type="varchar(400)">
<constraints nullable="false" />
</column>
<column name="billing_salutation" type="varchar(80)">
<constraints nullable="true"/>
<constraints nullable="true" />
</column>
<column name="billing_address" type="varchar(400)">
<constraints nullable="true" />
</column>
<column name="remark" type="varchar(160)">
<constraints nullable="true" />
</column>
<!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove-->

View File

@ -1,8 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<property name="now" value="now()" dbms="h2"/>
@ -19,16 +21,24 @@
<column name="id" type="bigint" autoIncrement="${autoIncrement}">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="since_date" type="date">
<column name="document_date" type="date">
<constraints nullable="false" />
</column>
<column name="until_date" type="date">
<column name="member_from" type="date">
<constraints nullable="false" />
</column>
<column name="member_until" type="date">
<constraints nullable="true" />
</column>
<column name="remark" type="varchar(160)">
<constraints nullable="true" />
</column>
<column name="customer_id" type="bigint">
<constraints nullable="false"/>
<constraints nullable="false" />
</column>
<!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove-->

View File

@ -1,8 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<property name="now" value="now()" dbms="h2"/>
@ -19,7 +21,11 @@
<column name="id" type="bigint" autoIncrement="${autoIncrement}">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="jhi_date" type="date">
<column name="document_date" type="date">
<constraints nullable="false" />
</column>
<column name="value_date" type="date">
<constraints nullable="false" />
</column>
@ -31,12 +37,12 @@
<constraints nullable="false" />
</column>
<column name="jhi_comment" type="varchar(160)">
<column name="remark" type="varchar(160)">
<constraints nullable="true" />
</column>
<column name="member_id" type="bigint">
<constraints nullable="false"/>
<column name="membership_id" type="bigint">
<constraints nullable="false" />
</column>
<!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove-->

View File

@ -8,9 +8,9 @@
-->
<changeSet id="20190403083739-2" author="jhipster">
<addForeignKeyConstraint baseColumnNames="member_id"
<addForeignKeyConstraint baseColumnNames="membership_id"
baseTableName="share"
constraintName="fk_share_member_id"
constraintName="fk_share_membership_id"
referencedColumnNames="id"
referencedTableName="membership"/>

View File

@ -1,8 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<property name="now" value="now()" dbms="h2"/>
@ -19,7 +21,11 @@
<column name="id" type="bigint" autoIncrement="${autoIncrement}">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="jhi_date" type="date">
<column name="document_date" type="date">
<constraints nullable="false" />
</column>
<column name="value_date" type="date">
<constraints nullable="false" />
</column>
@ -31,12 +37,12 @@
<constraints nullable="false" />
</column>
<column name="jhi_comment" type="varchar(160)">
<column name="remark" type="varchar(160)">
<constraints nullable="true" />
</column>
<column name="member_id" type="bigint">
<constraints nullable="false"/>
<column name="membership_id" type="bigint">
<constraints nullable="false" />
</column>
<!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove-->

View File

@ -8,9 +8,9 @@
-->
<changeSet id="20190403083740-2" author="jhipster">
<addForeignKeyConstraint baseColumnNames="member_id"
<addForeignKeyConstraint baseColumnNames="membership_id"
baseTableName="asset"
constraintName="fk_asset_member_id"
constraintName="fk_asset_membership_id"
referencedColumnNames="id"
referencedTableName="membership"/>

View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<property name="now" value="now()" dbms="h2"/>
<property name="now" value="current_timestamp" dbms="postgresql"/>
<property name="floatType" value="float4" dbms="postgresql, h2"/>
<property name="floatType" value="float" dbms="mysql, oracle, mssql"/>
<!--
Added the entity SepaMandate.
-->
<changeSet id="20190418100951-1" author="jhipster">
<createTable tableName="sepa_mandate">
<column name="id" type="bigint" autoIncrement="${autoIncrement}">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="reference" type="varchar(40)">
<constraints nullable="false" unique="true" uniqueConstraintName="ux_sepa_mandate_reference" />
</column>
<column name="iban" type="varchar(34)">
<constraints nullable="true" />
</column>
<column name="bic" type="varchar(11)">
<constraints nullable="true" />
</column>
<column name="document_date" type="date">
<constraints nullable="false" />
</column>
<column name="valid_from" type="date">
<constraints nullable="false" />
</column>
<column name="valid_until" type="date">
<constraints nullable="true" />
</column>
<column name="last_used" type="date">
<constraints nullable="true" />
</column>
<column name="cancellation_date" type="date">
<constraints nullable="true" />
</column>
<column name="remark" type="varchar(160)">
<constraints nullable="true" />
</column>
<column name="customer_id" type="bigint">
<constraints nullable="false" />
</column>
<!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove-->
</createTable>
</changeSet>
<!-- jhipster-needle-liquibase-add-changeset - JHipster will add changesets here, do not remove-->
</databaseChangeLog>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
<!--
Added the constraints for entity SepaMandate.
-->
<changeSet id="20190418100951-2" author="jhipster">
<addForeignKeyConstraint baseColumnNames="customer_id"
baseTableName="sepa_mandate"
constraintName="fk_sepa_mandate_customer_id"
referencedColumnNames="id"
referencedTableName="customer"/>
</changeSet>
</databaseChangeLog>

View File

@ -11,10 +11,12 @@
<include file="config/liquibase/changelog/20190403083738_added_entity_Membership.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190403083739_added_entity_Share.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190403083740_added_entity_Asset.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190418100951_added_entity_SepaMandate.xml" relativeToChangelogFile="false"/>
<!-- jhipster-needle-liquibase-add-changelog - JHipster will add liquibase changelogs here -->
<include file="config/liquibase/changelog/20190403083737_added_entity_constraints_CustomerContact.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190403083738_added_entity_constraints_Membership.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190403083739_added_entity_constraints_Share.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190403083740_added_entity_constraints_Asset.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190418100951_added_entity_constraints_SepaMandate.xml" relativeToChangelogFile="false"/>
<!-- jhipster-needle-liquibase-add-constraints-changelog - JHipster will add liquibase constraints changelogs here -->
</databaseChangeLog>

View File

@ -5,9 +5,13 @@
<hr>
<jhi-alert-error></jhi-alert-error>
<dl class="row-md jh-entity-details">
<dt><span jhiTranslate="hsadminNgApp.asset.date">Date</span></dt>
<dt><span jhiTranslate="hsadminNgApp.asset.documentDate">Document Date</span></dt>
<dd>
<span>{{asset.date}}</span>
<span>{{asset.documentDate}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.asset.valueDate">Value Date</span></dt>
<dd>
<span>{{asset.valueDate}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.asset.action">Action</span></dt>
<dd>
@ -17,14 +21,14 @@
<dd>
<span>{{asset.amount}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.asset.comment">Comment</span></dt>
<dt><span jhiTranslate="hsadminNgApp.asset.remark">Remark</span></dt>
<dd>
<span>{{asset.comment}}</span>
<span>{{asset.remark}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.asset.member">Member</span></dt>
<dt><span jhiTranslate="hsadminNgApp.asset.membership">Membership</span></dt>
<dd>
<div *ngIf="asset.memberId">
<a [routerLink]="['/membership', asset.memberId, 'view']">{{asset.memberId}}</a>
<div *ngIf="asset.membershipId">
<a [routerLink]="['/membership', asset.membershipId, 'view']">{{asset.membershipDocumentDate}}</a>
</div>
</dd>
</dl>

View File

@ -10,17 +10,33 @@
[(ngModel)]="asset.id" readonly />
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.asset.date" for="field_date">Date</label>
<label class="form-control-label" jhiTranslate="hsadminNgApp.asset.documentDate" for="field_documentDate">Document Date</label>
<div class="input-group">
<input id="field_date" type="text" class="form-control" name="date" ngbDatepicker #dateDp="ngbDatepicker" [(ngModel)]="asset.date"
<input id="field_documentDate" type="text" class="form-control" name="documentDate" ngbDatepicker #documentDateDp="ngbDatepicker" [(ngModel)]="asset.documentDate"
required/>
<span class="input-group-append">
<button type="button" class="btn btn-secondary" (click)="dateDp.toggle()"><fa-icon [icon]="'calendar-alt'"></fa-icon></button>
<button type="button" class="btn btn-secondary" (click)="documentDateDp.toggle()"><fa-icon [icon]="'calendar-alt'"></fa-icon></button>
</span>
</div>
<div [hidden]="!(editForm.controls.date?.dirty && editForm.controls.date?.invalid)">
<div [hidden]="!(editForm.controls.documentDate?.dirty && editForm.controls.documentDate?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.date?.errors?.required" jhiTranslate="entity.validation.required">
[hidden]="!editForm.controls.documentDate?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.asset.valueDate" for="field_valueDate">Value Date</label>
<div class="input-group">
<input id="field_valueDate" type="text" class="form-control" name="valueDate" ngbDatepicker #valueDateDp="ngbDatepicker" [(ngModel)]="asset.valueDate"
required/>
<span class="input-group-append">
<button type="button" class="btn btn-secondary" (click)="valueDateDp.toggle()"><fa-icon [icon]="'calendar-alt'"></fa-icon></button>
</span>
</div>
<div [hidden]="!(editForm.controls.valueDate?.dirty && editForm.controls.valueDate?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.valueDate?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
</div>
@ -58,28 +74,27 @@
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.asset.comment" for="field_comment">Comment</label>
<input type="text" class="form-control" name="comment" id="field_comment"
[(ngModel)]="asset.comment" maxlength="160"/>
<div [hidden]="!(editForm.controls.comment?.dirty && editForm.controls.comment?.invalid)">
<label class="form-control-label" jhiTranslate="hsadminNgApp.asset.remark" for="field_remark">Remark</label>
<input type="text" class="form-control" name="remark" id="field_remark"
[(ngModel)]="asset.remark" maxlength="160"/>
<div [hidden]="!(editForm.controls.remark?.dirty && editForm.controls.remark?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.comment?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 160 }">
[hidden]="!editForm.controls.remark?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 160 }">
This field cannot be longer than 160 characters.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.asset.member" for="field_member">Member</label>
<select class="form-control" id="field_member" name="member" [(ngModel)]="asset.memberId" required>
<option *ngIf="!editForm.value.member" [ngValue]="null" selected></option>
<option [ngValue]="membershipOption.id" *ngFor="let membershipOption of memberships; trackBy: trackMembershipById">{{membershipOption.id}}</option>
<label class="form-control-label" jhiTranslate="hsadminNgApp.asset.membership" for="field_membership">Membership</label>
<select class="form-control" id="field_membership" name="membership" [(ngModel)]="asset.membershipId" required>
<option *ngIf="!editForm.value.membership" [ngValue]="null" selected></option>
<option [ngValue]="membershipOption.id" *ngFor="let membershipOption of memberships; trackBy: trackMembershipById">{{membershipOption.documentDate}}</option>
</select>
</div>
<div [hidden]="!(editForm.controls.member?.dirty && editForm.controls.member?.invalid)">
<div [hidden]="!(editForm.controls.membership?.dirty && editForm.controls.membership?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.member?.errors?.required"
jhiTranslate="entity.validation.required">
[hidden]="!editForm.controls.membership?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
</div>

View File

@ -19,7 +19,8 @@ export class AssetUpdateComponent implements OnInit {
isSaving: boolean;
memberships: IMembership[];
dateDp: any;
documentDateDp: any;
valueDateDp: any;
constructor(
protected jhiAlertService: JhiAlertService,

View File

@ -15,24 +15,26 @@
<thead>
<tr jhiSort [(predicate)]="predicate" [(ascending)]="reverse" [callback]="reset.bind(this)">
<th jhiSortBy="id"><span jhiTranslate="global.field.id">ID</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="date"><span jhiTranslate="hsadminNgApp.asset.date">Date</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="documentDate"><span jhiTranslate="hsadminNgApp.asset.documentDate">Document Date</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="valueDate"><span jhiTranslate="hsadminNgApp.asset.valueDate">Value Date</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="action"><span jhiTranslate="hsadminNgApp.asset.action">Action</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="amount"><span jhiTranslate="hsadminNgApp.asset.amount">Amount</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="comment"><span jhiTranslate="hsadminNgApp.asset.comment">Comment</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="memberId"><span jhiTranslate="hsadminNgApp.asset.member">Member</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="remark"><span jhiTranslate="hsadminNgApp.asset.remark">Remark</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="membershipDocumentDate"><span jhiTranslate="hsadminNgApp.asset.membership">Membership</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th></th>
</tr>
</thead>
<tbody infinite-scroll (scrolled)="loadPage(page + 1)" [infiniteScrollDisabled]="page >= links['last']" [infiniteScrollDistance]="0">
<tr *ngFor="let asset of assets ;trackBy: trackId">
<td><a [routerLink]="['/asset', asset.id, 'view' ]">{{asset.id}}</a></td>
<td>{{asset.date | date:'mediumDate'}}</td>
<td>{{asset.documentDate | date:'mediumDate'}}</td>
<td>{{asset.valueDate | date:'mediumDate'}}</td>
<td jhiTranslate="{{'hsadminNgApp.AssetAction.' + asset.action}}">{{asset.action}}</td>
<td>{{asset.amount}}</td>
<td>{{asset.comment}}</td>
<td>{{asset.remark}}</td>
<td>
<div *ngIf="asset.memberId">
<a [routerLink]="['../membership', asset.memberId , 'view' ]" >{{asset.memberId}}</a>
<div *ngIf="asset.membershipId">
<a [routerLink]="['../membership', asset.membershipId , 'view' ]" >{{asset.membershipDocumentDate}}</a>
</div>
</td>
<td class="text-right">

View File

@ -51,14 +51,16 @@ export class AssetService {
protected convertDateFromClient(asset: IAsset): IAsset {
const copy: IAsset = Object.assign({}, asset, {
date: asset.date != null && asset.date.isValid() ? asset.date.format(DATE_FORMAT) : null
documentDate: asset.documentDate != null && asset.documentDate.isValid() ? asset.documentDate.format(DATE_FORMAT) : null,
valueDate: asset.valueDate != null && asset.valueDate.isValid() ? asset.valueDate.format(DATE_FORMAT) : null
});
return copy;
}
protected convertDateFromServer(res: EntityResponseType): EntityResponseType {
if (res.body) {
res.body.date = res.body.date != null ? moment(res.body.date) : null;
res.body.documentDate = res.body.documentDate != null ? moment(res.body.documentDate) : null;
res.body.valueDate = res.body.valueDate != null ? moment(res.body.valueDate) : null;
}
return res;
}
@ -66,7 +68,8 @@ export class AssetService {
protected convertDateArrayFromServer(res: EntityArrayResponseType): EntityArrayResponseType {
if (res.body) {
res.body.forEach((asset: IAsset) => {
asset.date = asset.date != null ? moment(asset.date) : null;
asset.documentDate = asset.documentDate != null ? moment(asset.documentDate) : null;
asset.valueDate = asset.valueDate != null ? moment(asset.valueDate) : null;
});
}
return res;

View File

@ -5,9 +5,9 @@
<hr>
<jhi-alert-error></jhi-alert-error>
<dl class="row-md jh-entity-details">
<dt><span jhiTranslate="hsadminNgApp.customer.number">Number</span></dt>
<dt><span jhiTranslate="hsadminNgApp.customer.reference">Reference</span></dt>
<dd>
<span>{{customer.number}}</span>
<span>{{customer.reference}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.customer.prefix">Prefix</span></dt>
<dd>
@ -17,21 +17,25 @@
<dd>
<span>{{customer.name}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.customer.contractualSalutation">Contractual Salutation</span></dt>
<dd>
<span>{{customer.contractualSalutation}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.customer.contractualAddress">Contractual Address</span></dt>
<dd>
<span>{{customer.contractualAddress}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.customer.contractualSalutation">Contractual Salutation</span></dt>
<dt><span jhiTranslate="hsadminNgApp.customer.billingSalutation">Billing Salutation</span></dt>
<dd>
<span>{{customer.contractualSalutation}}</span>
<span>{{customer.billingSalutation}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.customer.billingAddress">Billing Address</span></dt>
<dd>
<span>{{customer.billingAddress}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.customer.billingSalutation">Billing Salutation</span></dt>
<dt><span jhiTranslate="hsadminNgApp.customer.remark">Remark</span></dt>
<dd>
<span>{{customer.billingSalutation}}</span>
<span>{{customer.remark}}</span>
</dd>
</dl>

View File

@ -10,24 +10,24 @@
[(ngModel)]="customer.id" readonly />
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.customer.number" for="field_number">Number</label>
<input type="number" class="form-control" name="number" id="field_number"
[(ngModel)]="customer.number" required min="10000" jhiMin="10000" max="99999" jhiMax="99999"/>
<div [hidden]="!(editForm.controls.number?.dirty && editForm.controls.number?.invalid)">
<label class="form-control-label" jhiTranslate="hsadminNgApp.customer.reference" for="field_reference">Reference</label>
<input type="number" class="form-control" name="reference" id="field_reference"
[(ngModel)]="customer.reference" required min="10000" jhiMin="10000" max="99999" jhiMax="99999"/>
<div [hidden]="!(editForm.controls.reference?.dirty && editForm.controls.reference?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.number?.errors?.required" jhiTranslate="entity.validation.required">
[hidden]="!editForm.controls.reference?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
<small class="form-text text-danger"
[hidden]="!editForm.controls.number?.errors?.min" jhiTranslate="entity.validation.min" [translateValues]="{ min: 10000 }">
[hidden]="!editForm.controls.reference?.errors?.min" jhiTranslate="entity.validation.min" [translateValues]="{ min: 10000 }">
This field should be at least 10000.
</small>
<small class="form-text text-danger"
[hidden]="!editForm.controls.number?.errors?.max" jhiTranslate="entity.validation.max" [translateValues]="{ max: 99999 }">
[hidden]="!editForm.controls.reference?.errors?.max" jhiTranslate="entity.validation.max" [translateValues]="{ max: 99999 }">
This field cannot be more than 99999.
</small>
<small class="form-text text-danger"
[hidden]="!editForm.controls.number?.errors?.number" jhiTranslate="entity.validation.number">
[hidden]="!editForm.controls.reference?.errors?.number" jhiTranslate="entity.validation.number">
This field should be a number.
</small>
</div>
@ -35,12 +35,16 @@
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.customer.prefix" for="field_prefix">Prefix</label>
<input type="text" class="form-control" name="prefix" id="field_prefix"
[(ngModel)]="customer.prefix" required pattern="[a-z][a-z0-9]+"/>
[(ngModel)]="customer.prefix" required maxlength="3" pattern="[a-z][a-z0-9]+"/>
<div [hidden]="!(editForm.controls.prefix?.dirty && editForm.controls.prefix?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.prefix?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
<small class="form-text text-danger"
[hidden]="!editForm.controls.prefix?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 3 }">
This field cannot be longer than 3 characters.
</small>
<small class="form-text text-danger"
[hidden]="!editForm.controls.prefix?.errors?.pattern" jhiTranslate="entity.validation.pattern" [translateValues]="{ pattern: 'Prefix' }">
This field should follow pattern for "Prefix".
@ -48,82 +52,76 @@
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.customer.name"
for="field_name">Name</label>
<label class="form-control-label" jhiTranslate="hsadminNgApp.customer.name" for="field_name">Name</label>
<input type="text" class="form-control" name="name" id="field_name"
[(ngModel)]="customer.name" required maxlength="80"/>
[(ngModel)]="customer.name" required maxlength="80"/>
<div [hidden]="!(editForm.controls.name?.dirty && editForm.controls.name?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.name?.errors?.required"
jhiTranslate="entity.validation.required">
This field is required.
[hidden]="!editForm.controls.name?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
<small class="form-text text-danger"
[hidden]="!editForm.controls.name?.errors?.maxlength"
jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 80 }">
This field cannot be longer than 80 characters.
[hidden]="!editForm.controls.name?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 80 }">
This field cannot be longer than 80 characters.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.customer.contractualAddress"
for="field_contractualAddress">Contractual Address</label>
<label class="form-control-label" jhiTranslate="hsadminNgApp.customer.contractualSalutation" for="field_contractualSalutation">Contractual Salutation</label>
<input type="text" class="form-control" name="contractualSalutation" id="field_contractualSalutation"
[(ngModel)]="customer.contractualSalutation" maxlength="80"/>
<div [hidden]="!(editForm.controls.contractualSalutation?.dirty && editForm.controls.contractualSalutation?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.contractualSalutation?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 80 }">
This field cannot be longer than 80 characters.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.customer.contractualAddress" for="field_contractualAddress">Contractual Address</label>
<input type="text" class="form-control" name="contractualAddress" id="field_contractualAddress"
[(ngModel)]="customer.contractualAddress" required maxlength="400"/>
<div
[hidden]="!(editForm.controls.contractualAddress?.dirty && editForm.controls.contractualAddress?.invalid)">
[(ngModel)]="customer.contractualAddress" required maxlength="400"/>
<div [hidden]="!(editForm.controls.contractualAddress?.dirty && editForm.controls.contractualAddress?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.contractualAddress?.errors?.required"
jhiTranslate="entity.validation.required">
This field is required.
[hidden]="!editForm.controls.contractualAddress?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
<small class="form-text text-danger"
[hidden]="!editForm.controls.contractualAddress?.errors?.maxlength"
jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 400 }">
This field cannot be longer than 400 characters.
[hidden]="!editForm.controls.contractualAddress?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 400 }">
This field cannot be longer than 400 characters.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.customer.contractualSalutation"
for="field_contractualSalutation">Contractual Salutation</label>
<input type="text" class="form-control" name="contractualSalutation"
id="field_contractualSalutation"
[(ngModel)]="customer.contractualSalutation" maxlength="80"/>
<div
[hidden]="!(editForm.controls.contractualSalutation?.dirty && editForm.controls.contractualSalutation?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.contractualSalutation?.errors?.maxlength"
jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 80 }">
This field cannot be longer than 80 characters.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.customer.billingAddress"
for="field_billingAddress">Billing Address</label>
<input type="text" class="form-control" name="billingAddress" id="field_billingAddress"
[(ngModel)]="customer.billingAddress" maxlength="400"/>
<div
[hidden]="!(editForm.controls.billingAddress?.dirty && editForm.controls.billingAddress?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.billingAddress?.errors?.maxlength"
jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 400 }">
This field cannot be longer than 400 characters.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.customer.billingSalutation"
for="field_billingSalutation">Billing Salutation</label>
<label class="form-control-label" jhiTranslate="hsadminNgApp.customer.billingSalutation" for="field_billingSalutation">Billing Salutation</label>
<input type="text" class="form-control" name="billingSalutation" id="field_billingSalutation"
[(ngModel)]="customer.billingSalutation" maxlength="80"/>
<div
[hidden]="!(editForm.controls.billingSalutation?.dirty && editForm.controls.billingSalutation?.invalid)">
[(ngModel)]="customer.billingSalutation" maxlength="80"/>
<div [hidden]="!(editForm.controls.billingSalutation?.dirty && editForm.controls.billingSalutation?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.billingSalutation?.errors?.maxlength"
jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 80 }">
This field cannot be longer than 80 characters.
[hidden]="!editForm.controls.billingSalutation?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 80 }">
This field cannot be longer than 80 characters.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.customer.billingAddress" for="field_billingAddress">Billing Address</label>
<input type="text" class="form-control" name="billingAddress" id="field_billingAddress"
[(ngModel)]="customer.billingAddress" maxlength="400"/>
<div [hidden]="!(editForm.controls.billingAddress?.dirty && editForm.controls.billingAddress?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.billingAddress?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 400 }">
This field cannot be longer than 400 characters.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.customer.remark" for="field_remark">Remark</label>
<input type="text" class="form-control" name="remark" id="field_remark"
[(ngModel)]="customer.remark" maxlength="160"/>
<div [hidden]="!(editForm.controls.remark?.dirty && editForm.controls.remark?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.remark?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 160 }">
This field cannot be longer than 160 characters.
</small>
</div>
</div>

View File

@ -15,37 +15,28 @@
<thead>
<tr jhiSort [(predicate)]="predicate" [(ascending)]="reverse" [callback]="reset.bind(this)">
<th jhiSortBy="id"><span jhiTranslate="global.field.id">ID</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="number"><span jhiTranslate="hsadminNgApp.customer.number">Number</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="reference"><span jhiTranslate="hsadminNgApp.customer.reference">Reference</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="prefix"><span jhiTranslate="hsadminNgApp.customer.prefix">Prefix</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="name"><span jhiTranslate="hsadminNgApp.customer.name">Name</span>
<fa-icon [icon]="'sort'"></fa-icon>
</th>
<th jhiSortBy="contractualAddress"><span jhiTranslate="hsadminNgApp.customer.contractualAddress">Contractual Address</span>
<fa-icon [icon]="'sort'"></fa-icon>
</th>
<th jhiSortBy="contractualSalutation"><span jhiTranslate="hsadminNgApp.customer.contractualSalutation">Contractual Salutation</span>
<fa-icon [icon]="'sort'"></fa-icon>
</th>
<th jhiSortBy="billingAddress"><span
jhiTranslate="hsadminNgApp.customer.billingAddress">Billing Address</span>
<fa-icon [icon]="'sort'"></fa-icon>
</th>
<th jhiSortBy="billingSalutation"><span jhiTranslate="hsadminNgApp.customer.billingSalutation">Billing Salutation</span>
<fa-icon [icon]="'sort'"></fa-icon>
</th>
<th jhiSortBy="name"><span jhiTranslate="hsadminNgApp.customer.name">Name</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="contractualSalutation"><span jhiTranslate="hsadminNgApp.customer.contractualSalutation">Contractual Salutation</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="contractualAddress"><span jhiTranslate="hsadminNgApp.customer.contractualAddress">Contractual Address</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="billingSalutation"><span jhiTranslate="hsadminNgApp.customer.billingSalutation">Billing Salutation</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="billingAddress"><span jhiTranslate="hsadminNgApp.customer.billingAddress">Billing Address</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="remark"><span jhiTranslate="hsadminNgApp.customer.remark">Remark</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th></th>
</tr>
</thead>
<tbody infinite-scroll (scrolled)="loadPage(page + 1)" [infiniteScrollDisabled]="page >= links['last']" [infiniteScrollDistance]="0">
<tr *ngFor="let customer of customers ;trackBy: trackId">
<td><a [routerLink]="['/customer', customer.id, 'view' ]">{{customer.id}}</a></td>
<td>{{customer.number}}</td>
<td>{{customer.reference}}</td>
<td>{{customer.prefix}}</td>
<td>{{customer.name}}</td>
<td>{{customer.contractualAddress}}</td>
<td>{{customer.contractualSalutation}}</td>
<td>{{customer.billingAddress}}</td>
<td>{{customer.contractualAddress}}</td>
<td>{{customer.billingSalutation}}</td>
<td>{{customer.billingAddress}}</td>
<td>{{customer.remark}}</td>
<td class="text-right">
<div class="btn-group flex-btn-group-container">
<button type="submit"

View File

@ -43,6 +43,26 @@ import { RouterModule } from '@angular/router';
{
path: 'asset',
loadChildren: './asset/asset.module#HsadminNgAssetModule'
},
{
path: 'customer',
loadChildren: './customer/customer.module#HsadminNgCustomerModule'
},
{
path: 'membership',
loadChildren: './membership/membership.module#HsadminNgMembershipModule'
},
{
path: 'share',
loadChildren: './share/share.module#HsadminNgShareModule'
},
{
path: 'asset',
loadChildren: './asset/asset.module#HsadminNgAssetModule'
},
{
path: 'sepa-mandate',
loadChildren: './sepa-mandate/sepa-mandate.module#HsadminNgSepaMandateModule'
}
/* jhipster-needle-add-entity-route - JHipster will add entity modules routes here */
])

View File

@ -5,13 +5,21 @@
<hr>
<jhi-alert-error></jhi-alert-error>
<dl class="row-md jh-entity-details">
<dt><span jhiTranslate="hsadminNgApp.membership.sinceDate">Since Date</span></dt>
<dt><span jhiTranslate="hsadminNgApp.membership.documentDate">Document Date</span></dt>
<dd>
<span>{{membership.sinceDate}}</span>
<span>{{membership.documentDate}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.membership.untilDate">Until Date</span></dt>
<dt><span jhiTranslate="hsadminNgApp.membership.memberFrom">Member From</span></dt>
<dd>
<span>{{membership.untilDate}}</span>
<span>{{membership.memberFrom}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.membership.memberUntil">Member Until</span></dt>
<dd>
<span>{{membership.memberUntil}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.membership.remark">Remark</span></dt>
<dd>
<span>{{membership.remark}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.membership.customer">Customer</span></dt>
<dd>

View File

@ -10,44 +10,69 @@
[(ngModel)]="membership.id" readonly />
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.membership.sinceDate" for="field_sinceDate">Since Date</label>
<label class="form-control-label" jhiTranslate="hsadminNgApp.membership.documentDate" for="field_documentDate">Document Date</label>
<div class="input-group">
<input id="field_sinceDate" type="text" class="form-control" name="sinceDate" ngbDatepicker #sinceDateDp="ngbDatepicker" [(ngModel)]="membership.sinceDate"
<input id="field_documentDate" type="text" class="form-control" name="documentDate" ngbDatepicker #documentDateDp="ngbDatepicker" [(ngModel)]="membership.documentDate"
required/>
<span class="input-group-append">
<button type="button" class="btn btn-secondary" (click)="sinceDateDp.toggle()"><fa-icon [icon]="'calendar-alt'"></fa-icon></button>
<button type="button" class="btn btn-secondary" (click)="documentDateDp.toggle()"><fa-icon [icon]="'calendar-alt'"></fa-icon></button>
</span>
</div>
<div [hidden]="!(editForm.controls.sinceDate?.dirty && editForm.controls.sinceDate?.invalid)">
<div [hidden]="!(editForm.controls.documentDate?.dirty && editForm.controls.documentDate?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.sinceDate?.errors?.required" jhiTranslate="entity.validation.required">
[hidden]="!editForm.controls.documentDate?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.membership.untilDate" for="field_untilDate">Until Date</label>
<label class="form-control-label" jhiTranslate="hsadminNgApp.membership.memberFrom" for="field_memberFrom">Member From</label>
<div class="input-group">
<input id="field_untilDate" type="text" class="form-control" name="untilDate" ngbDatepicker #untilDateDp="ngbDatepicker" [(ngModel)]="membership.untilDate"
<input id="field_memberFrom" type="text" class="form-control" name="memberFrom" ngbDatepicker #memberFromDp="ngbDatepicker" [(ngModel)]="membership.memberFrom"
required/>
<span class="input-group-append">
<button type="button" class="btn btn-secondary" (click)="memberFromDp.toggle()"><fa-icon [icon]="'calendar-alt'"></fa-icon></button>
</span>
</div>
<div [hidden]="!(editForm.controls.memberFrom?.dirty && editForm.controls.memberFrom?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.memberFrom?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.membership.memberUntil" for="field_memberUntil">Member Until</label>
<div class="input-group">
<input id="field_memberUntil" type="text" class="form-control" name="memberUntil" ngbDatepicker #memberUntilDp="ngbDatepicker" [(ngModel)]="membership.memberUntil"
/>
<span class="input-group-append">
<button type="button" class="btn btn-secondary" (click)="untilDateDp.toggle()"><fa-icon [icon]="'calendar-alt'"></fa-icon></button>
<button type="button" class="btn btn-secondary" (click)="memberUntilDp.toggle()"><fa-icon [icon]="'calendar-alt'"></fa-icon></button>
</span>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.membership.remark" for="field_remark">Remark</label>
<input type="text" class="form-control" name="remark" id="field_remark"
[(ngModel)]="membership.remark" maxlength="160"/>
<div [hidden]="!(editForm.controls.remark?.dirty && editForm.controls.remark?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.remark?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 160 }">
This field cannot be longer than 160 characters.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.membership.customer" for="field_customer">Customer</label>
<select class="form-control" id="field_customer" name="customer" [(ngModel)]="membership.customerId"
required>
<select class="form-control" id="field_customer" name="customer" [(ngModel)]="membership.customerId" required>
<option *ngIf="!editForm.value.customer" [ngValue]="null" selected></option>
<option [ngValue]="customerOption.id" *ngFor="let customerOption of customers; trackBy: trackCustomerById">{{customerOption.prefix}}</option>
</select>
</div>
<div [hidden]="!(editForm.controls.customer?.dirty && editForm.controls.customer?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.customer?.errors?.required"
jhiTranslate="entity.validation.required">
[hidden]="!editForm.controls.customer?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
</div>

View File

@ -19,8 +19,9 @@ export class MembershipUpdateComponent implements OnInit {
isSaving: boolean;
customers: ICustomer[];
sinceDateDp: any;
untilDateDp: any;
documentDateDp: any;
memberFromDp: any;
memberUntilDp: any;
constructor(
protected jhiAlertService: JhiAlertService,

View File

@ -15,8 +15,10 @@
<thead>
<tr jhiSort [(predicate)]="predicate" [(ascending)]="reverse" [callback]="reset.bind(this)">
<th jhiSortBy="id"><span jhiTranslate="global.field.id">ID</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="sinceDate"><span jhiTranslate="hsadminNgApp.membership.sinceDate">Since Date</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="untilDate"><span jhiTranslate="hsadminNgApp.membership.untilDate">Until Date</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="documentDate"><span jhiTranslate="hsadminNgApp.membership.documentDate">Document Date</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="memberFrom"><span jhiTranslate="hsadminNgApp.membership.memberFrom">Member From</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="memberUntil"><span jhiTranslate="hsadminNgApp.membership.memberUntil">Member Until</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="remark"><span jhiTranslate="hsadminNgApp.membership.remark">Remark</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="customerPrefix"><span jhiTranslate="hsadminNgApp.membership.customer">Customer</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th></th>
</tr>
@ -24,8 +26,10 @@
<tbody infinite-scroll (scrolled)="loadPage(page + 1)" [infiniteScrollDisabled]="page >= links['last']" [infiniteScrollDistance]="0">
<tr *ngFor="let membership of memberships ;trackBy: trackId">
<td><a [routerLink]="['/membership', membership.id, 'view' ]">{{membership.id}}</a></td>
<td>{{membership.sinceDate | date:'mediumDate'}}</td>
<td>{{membership.untilDate | date:'mediumDate'}}</td>
<td>{{membership.documentDate | date:'mediumDate'}}</td>
<td>{{membership.memberFrom | date:'mediumDate'}}</td>
<td>{{membership.memberUntil | date:'mediumDate'}}</td>
<td>{{membership.remark}}</td>
<td>
<div *ngIf="membership.customerId">
<a [routerLink]="['../customer', membership.customerId , 'view' ]" >{{membership.customerPrefix}}</a>

View File

@ -51,16 +51,20 @@ export class MembershipService {
protected convertDateFromClient(membership: IMembership): IMembership {
const copy: IMembership = Object.assign({}, membership, {
sinceDate: membership.sinceDate != null && membership.sinceDate.isValid() ? membership.sinceDate.format(DATE_FORMAT) : null,
untilDate: membership.untilDate != null && membership.untilDate.isValid() ? membership.untilDate.format(DATE_FORMAT) : null
documentDate:
membership.documentDate != null && membership.documentDate.isValid() ? membership.documentDate.format(DATE_FORMAT) : null,
memberFrom: membership.memberFrom != null && membership.memberFrom.isValid() ? membership.memberFrom.format(DATE_FORMAT) : null,
memberUntil:
membership.memberUntil != null && membership.memberUntil.isValid() ? membership.memberUntil.format(DATE_FORMAT) : null
});
return copy;
}
protected convertDateFromServer(res: EntityResponseType): EntityResponseType {
if (res.body) {
res.body.sinceDate = res.body.sinceDate != null ? moment(res.body.sinceDate) : null;
res.body.untilDate = res.body.untilDate != null ? moment(res.body.untilDate) : null;
res.body.documentDate = res.body.documentDate != null ? moment(res.body.documentDate) : null;
res.body.memberFrom = res.body.memberFrom != null ? moment(res.body.memberFrom) : null;
res.body.memberUntil = res.body.memberUntil != null ? moment(res.body.memberUntil) : null;
}
return res;
}
@ -68,8 +72,9 @@ export class MembershipService {
protected convertDateArrayFromServer(res: EntityArrayResponseType): EntityArrayResponseType {
if (res.body) {
res.body.forEach((membership: IMembership) => {
membership.sinceDate = membership.sinceDate != null ? moment(membership.sinceDate) : null;
membership.untilDate = membership.untilDate != null ? moment(membership.untilDate) : null;
membership.documentDate = membership.documentDate != null ? moment(membership.documentDate) : null;
membership.memberFrom = membership.memberFrom != null ? moment(membership.memberFrom) : null;
membership.memberUntil = membership.memberUntil != null ? moment(membership.memberUntil) : null;
});
}
return res;

View File

@ -0,0 +1,6 @@
export * from './sepa-mandate.service';
export * from './sepa-mandate-update.component';
export * from './sepa-mandate-delete-dialog.component';
export * from './sepa-mandate-detail.component';
export * from './sepa-mandate.component';
export * from './sepa-mandate.route';

View File

@ -0,0 +1,19 @@
<form name="deleteForm" (ngSubmit)="confirmDelete(sepaMandate.id)">
<div class="modal-header">
<h4 class="modal-title" jhiTranslate="entity.delete.title">Confirm delete operation</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"
(click)="clear()">&times;</button>
</div>
<div class="modal-body">
<jhi-alert-error></jhi-alert-error>
<p id="jhi-delete-sepaMandate-heading" jhiTranslate="hsadminNgApp.sepaMandate.delete.question" [translateValues]="{id: sepaMandate.id}">Are you sure you want to delete this Sepa Mandate?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" (click)="clear()">
<fa-icon [icon]="'ban'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
</button>
<button id="jhi-confirm-delete-sepaMandate" type="submit" class="btn btn-danger">
<fa-icon [icon]="'times'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.delete">Delete</span>
</button>
</div>
</form>

View File

@ -0,0 +1,72 @@
import { Component, OnInit, OnDestroy } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { NgbActiveModal, NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
import { JhiEventManager } from 'ng-jhipster';
import { ISepaMandate } from 'app/shared/model/sepa-mandate.model';
import { SepaMandateService } from './sepa-mandate.service';
@Component({
selector: 'jhi-sepa-mandate-delete-dialog',
templateUrl: './sepa-mandate-delete-dialog.component.html'
})
export class SepaMandateDeleteDialogComponent {
sepaMandate: ISepaMandate;
constructor(
protected sepaMandateService: SepaMandateService,
public activeModal: NgbActiveModal,
protected eventManager: JhiEventManager
) {}
clear() {
this.activeModal.dismiss('cancel');
}
confirmDelete(id: number) {
this.sepaMandateService.delete(id).subscribe(response => {
this.eventManager.broadcast({
name: 'sepaMandateListModification',
content: 'Deleted an sepaMandate'
});
this.activeModal.dismiss(true);
});
}
}
@Component({
selector: 'jhi-sepa-mandate-delete-popup',
template: ''
})
export class SepaMandateDeletePopupComponent implements OnInit, OnDestroy {
protected ngbModalRef: NgbModalRef;
constructor(protected activatedRoute: ActivatedRoute, protected router: Router, protected modalService: NgbModal) {}
ngOnInit() {
this.activatedRoute.data.subscribe(({ sepaMandate }) => {
setTimeout(() => {
this.ngbModalRef = this.modalService.open(SepaMandateDeleteDialogComponent as Component, {
size: 'lg',
backdrop: 'static'
});
this.ngbModalRef.componentInstance.sepaMandate = sepaMandate;
this.ngbModalRef.result.then(
result => {
this.router.navigate(['/sepa-mandate', { outlets: { popup: null } }]);
this.ngbModalRef = null;
},
reason => {
this.router.navigate(['/sepa-mandate', { outlets: { popup: null } }]);
this.ngbModalRef = null;
}
);
}, 0);
});
}
ngOnDestroy() {
this.ngbModalRef = null;
}
}

View File

@ -0,0 +1,65 @@
<div class="row justify-content-center">
<div class="col-8">
<div *ngIf="sepaMandate">
<h2><span jhiTranslate="hsadminNgApp.sepaMandate.detail.title">Sepa Mandate</span> {{sepaMandate.id}}</h2>
<hr>
<jhi-alert-error></jhi-alert-error>
<dl class="row-md jh-entity-details">
<dt><span jhiTranslate="hsadminNgApp.sepaMandate.reference">Reference</span></dt>
<dd>
<span>{{sepaMandate.reference}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.sepaMandate.iban">Iban</span></dt>
<dd>
<span>{{sepaMandate.iban}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.sepaMandate.bic">Bic</span></dt>
<dd>
<span>{{sepaMandate.bic}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.sepaMandate.documentDate">Document Date</span></dt>
<dd>
<span>{{sepaMandate.documentDate}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.sepaMandate.validFrom">Valid From</span></dt>
<dd>
<span>{{sepaMandate.validFrom}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.sepaMandate.validUntil">Valid Until</span></dt>
<dd>
<span>{{sepaMandate.validUntil}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.sepaMandate.lastUsed">Last Used</span></dt>
<dd>
<span>{{sepaMandate.lastUsed}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.sepaMandate.cancellationDate">Cancellation Date</span></dt>
<dd>
<span>{{sepaMandate.cancellationDate}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.sepaMandate.remark">Remark</span></dt>
<dd>
<span>{{sepaMandate.remark}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.sepaMandate.customer">Customer</span></dt>
<dd>
<div *ngIf="sepaMandate.customerId">
<a [routerLink]="['/customer', sepaMandate.customerId, 'view']">{{sepaMandate.customerPrefix}}</a>
</div>
</dd>
</dl>
<button type="submit"
(click)="previousState()"
class="btn btn-info">
<fa-icon [icon]="'arrow-left'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.back"> Back</span>
</button>
<button type="button"
[routerLink]="['/sepa-mandate', sepaMandate.id, 'edit']"
class="btn btn-primary">
<fa-icon [icon]="'pencil-alt'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.edit"> Edit</span>
</button>
</div>
</div>
</div>

View File

@ -0,0 +1,24 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { ISepaMandate } from 'app/shared/model/sepa-mandate.model';
@Component({
selector: 'jhi-sepa-mandate-detail',
templateUrl: './sepa-mandate-detail.component.html'
})
export class SepaMandateDetailComponent implements OnInit {
sepaMandate: ISepaMandate;
constructor(protected activatedRoute: ActivatedRoute) {}
ngOnInit() {
this.activatedRoute.data.subscribe(({ sepaMandate }) => {
this.sepaMandate = sepaMandate;
});
}
previousState() {
window.history.back();
}
}

View File

@ -0,0 +1,147 @@
<div class="row justify-content-center">
<div class="col-8">
<form name="editForm" role="form" novalidate (ngSubmit)="save()" #editForm="ngForm">
<h2 id="jhi-sepa-mandate-heading" jhiTranslate="hsadminNgApp.sepaMandate.home.createOrEditLabel">Create or edit a Sepa Mandate</h2>
<div>
<jhi-alert-error></jhi-alert-error>
<div class="form-group" [hidden]="!sepaMandate.id">
<label for="id" jhiTranslate="global.field.id">ID</label>
<input type="text" class="form-control" id="id" name="id"
[(ngModel)]="sepaMandate.id" readonly />
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.sepaMandate.reference" for="field_reference">Reference</label>
<input type="text" class="form-control" name="reference" id="field_reference"
[(ngModel)]="sepaMandate.reference" required maxlength="40"/>
<div [hidden]="!(editForm.controls.reference?.dirty && editForm.controls.reference?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.reference?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
<small class="form-text text-danger"
[hidden]="!editForm.controls.reference?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 40 }">
This field cannot be longer than 40 characters.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.sepaMandate.iban" for="field_iban">Iban</label>
<input type="text" class="form-control" name="iban" id="field_iban"
[(ngModel)]="sepaMandate.iban" maxlength="34"/>
<div [hidden]="!(editForm.controls.iban?.dirty && editForm.controls.iban?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.iban?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 34 }">
This field cannot be longer than 34 characters.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.sepaMandate.bic" for="field_bic">Bic</label>
<input type="text" class="form-control" name="bic" id="field_bic"
[(ngModel)]="sepaMandate.bic" maxlength="11"/>
<div [hidden]="!(editForm.controls.bic?.dirty && editForm.controls.bic?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.bic?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 11 }">
This field cannot be longer than 11 characters.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.sepaMandate.documentDate" for="field_documentDate">Document Date</label>
<div class="input-group">
<input id="field_documentDate" type="text" class="form-control" name="documentDate" ngbDatepicker #documentDateDp="ngbDatepicker" [(ngModel)]="sepaMandate.documentDate"
required/>
<span class="input-group-append">
<button type="button" class="btn btn-secondary" (click)="documentDateDp.toggle()"><fa-icon [icon]="'calendar-alt'"></fa-icon></button>
</span>
</div>
<div [hidden]="!(editForm.controls.documentDate?.dirty && editForm.controls.documentDate?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.documentDate?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.sepaMandate.validFrom" for="field_validFrom">Valid From</label>
<div class="input-group">
<input id="field_validFrom" type="text" class="form-control" name="validFrom" ngbDatepicker #validFromDp="ngbDatepicker" [(ngModel)]="sepaMandate.validFrom"
required/>
<span class="input-group-append">
<button type="button" class="btn btn-secondary" (click)="validFromDp.toggle()"><fa-icon [icon]="'calendar-alt'"></fa-icon></button>
</span>
</div>
<div [hidden]="!(editForm.controls.validFrom?.dirty && editForm.controls.validFrom?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.validFrom?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.sepaMandate.validUntil" for="field_validUntil">Valid Until</label>
<div class="input-group">
<input id="field_validUntil" type="text" class="form-control" name="validUntil" ngbDatepicker #validUntilDp="ngbDatepicker" [(ngModel)]="sepaMandate.validUntil"
/>
<span class="input-group-append">
<button type="button" class="btn btn-secondary" (click)="validUntilDp.toggle()"><fa-icon [icon]="'calendar-alt'"></fa-icon></button>
</span>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.sepaMandate.lastUsed" for="field_lastUsed">Last Used</label>
<div class="input-group">
<input id="field_lastUsed" type="text" class="form-control" name="lastUsed" ngbDatepicker #lastUsedDp="ngbDatepicker" [(ngModel)]="sepaMandate.lastUsed"
/>
<span class="input-group-append">
<button type="button" class="btn btn-secondary" (click)="lastUsedDp.toggle()"><fa-icon [icon]="'calendar-alt'"></fa-icon></button>
</span>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.sepaMandate.cancellationDate" for="field_cancellationDate">Cancellation Date</label>
<div class="input-group">
<input id="field_cancellationDate" type="text" class="form-control" name="cancellationDate" ngbDatepicker #cancellationDateDp="ngbDatepicker" [(ngModel)]="sepaMandate.cancellationDate"
/>
<span class="input-group-append">
<button type="button" class="btn btn-secondary" (click)="cancellationDateDp.toggle()"><fa-icon [icon]="'calendar-alt'"></fa-icon></button>
</span>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.sepaMandate.remark" for="field_remark">Remark</label>
<input type="text" class="form-control" name="remark" id="field_remark"
[(ngModel)]="sepaMandate.remark" maxlength="160"/>
<div [hidden]="!(editForm.controls.remark?.dirty && editForm.controls.remark?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.remark?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 160 }">
This field cannot be longer than 160 characters.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.sepaMandate.customer" for="field_customer">Customer</label>
<select class="form-control" id="field_customer" name="customer" [(ngModel)]="sepaMandate.customerId" required>
<option *ngIf="!editForm.value.customer" [ngValue]="null" selected></option>
<option [ngValue]="customerOption.id" *ngFor="let customerOption of customers; trackBy: trackCustomerById">{{customerOption.prefix}}</option>
</select>
</div>
<div [hidden]="!(editForm.controls.customer?.dirty && editForm.controls.customer?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.customer?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
</div>
</div>
<div>
<button type="button" id="cancel-save" class="btn btn-secondary" (click)="previousState()">
<fa-icon [icon]="'ban'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
</button>
<button type="submit" id="save-entity" [disabled]="editForm.form.invalid || isSaving" class="btn btn-primary">
<fa-icon [icon]="'save'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.save">Save</span>
</button>
</div>
</form>
</div>
</div>

View File

@ -0,0 +1,82 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { HttpResponse, HttpErrorResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import * as moment from 'moment';
import { JhiAlertService } from 'ng-jhipster';
import { ISepaMandate } from 'app/shared/model/sepa-mandate.model';
import { SepaMandateService } from './sepa-mandate.service';
import { ICustomer } from 'app/shared/model/customer.model';
import { CustomerService } from 'app/entities/customer';
@Component({
selector: 'jhi-sepa-mandate-update',
templateUrl: './sepa-mandate-update.component.html'
})
export class SepaMandateUpdateComponent implements OnInit {
sepaMandate: ISepaMandate;
isSaving: boolean;
customers: ICustomer[];
documentDateDp: any;
validFromDp: any;
validUntilDp: any;
lastUsedDp: any;
cancellationDateDp: any;
constructor(
protected jhiAlertService: JhiAlertService,
protected sepaMandateService: SepaMandateService,
protected customerService: CustomerService,
protected activatedRoute: ActivatedRoute
) {}
ngOnInit() {
this.isSaving = false;
this.activatedRoute.data.subscribe(({ sepaMandate }) => {
this.sepaMandate = sepaMandate;
});
this.customerService
.query()
.pipe(
filter((mayBeOk: HttpResponse<ICustomer[]>) => mayBeOk.ok),
map((response: HttpResponse<ICustomer[]>) => response.body)
)
.subscribe((res: ICustomer[]) => (this.customers = res), (res: HttpErrorResponse) => this.onError(res.message));
}
previousState() {
window.history.back();
}
save() {
this.isSaving = true;
if (this.sepaMandate.id !== undefined) {
this.subscribeToSaveResponse(this.sepaMandateService.update(this.sepaMandate));
} else {
this.subscribeToSaveResponse(this.sepaMandateService.create(this.sepaMandate));
}
}
protected subscribeToSaveResponse(result: Observable<HttpResponse<ISepaMandate>>) {
result.subscribe((res: HttpResponse<ISepaMandate>) => this.onSaveSuccess(), (res: HttpErrorResponse) => this.onSaveError());
}
protected onSaveSuccess() {
this.isSaving = false;
this.previousState();
}
protected onSaveError() {
this.isSaving = false;
}
protected onError(errorMessage: string) {
this.jhiAlertService.error(errorMessage, null, null);
}
trackCustomerById(index: number, item: ICustomer) {
return item.id;
}
}

View File

@ -0,0 +1,76 @@
<div>
<h2 id="page-heading">
<span jhiTranslate="hsadminNgApp.sepaMandate.home.title">Sepa Mandates</span>
<button id="jh-create-entity" class="btn btn-primary float-right jh-create-entity create-sepa-mandate" [routerLink]="['/sepa-mandate/new']">
<fa-icon [icon]="'plus'"></fa-icon>
<span jhiTranslate="hsadminNgApp.sepaMandate.home.createLabel">
Create new Sepa Mandate
</span>
</button>
</h2>
<jhi-alert></jhi-alert>
<br/>
<div class="table-responsive" *ngIf="sepaMandates">
<table class="table table-striped">
<thead>
<tr jhiSort [(predicate)]="predicate" [(ascending)]="reverse" [callback]="reset.bind(this)">
<th jhiSortBy="id"><span jhiTranslate="global.field.id">ID</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="reference"><span jhiTranslate="hsadminNgApp.sepaMandate.reference">Reference</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="iban"><span jhiTranslate="hsadminNgApp.sepaMandate.iban">Iban</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="bic"><span jhiTranslate="hsadminNgApp.sepaMandate.bic">Bic</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="documentDate"><span jhiTranslate="hsadminNgApp.sepaMandate.documentDate">Document Date</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="validFrom"><span jhiTranslate="hsadminNgApp.sepaMandate.validFrom">Valid From</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="validUntil"><span jhiTranslate="hsadminNgApp.sepaMandate.validUntil">Valid Until</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="lastUsed"><span jhiTranslate="hsadminNgApp.sepaMandate.lastUsed">Last Used</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="cancellationDate"><span jhiTranslate="hsadminNgApp.sepaMandate.cancellationDate">Cancellation Date</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="remark"><span jhiTranslate="hsadminNgApp.sepaMandate.remark">Remark</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="customerPrefix"><span jhiTranslate="hsadminNgApp.sepaMandate.customer">Customer</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th></th>
</tr>
</thead>
<tbody infinite-scroll (scrolled)="loadPage(page + 1)" [infiniteScrollDisabled]="page >= links['last']" [infiniteScrollDistance]="0">
<tr *ngFor="let sepaMandate of sepaMandates ;trackBy: trackId">
<td><a [routerLink]="['/sepa-mandate', sepaMandate.id, 'view' ]">{{sepaMandate.id}}</a></td>
<td>{{sepaMandate.reference}}</td>
<td>{{sepaMandate.iban}}</td>
<td>{{sepaMandate.bic}}</td>
<td>{{sepaMandate.documentDate | date:'mediumDate'}}</td>
<td>{{sepaMandate.validFrom | date:'mediumDate'}}</td>
<td>{{sepaMandate.validUntil | date:'mediumDate'}}</td>
<td>{{sepaMandate.lastUsed | date:'mediumDate'}}</td>
<td>{{sepaMandate.cancellationDate | date:'mediumDate'}}</td>
<td>{{sepaMandate.remark}}</td>
<td>
<div *ngIf="sepaMandate.customerId">
<a [routerLink]="['../customer', sepaMandate.customerId , 'view' ]" >{{sepaMandate.customerPrefix}}</a>
</div>
</td>
<td class="text-right">
<div class="btn-group flex-btn-group-container">
<button type="submit"
[routerLink]="['/sepa-mandate', sepaMandate.id, 'view' ]"
class="btn btn-info btn-sm">
<fa-icon [icon]="'eye'"></fa-icon>
<span class="d-none d-md-inline" jhiTranslate="entity.action.view">View</span>
</button>
<button type="submit"
[routerLink]="['/sepa-mandate', sepaMandate.id, 'edit']"
class="btn btn-primary btn-sm">
<fa-icon [icon]="'pencil-alt'"></fa-icon>
<span class="d-none d-md-inline" jhiTranslate="entity.action.edit">Edit</span>
</button>
<button type="submit"
[routerLink]="['/', 'sepa-mandate', { outlets: { popup: sepaMandate.id + '/delete'} }]"
replaceUrl="true"
queryParamsHandling="merge"
class="btn btn-danger btn-sm">
<fa-icon [icon]="'times'"></fa-icon>
<span class="d-none d-md-inline" jhiTranslate="entity.action.delete">Delete</span>
</button>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>

View File

@ -0,0 +1,108 @@
import { Component, OnInit, OnDestroy } from '@angular/core';
import { HttpErrorResponse, HttpHeaders, HttpResponse } from '@angular/common/http';
import { Subscription } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { JhiEventManager, JhiParseLinks, JhiAlertService } from 'ng-jhipster';
import { ISepaMandate } from 'app/shared/model/sepa-mandate.model';
import { AccountService } from 'app/core';
import { ITEMS_PER_PAGE } from 'app/shared';
import { SepaMandateService } from './sepa-mandate.service';
@Component({
selector: 'jhi-sepa-mandate',
templateUrl: './sepa-mandate.component.html'
})
export class SepaMandateComponent implements OnInit, OnDestroy {
sepaMandates: ISepaMandate[];
currentAccount: any;
eventSubscriber: Subscription;
itemsPerPage: number;
links: any;
page: any;
predicate: any;
reverse: any;
totalItems: number;
constructor(
protected sepaMandateService: SepaMandateService,
protected jhiAlertService: JhiAlertService,
protected eventManager: JhiEventManager,
protected parseLinks: JhiParseLinks,
protected accountService: AccountService
) {
this.sepaMandates = [];
this.itemsPerPage = ITEMS_PER_PAGE;
this.page = 0;
this.links = {
last: 0
};
this.predicate = 'id';
this.reverse = true;
}
loadAll() {
this.sepaMandateService
.query({
page: this.page,
size: this.itemsPerPage,
sort: this.sort()
})
.subscribe(
(res: HttpResponse<ISepaMandate[]>) => this.paginateSepaMandates(res.body, res.headers),
(res: HttpErrorResponse) => this.onError(res.message)
);
}
reset() {
this.page = 0;
this.sepaMandates = [];
this.loadAll();
}
loadPage(page) {
this.page = page;
this.loadAll();
}
ngOnInit() {
this.loadAll();
this.accountService.identity().then(account => {
this.currentAccount = account;
});
this.registerChangeInSepaMandates();
}
ngOnDestroy() {
this.eventManager.destroy(this.eventSubscriber);
}
trackId(index: number, item: ISepaMandate) {
return item.id;
}
registerChangeInSepaMandates() {
this.eventSubscriber = this.eventManager.subscribe('sepaMandateListModification', response => this.reset());
}
sort() {
const result = [this.predicate + ',' + (this.reverse ? 'asc' : 'desc')];
if (this.predicate !== 'id') {
result.push('id');
}
return result;
}
protected paginateSepaMandates(data: ISepaMandate[], headers: HttpHeaders) {
this.links = this.parseLinks.parse(headers.get('link'));
this.totalItems = parseInt(headers.get('X-Total-Count'), 10);
for (let i = 0; i < data.length; i++) {
this.sepaMandates.push(data[i]);
}
}
protected onError(errorMessage: string) {
this.jhiAlertService.error(errorMessage, null, null);
}
}

View File

@ -0,0 +1,40 @@
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { RouterModule } from '@angular/router';
import { JhiLanguageService } from 'ng-jhipster';
import { JhiLanguageHelper } from 'app/core';
import { HsadminNgSharedModule } from 'app/shared';
import {
SepaMandateComponent,
SepaMandateDetailComponent,
SepaMandateUpdateComponent,
SepaMandateDeletePopupComponent,
SepaMandateDeleteDialogComponent,
sepaMandateRoute,
sepaMandatePopupRoute
} from './';
const ENTITY_STATES = [...sepaMandateRoute, ...sepaMandatePopupRoute];
@NgModule({
imports: [HsadminNgSharedModule, RouterModule.forChild(ENTITY_STATES)],
declarations: [
SepaMandateComponent,
SepaMandateDetailComponent,
SepaMandateUpdateComponent,
SepaMandateDeleteDialogComponent,
SepaMandateDeletePopupComponent
],
entryComponents: [SepaMandateComponent, SepaMandateUpdateComponent, SepaMandateDeleteDialogComponent, SepaMandateDeletePopupComponent],
providers: [{ provide: JhiLanguageService, useClass: JhiLanguageService }],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class HsadminNgSepaMandateModule {
constructor(private languageService: JhiLanguageService, private languageHelper: JhiLanguageHelper) {
this.languageHelper.language.subscribe((languageKey: string) => {
if (languageKey !== undefined) {
this.languageService.changeLanguage(languageKey);
}
});
}
}

View File

@ -0,0 +1,93 @@
import { Injectable } from '@angular/core';
import { HttpResponse } from '@angular/common/http';
import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot, Routes } from '@angular/router';
import { UserRouteAccessService } from 'app/core';
import { Observable, of } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { SepaMandate } from 'app/shared/model/sepa-mandate.model';
import { SepaMandateService } from './sepa-mandate.service';
import { SepaMandateComponent } from './sepa-mandate.component';
import { SepaMandateDetailComponent } from './sepa-mandate-detail.component';
import { SepaMandateUpdateComponent } from './sepa-mandate-update.component';
import { SepaMandateDeletePopupComponent } from './sepa-mandate-delete-dialog.component';
import { ISepaMandate } from 'app/shared/model/sepa-mandate.model';
@Injectable({ providedIn: 'root' })
export class SepaMandateResolve implements Resolve<ISepaMandate> {
constructor(private service: SepaMandateService) {}
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<ISepaMandate> {
const id = route.params['id'] ? route.params['id'] : null;
if (id) {
return this.service.find(id).pipe(
filter((response: HttpResponse<SepaMandate>) => response.ok),
map((sepaMandate: HttpResponse<SepaMandate>) => sepaMandate.body)
);
}
return of(new SepaMandate());
}
}
export const sepaMandateRoute: Routes = [
{
path: '',
component: SepaMandateComponent,
data: {
authorities: ['ROLE_USER'],
pageTitle: 'hsadminNgApp.sepaMandate.home.title'
},
canActivate: [UserRouteAccessService]
},
{
path: ':id/view',
component: SepaMandateDetailComponent,
resolve: {
sepaMandate: SepaMandateResolve
},
data: {
authorities: ['ROLE_USER'],
pageTitle: 'hsadminNgApp.sepaMandate.home.title'
},
canActivate: [UserRouteAccessService]
},
{
path: 'new',
component: SepaMandateUpdateComponent,
resolve: {
sepaMandate: SepaMandateResolve
},
data: {
authorities: ['ROLE_USER'],
pageTitle: 'hsadminNgApp.sepaMandate.home.title'
},
canActivate: [UserRouteAccessService]
},
{
path: ':id/edit',
component: SepaMandateUpdateComponent,
resolve: {
sepaMandate: SepaMandateResolve
},
data: {
authorities: ['ROLE_USER'],
pageTitle: 'hsadminNgApp.sepaMandate.home.title'
},
canActivate: [UserRouteAccessService]
}
];
export const sepaMandatePopupRoute: Routes = [
{
path: ':id/delete',
component: SepaMandateDeletePopupComponent,
resolve: {
sepaMandate: SepaMandateResolve
},
data: {
authorities: ['ROLE_USER'],
pageTitle: 'hsadminNgApp.sepaMandate.home.title'
},
canActivate: [UserRouteAccessService],
outlet: 'popup'
}
];

View File

@ -0,0 +1,93 @@
import { Injectable } from '@angular/core';
import { HttpClient, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import * as moment from 'moment';
import { DATE_FORMAT } from 'app/shared/constants/input.constants';
import { map } from 'rxjs/operators';
import { SERVER_API_URL } from 'app/app.constants';
import { createRequestOption } from 'app/shared';
import { ISepaMandate } from 'app/shared/model/sepa-mandate.model';
type EntityResponseType = HttpResponse<ISepaMandate>;
type EntityArrayResponseType = HttpResponse<ISepaMandate[]>;
@Injectable({ providedIn: 'root' })
export class SepaMandateService {
public resourceUrl = SERVER_API_URL + 'api/sepa-mandates';
constructor(protected http: HttpClient) {}
create(sepaMandate: ISepaMandate): Observable<EntityResponseType> {
const copy = this.convertDateFromClient(sepaMandate);
return this.http
.post<ISepaMandate>(this.resourceUrl, copy, { observe: 'response' })
.pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
}
update(sepaMandate: ISepaMandate): Observable<EntityResponseType> {
const copy = this.convertDateFromClient(sepaMandate);
return this.http
.put<ISepaMandate>(this.resourceUrl, copy, { observe: 'response' })
.pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
}
find(id: number): Observable<EntityResponseType> {
return this.http
.get<ISepaMandate>(`${this.resourceUrl}/${id}`, { observe: 'response' })
.pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
}
query(req?: any): Observable<EntityArrayResponseType> {
const options = createRequestOption(req);
return this.http
.get<ISepaMandate[]>(this.resourceUrl, { params: options, observe: 'response' })
.pipe(map((res: EntityArrayResponseType) => this.convertDateArrayFromServer(res)));
}
delete(id: number): Observable<HttpResponse<any>> {
return this.http.delete<any>(`${this.resourceUrl}/${id}`, { observe: 'response' });
}
protected convertDateFromClient(sepaMandate: ISepaMandate): ISepaMandate {
const copy: ISepaMandate = Object.assign({}, sepaMandate, {
documentDate:
sepaMandate.documentDate != null && sepaMandate.documentDate.isValid()
? sepaMandate.documentDate.format(DATE_FORMAT)
: null,
validFrom: sepaMandate.validFrom != null && sepaMandate.validFrom.isValid() ? sepaMandate.validFrom.format(DATE_FORMAT) : null,
validUntil:
sepaMandate.validUntil != null && sepaMandate.validUntil.isValid() ? sepaMandate.validUntil.format(DATE_FORMAT) : null,
lastUsed: sepaMandate.lastUsed != null && sepaMandate.lastUsed.isValid() ? sepaMandate.lastUsed.format(DATE_FORMAT) : null,
cancellationDate:
sepaMandate.cancellationDate != null && sepaMandate.cancellationDate.isValid()
? sepaMandate.cancellationDate.format(DATE_FORMAT)
: null
});
return copy;
}
protected convertDateFromServer(res: EntityResponseType): EntityResponseType {
if (res.body) {
res.body.documentDate = res.body.documentDate != null ? moment(res.body.documentDate) : null;
res.body.validFrom = res.body.validFrom != null ? moment(res.body.validFrom) : null;
res.body.validUntil = res.body.validUntil != null ? moment(res.body.validUntil) : null;
res.body.lastUsed = res.body.lastUsed != null ? moment(res.body.lastUsed) : null;
res.body.cancellationDate = res.body.cancellationDate != null ? moment(res.body.cancellationDate) : null;
}
return res;
}
protected convertDateArrayFromServer(res: EntityArrayResponseType): EntityArrayResponseType {
if (res.body) {
res.body.forEach((sepaMandate: ISepaMandate) => {
sepaMandate.documentDate = sepaMandate.documentDate != null ? moment(sepaMandate.documentDate) : null;
sepaMandate.validFrom = sepaMandate.validFrom != null ? moment(sepaMandate.validFrom) : null;
sepaMandate.validUntil = sepaMandate.validUntil != null ? moment(sepaMandate.validUntil) : null;
sepaMandate.lastUsed = sepaMandate.lastUsed != null ? moment(sepaMandate.lastUsed) : null;
sepaMandate.cancellationDate = sepaMandate.cancellationDate != null ? moment(sepaMandate.cancellationDate) : null;
});
}
return res;
}
}

View File

@ -5,9 +5,13 @@
<hr>
<jhi-alert-error></jhi-alert-error>
<dl class="row-md jh-entity-details">
<dt><span jhiTranslate="hsadminNgApp.share.date">Date</span></dt>
<dt><span jhiTranslate="hsadminNgApp.share.documentDate">Document Date</span></dt>
<dd>
<span>{{share.date}}</span>
<span>{{share.documentDate}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.share.valueDate">Value Date</span></dt>
<dd>
<span>{{share.valueDate}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.share.action">Action</span></dt>
<dd>
@ -17,14 +21,14 @@
<dd>
<span>{{share.quantity}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.share.comment">Comment</span></dt>
<dt><span jhiTranslate="hsadminNgApp.share.remark">Remark</span></dt>
<dd>
<span>{{share.comment}}</span>
<span>{{share.remark}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.share.member">Member</span></dt>
<dt><span jhiTranslate="hsadminNgApp.share.membership">Membership</span></dt>
<dd>
<div *ngIf="share.memberId">
<a [routerLink]="['/membership', share.memberId, 'view']">{{share.memberId}}</a>
<div *ngIf="share.membershipId">
<a [routerLink]="['/membership', share.membershipId, 'view']">{{share.membershipDocumentDate}}</a>
</div>
</dd>
</dl>

View File

@ -10,17 +10,33 @@
[(ngModel)]="share.id" readonly />
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.share.date" for="field_date">Date</label>
<label class="form-control-label" jhiTranslate="hsadminNgApp.share.documentDate" for="field_documentDate">Document Date</label>
<div class="input-group">
<input id="field_date" type="text" class="form-control" name="date" ngbDatepicker #dateDp="ngbDatepicker" [(ngModel)]="share.date"
<input id="field_documentDate" type="text" class="form-control" name="documentDate" ngbDatepicker #documentDateDp="ngbDatepicker" [(ngModel)]="share.documentDate"
required/>
<span class="input-group-append">
<button type="button" class="btn btn-secondary" (click)="dateDp.toggle()"><fa-icon [icon]="'calendar-alt'"></fa-icon></button>
<button type="button" class="btn btn-secondary" (click)="documentDateDp.toggle()"><fa-icon [icon]="'calendar-alt'"></fa-icon></button>
</span>
</div>
<div [hidden]="!(editForm.controls.date?.dirty && editForm.controls.date?.invalid)">
<div [hidden]="!(editForm.controls.documentDate?.dirty && editForm.controls.documentDate?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.date?.errors?.required" jhiTranslate="entity.validation.required">
[hidden]="!editForm.controls.documentDate?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.share.valueDate" for="field_valueDate">Value Date</label>
<div class="input-group">
<input id="field_valueDate" type="text" class="form-control" name="valueDate" ngbDatepicker #valueDateDp="ngbDatepicker" [(ngModel)]="share.valueDate"
required/>
<span class="input-group-append">
<button type="button" class="btn btn-secondary" (click)="valueDateDp.toggle()"><fa-icon [icon]="'calendar-alt'"></fa-icon></button>
</span>
</div>
<div [hidden]="!(editForm.controls.valueDate?.dirty && editForm.controls.valueDate?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.valueDate?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
</div>
@ -54,28 +70,27 @@
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.share.comment" for="field_comment">Comment</label>
<input type="text" class="form-control" name="comment" id="field_comment"
[(ngModel)]="share.comment" maxlength="160"/>
<div [hidden]="!(editForm.controls.comment?.dirty && editForm.controls.comment?.invalid)">
<label class="form-control-label" jhiTranslate="hsadminNgApp.share.remark" for="field_remark">Remark</label>
<input type="text" class="form-control" name="remark" id="field_remark"
[(ngModel)]="share.remark" maxlength="160"/>
<div [hidden]="!(editForm.controls.remark?.dirty && editForm.controls.remark?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.comment?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 160 }">
[hidden]="!editForm.controls.remark?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 160 }">
This field cannot be longer than 160 characters.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.share.member" for="field_member">Member</label>
<select class="form-control" id="field_member" name="member" [(ngModel)]="share.memberId" required>
<option *ngIf="!editForm.value.member" [ngValue]="null" selected></option>
<option [ngValue]="membershipOption.id" *ngFor="let membershipOption of memberships; trackBy: trackMembershipById">{{membershipOption.id}}</option>
<label class="form-control-label" jhiTranslate="hsadminNgApp.share.membership" for="field_membership">Membership</label>
<select class="form-control" id="field_membership" name="membership" [(ngModel)]="share.membershipId" required>
<option *ngIf="!editForm.value.membership" [ngValue]="null" selected></option>
<option [ngValue]="membershipOption.id" *ngFor="let membershipOption of memberships; trackBy: trackMembershipById">{{membershipOption.documentDate}}</option>
</select>
</div>
<div [hidden]="!(editForm.controls.member?.dirty && editForm.controls.member?.invalid)">
<div [hidden]="!(editForm.controls.membership?.dirty && editForm.controls.membership?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.member?.errors?.required"
jhiTranslate="entity.validation.required">
[hidden]="!editForm.controls.membership?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
</div>

View File

@ -19,7 +19,8 @@ export class ShareUpdateComponent implements OnInit {
isSaving: boolean;
memberships: IMembership[];
dateDp: any;
documentDateDp: any;
valueDateDp: any;
constructor(
protected jhiAlertService: JhiAlertService,

View File

@ -15,24 +15,26 @@
<thead>
<tr jhiSort [(predicate)]="predicate" [(ascending)]="reverse" [callback]="reset.bind(this)">
<th jhiSortBy="id"><span jhiTranslate="global.field.id">ID</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="date"><span jhiTranslate="hsadminNgApp.share.date">Date</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="documentDate"><span jhiTranslate="hsadminNgApp.share.documentDate">Document Date</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="valueDate"><span jhiTranslate="hsadminNgApp.share.valueDate">Value Date</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="action"><span jhiTranslate="hsadminNgApp.share.action">Action</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="quantity"><span jhiTranslate="hsadminNgApp.share.quantity">Quantity</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="comment"><span jhiTranslate="hsadminNgApp.share.comment">Comment</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="memberId"><span jhiTranslate="hsadminNgApp.share.member">Member</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="remark"><span jhiTranslate="hsadminNgApp.share.remark">Remark</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="membershipDocumentDate"><span jhiTranslate="hsadminNgApp.share.membership">Membership</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th></th>
</tr>
</thead>
<tbody infinite-scroll (scrolled)="loadPage(page + 1)" [infiniteScrollDisabled]="page >= links['last']" [infiniteScrollDistance]="0">
<tr *ngFor="let share of shares ;trackBy: trackId">
<td><a [routerLink]="['/share', share.id, 'view' ]">{{share.id}}</a></td>
<td>{{share.date | date:'mediumDate'}}</td>
<td>{{share.documentDate | date:'mediumDate'}}</td>
<td>{{share.valueDate | date:'mediumDate'}}</td>
<td jhiTranslate="{{'hsadminNgApp.ShareAction.' + share.action}}">{{share.action}}</td>
<td>{{share.quantity}}</td>
<td>{{share.comment}}</td>
<td>{{share.remark}}</td>
<td>
<div *ngIf="share.memberId">
<a [routerLink]="['../membership', share.memberId , 'view' ]" >{{share.memberId}}</a>
<div *ngIf="share.membershipId">
<a [routerLink]="['../membership', share.membershipId , 'view' ]" >{{share.membershipDocumentDate}}</a>
</div>
</td>
<td class="text-right">

View File

@ -51,14 +51,16 @@ export class ShareService {
protected convertDateFromClient(share: IShare): IShare {
const copy: IShare = Object.assign({}, share, {
date: share.date != null && share.date.isValid() ? share.date.format(DATE_FORMAT) : null
documentDate: share.documentDate != null && share.documentDate.isValid() ? share.documentDate.format(DATE_FORMAT) : null,
valueDate: share.valueDate != null && share.valueDate.isValid() ? share.valueDate.format(DATE_FORMAT) : null
});
return copy;
}
protected convertDateFromServer(res: EntityResponseType): EntityResponseType {
if (res.body) {
res.body.date = res.body.date != null ? moment(res.body.date) : null;
res.body.documentDate = res.body.documentDate != null ? moment(res.body.documentDate) : null;
res.body.valueDate = res.body.valueDate != null ? moment(res.body.valueDate) : null;
}
return res;
}
@ -66,7 +68,8 @@ export class ShareService {
protected convertDateArrayFromServer(res: EntityArrayResponseType): EntityArrayResponseType {
if (res.body) {
res.body.forEach((share: IShare) => {
share.date = share.date != null ? moment(share.date) : null;
share.documentDate = share.documentDate != null ? moment(share.documentDate) : null;
share.valueDate = share.valueDate != null ? moment(share.valueDate) : null;
});
}
return res;

View File

@ -63,6 +63,12 @@
<span jhiTranslate="global.menu.entities.asset">Asset</span>
</a>
</li>
<li>
<a class="dropdown-item" routerLink="sepa-mandate" routerLinkActive="active" [routerLinkActiveOptions]="{ exact: true }" (click)="collapseNavbar()">
<fa-icon icon="asterisk" fixedWidth="true"></fa-icon>
<span jhiTranslate="global.menu.entities.sepaMandate">Sepa Mandate</span>
</a>
</li>
<!-- jhipster-needle-add-entity-to-menu - JHipster will add entities to the menu here -->
</ul>
</li>

View File

@ -11,20 +11,24 @@ export const enum AssetAction {
export interface IAsset {
id?: number;
date?: Moment;
documentDate?: Moment;
valueDate?: Moment;
action?: AssetAction;
amount?: number;
comment?: string;
memberId?: number;
remark?: string;
membershipDocumentDate?: string;
membershipId?: number;
}
export class Asset implements IAsset {
constructor(
public id?: number,
public date?: Moment,
public documentDate?: Moment,
public valueDate?: Moment,
public action?: AssetAction,
public amount?: number,
public comment?: string,
public memberId?: number
public remark?: string,
public membershipDocumentDate?: string,
public membershipId?: number
) {}
}

View File

@ -1,30 +1,32 @@
import { ICustomerContact } from 'app/shared/model/customer-contact.model';
import { IMembership } from 'app/shared/model/membership.model';
import { ISepaMandate } from 'app/shared/model/sepa-mandate.model';
export interface ICustomer {
id?: number;
number?: number;
reference?: number;
prefix?: string;
name?: string;
contractualAddress?: string;
contractualSalutation?: string;
billingAddress?: string;
contractualAddress?: string;
billingSalutation?: string;
roles?: ICustomerContact[];
billingAddress?: string;
remark?: string;
memberships?: IMembership[];
sepamandates?: ISepaMandate[];
}
export class Customer implements ICustomer {
constructor(
public id?: number,
public number?: number,
public reference?: number,
public prefix?: string,
public name?: string,
public contractualAddress?: string,
public contractualSalutation?: string,
public billingAddress?: string,
public contractualAddress?: string,
public billingSalutation?: string,
public roles?: ICustomerContact[],
public memberships?: IMembership[]
public billingAddress?: string,
public remark?: string,
public memberships?: IMembership[],
public sepamandates?: ISepaMandate[]
) {}
}

View File

@ -4,8 +4,10 @@ import { IAsset } from 'app/shared/model/asset.model';
export interface IMembership {
id?: number;
sinceDate?: Moment;
untilDate?: Moment;
documentDate?: Moment;
memberFrom?: Moment;
memberUntil?: Moment;
remark?: string;
shares?: IShare[];
assets?: IAsset[];
customerPrefix?: string;
@ -15,8 +17,10 @@ export interface IMembership {
export class Membership implements IMembership {
constructor(
public id?: number,
public sinceDate?: Moment,
public untilDate?: Moment,
public documentDate?: Moment,
public memberFrom?: Moment,
public memberUntil?: Moment,
public remark?: string,
public shares?: IShare[],
public assets?: IAsset[],
public customerPrefix?: string,

View File

@ -0,0 +1,33 @@
import { Moment } from 'moment';
export interface ISepaMandate {
id?: number;
reference?: string;
iban?: string;
bic?: string;
documentDate?: Moment;
validFrom?: Moment;
validUntil?: Moment;
lastUsed?: Moment;
cancellationDate?: Moment;
remark?: string;
customerPrefix?: string;
customerId?: number;
}
export class SepaMandate implements ISepaMandate {
constructor(
public id?: number,
public reference?: string,
public iban?: string,
public bic?: string,
public documentDate?: Moment,
public validFrom?: Moment,
public validUntil?: Moment,
public lastUsed?: Moment,
public cancellationDate?: Moment,
public remark?: string,
public customerPrefix?: string,
public customerId?: number
) {}
}

View File

@ -7,20 +7,24 @@ export const enum ShareAction {
export interface IShare {
id?: number;
date?: Moment;
documentDate?: Moment;
valueDate?: Moment;
action?: ShareAction;
quantity?: number;
comment?: string;
memberId?: number;
remark?: string;
membershipDocumentDate?: string;
membershipId?: number;
}
export class Share implements IShare {
constructor(
public id?: number,
public date?: Moment,
public documentDate?: Moment,
public valueDate?: Moment,
public action?: ShareAction,
public quantity?: number,
public comment?: string,
public memberId?: number
public remark?: string,
public membershipDocumentDate?: string,
public membershipId?: number
) {}
}

View File

@ -15,11 +15,12 @@
"detail": {
"title": "Asset"
},
"date": "Date",
"documentDate": "Document Date",
"valueDate": "Value Date",
"action": "Action",
"amount": "Amount",
"comment": "Comment",
"member": "Member"
"remark": "Remark",
"membership": "Membership"
}
}
}

View File

@ -15,15 +15,16 @@
"detail": {
"title": "Customer"
},
"number": "Number",
"reference": "Reference",
"prefix": "Prefix",
"name": "Name",
"contractualAddress": "Contractual Address",
"contractualSalutation": "Contractual Salutation",
"billingAddress": "Billing Address",
"contractualAddress": "Contractual Address",
"billingSalutation": "Billing Salutation",
"role": "Role",
"membership": "Membership"
"billingAddress": "Billing Address",
"remark": "Remark",
"membership": "Membership",
"sepamandate": "Sepamandate"
}
}
}

View File

@ -13,6 +13,7 @@
"membership": "Membership",
"share": "Share",
"asset": "Asset",
"sepaMandate": "Sepa Mandate",
"jhipster-needle-menu-add-entry": "JHipster will add additional entities here (do not translate!)"
},
"account": {

View File

@ -15,8 +15,10 @@
"detail": {
"title": "Membership"
},
"sinceDate": "Since Date",
"untilDate": "Until Date",
"documentDate": "Document Date",
"memberFrom": "Member From",
"memberUntil": "Member Until",
"remark": "Remark",
"share": "Share",
"asset": "Asset",
"customer": "Customer"

View File

@ -0,0 +1,30 @@
{
"hsadminNgApp": {
"sepaMandate": {
"home": {
"title": "Sepa Mandates",
"createLabel": "Sepa Mandate erstellen",
"createOrEditLabel": "Sepa Mandate erstellen oder bearbeiten"
},
"created": "Sepa Mandate erstellt mit ID {{ param }}",
"updated": "Sepa Mandate aktualisiert mit ID {{ param }}",
"deleted": "Sepa Mandate gelöscht mit ID {{ param }}",
"delete": {
"question": "Soll Sepa Mandate {{ id }} wirklich dauerhaft gelöscht werden?"
},
"detail": {
"title": "Sepa Mandate"
},
"reference": "Reference",
"iban": "Iban",
"bic": "Bic",
"documentDate": "Document Date",
"validFrom": "Valid From",
"validUntil": "Valid Until",
"lastUsed": "Last Used",
"cancellationDate": "Cancellation Date",
"remark": "Remark",
"customer": "Customer"
}
}
}

View File

@ -15,11 +15,12 @@
"detail": {
"title": "Share"
},
"date": "Date",
"documentDate": "Document Date",
"valueDate": "Value Date",
"action": "Action",
"quantity": "Quantity",
"comment": "Comment",
"member": "Member"
"remark": "Remark",
"membership": "Membership"
}
}
}

View File

@ -15,11 +15,12 @@
"detail": {
"title": "Asset"
},
"date": "Date",
"documentDate": "Document Date",
"valueDate": "Value Date",
"action": "Action",
"amount": "Amount",
"comment": "Comment",
"member": "Member"
"remark": "Remark",
"membership": "Membership"
}
}
}

View File

@ -15,15 +15,16 @@
"detail": {
"title": "Customer"
},
"number": "Number",
"reference": "Reference",
"prefix": "Prefix",
"name": "Name",
"contractualAddress": "Contractual Address",
"contractualSalutation": "Contractual Salutation",
"billingAddress": "Billing Address",
"contractualAddress": "Contractual Address",
"billingSalutation": "Billing Salutation",
"role": "Role",
"membership": "Membership"
"billingAddress": "Billing Address",
"remark": "Remark",
"membership": "Membership",
"sepamandate": "Sepamandate"
}
}
}

View File

@ -13,6 +13,7 @@
"membership": "Membership",
"share": "Share",
"asset": "Asset",
"sepaMandate": "Sepa Mandate",
"jhipster-needle-menu-add-entry": "JHipster will add additional entities here (do not translate!)"
},
"account": {

View File

@ -15,8 +15,10 @@
"detail": {
"title": "Membership"
},
"sinceDate": "Since Date",
"untilDate": "Until Date",
"documentDate": "Document Date",
"memberFrom": "Member From",
"memberUntil": "Member Until",
"remark": "Remark",
"share": "Share",
"asset": "Asset",
"customer": "Customer"

View File

@ -0,0 +1,30 @@
{
"hsadminNgApp": {
"sepaMandate": {
"home": {
"title": "Sepa Mandates",
"createLabel": "Create a new Sepa Mandate",
"createOrEditLabel": "Create or edit a Sepa Mandate"
},
"created": "A new Sepa Mandate is created with identifier {{ param }}",
"updated": "A Sepa Mandate is updated with identifier {{ param }}",
"deleted": "A Sepa Mandate is deleted with identifier {{ param }}",
"delete": {
"question": "Are you sure you want to delete Sepa Mandate {{ id }}?"
},
"detail": {
"title": "Sepa Mandate"
},
"reference": "Reference",
"iban": "Iban",
"bic": "Bic",
"documentDate": "Document Date",
"validFrom": "Valid From",
"validUntil": "Valid Until",
"lastUsed": "Last Used",
"cancellationDate": "Cancellation Date",
"remark": "Remark",
"customer": "Customer"
}
}
}

View File

@ -15,11 +15,12 @@
"detail": {
"title": "Share"
},
"date": "Date",
"documentDate": "Document Date",
"valueDate": "Value Date",
"action": "Action",
"quantity": "Quantity",
"comment": "Comment",
"member": "Member"
"remark": "Remark",
"membership": "Membership"
}
}
}

View File

@ -1,15 +1,17 @@
package org.hostsharing.hsadminng.web.rest;
import org.hostsharing.hsadminng.HsadminNgApp;
import org.hostsharing.hsadminng.domain.Asset;
import org.hostsharing.hsadminng.domain.Membership;
import org.hostsharing.hsadminng.domain.enumeration.AssetAction;
import org.hostsharing.hsadminng.repository.AssetRepository;
import org.hostsharing.hsadminng.service.AssetQueryService;
import org.hostsharing.hsadminng.service.AssetService;
import org.hostsharing.hsadminng.service.dto.AssetDTO;
import org.hostsharing.hsadminng.service.mapper.AssetMapper;
import org.hostsharing.hsadminng.web.rest.errors.ExceptionTranslator;
import org.hostsharing.hsadminng.service.dto.AssetCriteria;
import org.hostsharing.hsadminng.service.AssetQueryService;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -31,11 +33,14 @@ import java.time.LocalDate;
import java.time.ZoneId;
import java.util.List;
import static org.hostsharing.hsadminng.web.rest.TestUtil.createFormattingConversionService;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.hasItem;
import static org.hostsharing.hsadminng.web.rest.TestUtil.createFormattingConversionService;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
import org.hostsharing.hsadminng.domain.enumeration.AssetAction;
/**
* Test class for the AssetResource REST controller.
*
@ -45,8 +50,11 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
@SpringBootTest(classes = HsadminNgApp.class)
public class AssetResourceIntTest {
private static final LocalDate DEFAULT_DATE = LocalDate.ofEpochDay(0L);
private static final LocalDate UPDATED_DATE = LocalDate.now(ZoneId.systemDefault());
private static final LocalDate DEFAULT_DOCUMENT_DATE = LocalDate.ofEpochDay(0L);
private static final LocalDate UPDATED_DOCUMENT_DATE = LocalDate.now(ZoneId.systemDefault());
private static final LocalDate DEFAULT_VALUE_DATE = LocalDate.ofEpochDay(0L);
private static final LocalDate UPDATED_VALUE_DATE = LocalDate.now(ZoneId.systemDefault());
private static final AssetAction DEFAULT_ACTION = AssetAction.PAYMENT;
private static final AssetAction UPDATED_ACTION = AssetAction.HANDOVER;
@ -54,8 +62,8 @@ public class AssetResourceIntTest {
private static final BigDecimal DEFAULT_AMOUNT = new BigDecimal(1);
private static final BigDecimal UPDATED_AMOUNT = new BigDecimal(2);
private static final String DEFAULT_COMMENT = "AAAAAAAAAA";
private static final String UPDATED_COMMENT = "BBBBBBBBBB";
private static final String DEFAULT_REMARK = "AAAAAAAAAA";
private static final String UPDATED_REMARK = "BBBBBBBBBB";
@Autowired
private AssetRepository assetRepository;
@ -108,15 +116,16 @@ public class AssetResourceIntTest {
*/
public static Asset createEntity(EntityManager em) {
Asset asset = new Asset()
.date(DEFAULT_DATE)
.documentDate(DEFAULT_DOCUMENT_DATE)
.valueDate(DEFAULT_VALUE_DATE)
.action(DEFAULT_ACTION)
.amount(DEFAULT_AMOUNT)
.comment(DEFAULT_COMMENT);
.remark(DEFAULT_REMARK);
// Add required entity
Membership membership = MembershipResourceIntTest.createEntity(em);
em.persist(membership);
em.flush();
asset.setMember(membership);
asset.setMembership(membership);
return asset;
}
@ -141,10 +150,11 @@ public class AssetResourceIntTest {
List<Asset> assetList = assetRepository.findAll();
assertThat(assetList).hasSize(databaseSizeBeforeCreate + 1);
Asset testAsset = assetList.get(assetList.size() - 1);
assertThat(testAsset.getDate()).isEqualTo(DEFAULT_DATE);
assertThat(testAsset.getDocumentDate()).isEqualTo(DEFAULT_DOCUMENT_DATE);
assertThat(testAsset.getValueDate()).isEqualTo(DEFAULT_VALUE_DATE);
assertThat(testAsset.getAction()).isEqualTo(DEFAULT_ACTION);
assertThat(testAsset.getAmount()).isEqualTo(DEFAULT_AMOUNT);
assertThat(testAsset.getComment()).isEqualTo(DEFAULT_COMMENT);
assertThat(testAsset.getRemark()).isEqualTo(DEFAULT_REMARK);
}
@Test
@ -169,10 +179,29 @@ public class AssetResourceIntTest {
@Test
@Transactional
public void checkDateIsRequired() throws Exception {
public void checkDocumentDateIsRequired() throws Exception {
int databaseSizeBeforeTest = assetRepository.findAll().size();
// set the field null
asset.setDate(null);
asset.setDocumentDate(null);
// Create the Asset, which fails.
AssetDTO assetDTO = assetMapper.toDto(asset);
restAssetMockMvc.perform(post("/api/assets")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(assetDTO)))
.andExpect(status().isBadRequest());
List<Asset> assetList = assetRepository.findAll();
assertThat(assetList).hasSize(databaseSizeBeforeTest);
}
@Test
@Transactional
public void checkValueDateIsRequired() throws Exception {
int databaseSizeBeforeTest = assetRepository.findAll().size();
// set the field null
asset.setValueDate(null);
// Create the Asset, which fails.
AssetDTO assetDTO = assetMapper.toDto(asset);
@ -235,10 +264,11 @@ public class AssetResourceIntTest {
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].id").value(hasItem(asset.getId().intValue())))
.andExpect(jsonPath("$.[*].date").value(hasItem(DEFAULT_DATE.toString())))
.andExpect(jsonPath("$.[*].documentDate").value(hasItem(DEFAULT_DOCUMENT_DATE.toString())))
.andExpect(jsonPath("$.[*].valueDate").value(hasItem(DEFAULT_VALUE_DATE.toString())))
.andExpect(jsonPath("$.[*].action").value(hasItem(DEFAULT_ACTION.toString())))
.andExpect(jsonPath("$.[*].amount").value(hasItem(DEFAULT_AMOUNT.intValue())))
.andExpect(jsonPath("$.[*].comment").value(hasItem(DEFAULT_COMMENT.toString())));
.andExpect(jsonPath("$.[*].remark").value(hasItem(DEFAULT_REMARK.toString())));
}
@Test
@ -252,75 +282,142 @@ public class AssetResourceIntTest {
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.id").value(asset.getId().intValue()))
.andExpect(jsonPath("$.date").value(DEFAULT_DATE.toString()))
.andExpect(jsonPath("$.documentDate").value(DEFAULT_DOCUMENT_DATE.toString()))
.andExpect(jsonPath("$.valueDate").value(DEFAULT_VALUE_DATE.toString()))
.andExpect(jsonPath("$.action").value(DEFAULT_ACTION.toString()))
.andExpect(jsonPath("$.amount").value(DEFAULT_AMOUNT.intValue()))
.andExpect(jsonPath("$.comment").value(DEFAULT_COMMENT.toString()));
.andExpect(jsonPath("$.remark").value(DEFAULT_REMARK.toString()));
}
@Test
@Transactional
public void getAllAssetsByDateIsEqualToSomething() throws Exception {
public void getAllAssetsByDocumentDateIsEqualToSomething() throws Exception {
// Initialize the database
assetRepository.saveAndFlush(asset);
// Get all the assetList where date equals to DEFAULT_DATE
defaultAssetShouldBeFound("date.equals=" + DEFAULT_DATE);
// Get all the assetList where documentDate equals to DEFAULT_DOCUMENT_DATE
defaultAssetShouldBeFound("documentDate.equals=" + DEFAULT_DOCUMENT_DATE);
// Get all the assetList where date equals to UPDATED_DATE
defaultAssetShouldNotBeFound("date.equals=" + UPDATED_DATE);
// Get all the assetList where documentDate equals to UPDATED_DOCUMENT_DATE
defaultAssetShouldNotBeFound("documentDate.equals=" + UPDATED_DOCUMENT_DATE);
}
@Test
@Transactional
public void getAllAssetsByDateIsInShouldWork() throws Exception {
public void getAllAssetsByDocumentDateIsInShouldWork() throws Exception {
// Initialize the database
assetRepository.saveAndFlush(asset);
// Get all the assetList where date in DEFAULT_DATE or UPDATED_DATE
defaultAssetShouldBeFound("date.in=" + DEFAULT_DATE + "," + UPDATED_DATE);
// Get all the assetList where documentDate in DEFAULT_DOCUMENT_DATE or UPDATED_DOCUMENT_DATE
defaultAssetShouldBeFound("documentDate.in=" + DEFAULT_DOCUMENT_DATE + "," + UPDATED_DOCUMENT_DATE);
// Get all the assetList where date equals to UPDATED_DATE
defaultAssetShouldNotBeFound("date.in=" + UPDATED_DATE);
// Get all the assetList where documentDate equals to UPDATED_DOCUMENT_DATE
defaultAssetShouldNotBeFound("documentDate.in=" + UPDATED_DOCUMENT_DATE);
}
@Test
@Transactional
public void getAllAssetsByDateIsNullOrNotNull() throws Exception {
public void getAllAssetsByDocumentDateIsNullOrNotNull() throws Exception {
// Initialize the database
assetRepository.saveAndFlush(asset);
// Get all the assetList where date is not null
defaultAssetShouldBeFound("date.specified=true");
// Get all the assetList where documentDate is not null
defaultAssetShouldBeFound("documentDate.specified=true");
// Get all the assetList where date is null
defaultAssetShouldNotBeFound("date.specified=false");
// Get all the assetList where documentDate is null
defaultAssetShouldNotBeFound("documentDate.specified=false");
}
@Test
@Transactional
public void getAllAssetsByDateIsGreaterThanOrEqualToSomething() throws Exception {
public void getAllAssetsByDocumentDateIsGreaterThanOrEqualToSomething() throws Exception {
// Initialize the database
assetRepository.saveAndFlush(asset);
// Get all the assetList where date greater than or equals to DEFAULT_DATE
defaultAssetShouldBeFound("date.greaterOrEqualThan=" + DEFAULT_DATE);
// Get all the assetList where documentDate greater than or equals to DEFAULT_DOCUMENT_DATE
defaultAssetShouldBeFound("documentDate.greaterOrEqualThan=" + DEFAULT_DOCUMENT_DATE);
// Get all the assetList where date greater than or equals to UPDATED_DATE
defaultAssetShouldNotBeFound("date.greaterOrEqualThan=" + UPDATED_DATE);
// Get all the assetList where documentDate greater than or equals to UPDATED_DOCUMENT_DATE
defaultAssetShouldNotBeFound("documentDate.greaterOrEqualThan=" + UPDATED_DOCUMENT_DATE);
}
@Test
@Transactional
public void getAllAssetsByDateIsLessThanSomething() throws Exception {
public void getAllAssetsByDocumentDateIsLessThanSomething() throws Exception {
// Initialize the database
assetRepository.saveAndFlush(asset);
// Get all the assetList where date less than or equals to DEFAULT_DATE
defaultAssetShouldNotBeFound("date.lessThan=" + DEFAULT_DATE);
// Get all the assetList where documentDate less than or equals to DEFAULT_DOCUMENT_DATE
defaultAssetShouldNotBeFound("documentDate.lessThan=" + DEFAULT_DOCUMENT_DATE);
// Get all the assetList where date less than or equals to UPDATED_DATE
defaultAssetShouldBeFound("date.lessThan=" + UPDATED_DATE);
// Get all the assetList where documentDate less than or equals to UPDATED_DOCUMENT_DATE
defaultAssetShouldBeFound("documentDate.lessThan=" + UPDATED_DOCUMENT_DATE);
}
@Test
@Transactional
public void getAllAssetsByValueDateIsEqualToSomething() throws Exception {
// Initialize the database
assetRepository.saveAndFlush(asset);
// Get all the assetList where valueDate equals to DEFAULT_VALUE_DATE
defaultAssetShouldBeFound("valueDate.equals=" + DEFAULT_VALUE_DATE);
// Get all the assetList where valueDate equals to UPDATED_VALUE_DATE
defaultAssetShouldNotBeFound("valueDate.equals=" + UPDATED_VALUE_DATE);
}
@Test
@Transactional
public void getAllAssetsByValueDateIsInShouldWork() throws Exception {
// Initialize the database
assetRepository.saveAndFlush(asset);
// Get all the assetList where valueDate in DEFAULT_VALUE_DATE or UPDATED_VALUE_DATE
defaultAssetShouldBeFound("valueDate.in=" + DEFAULT_VALUE_DATE + "," + UPDATED_VALUE_DATE);
// Get all the assetList where valueDate equals to UPDATED_VALUE_DATE
defaultAssetShouldNotBeFound("valueDate.in=" + UPDATED_VALUE_DATE);
}
@Test
@Transactional
public void getAllAssetsByValueDateIsNullOrNotNull() throws Exception {
// Initialize the database
assetRepository.saveAndFlush(asset);
// Get all the assetList where valueDate is not null
defaultAssetShouldBeFound("valueDate.specified=true");
// Get all the assetList where valueDate is null
defaultAssetShouldNotBeFound("valueDate.specified=false");
}
@Test
@Transactional
public void getAllAssetsByValueDateIsGreaterThanOrEqualToSomething() throws Exception {
// Initialize the database
assetRepository.saveAndFlush(asset);
// Get all the assetList where valueDate greater than or equals to DEFAULT_VALUE_DATE
defaultAssetShouldBeFound("valueDate.greaterOrEqualThan=" + DEFAULT_VALUE_DATE);
// Get all the assetList where valueDate greater than or equals to UPDATED_VALUE_DATE
defaultAssetShouldNotBeFound("valueDate.greaterOrEqualThan=" + UPDATED_VALUE_DATE);
}
@Test
@Transactional
public void getAllAssetsByValueDateIsLessThanSomething() throws Exception {
// Initialize the database
assetRepository.saveAndFlush(asset);
// Get all the assetList where valueDate less than or equals to DEFAULT_VALUE_DATE
defaultAssetShouldNotBeFound("valueDate.lessThan=" + DEFAULT_VALUE_DATE);
// Get all the assetList where valueDate less than or equals to UPDATED_VALUE_DATE
defaultAssetShouldBeFound("valueDate.lessThan=" + UPDATED_VALUE_DATE);
}
@ -404,59 +501,59 @@ public class AssetResourceIntTest {
@Test
@Transactional
public void getAllAssetsByCommentIsEqualToSomething() throws Exception {
public void getAllAssetsByRemarkIsEqualToSomething() throws Exception {
// Initialize the database
assetRepository.saveAndFlush(asset);
// Get all the assetList where comment equals to DEFAULT_COMMENT
defaultAssetShouldBeFound("comment.equals=" + DEFAULT_COMMENT);
// Get all the assetList where remark equals to DEFAULT_REMARK
defaultAssetShouldBeFound("remark.equals=" + DEFAULT_REMARK);
// Get all the assetList where comment equals to UPDATED_COMMENT
defaultAssetShouldNotBeFound("comment.equals=" + UPDATED_COMMENT);
// Get all the assetList where remark equals to UPDATED_REMARK
defaultAssetShouldNotBeFound("remark.equals=" + UPDATED_REMARK);
}
@Test
@Transactional
public void getAllAssetsByCommentIsInShouldWork() throws Exception {
public void getAllAssetsByRemarkIsInShouldWork() throws Exception {
// Initialize the database
assetRepository.saveAndFlush(asset);
// Get all the assetList where comment in DEFAULT_COMMENT or UPDATED_COMMENT
defaultAssetShouldBeFound("comment.in=" + DEFAULT_COMMENT + "," + UPDATED_COMMENT);
// Get all the assetList where remark in DEFAULT_REMARK or UPDATED_REMARK
defaultAssetShouldBeFound("remark.in=" + DEFAULT_REMARK + "," + UPDATED_REMARK);
// Get all the assetList where comment equals to UPDATED_COMMENT
defaultAssetShouldNotBeFound("comment.in=" + UPDATED_COMMENT);
// Get all the assetList where remark equals to UPDATED_REMARK
defaultAssetShouldNotBeFound("remark.in=" + UPDATED_REMARK);
}
@Test
@Transactional
public void getAllAssetsByCommentIsNullOrNotNull() throws Exception {
public void getAllAssetsByRemarkIsNullOrNotNull() throws Exception {
// Initialize the database
assetRepository.saveAndFlush(asset);
// Get all the assetList where comment is not null
defaultAssetShouldBeFound("comment.specified=true");
// Get all the assetList where remark is not null
defaultAssetShouldBeFound("remark.specified=true");
// Get all the assetList where comment is null
defaultAssetShouldNotBeFound("comment.specified=false");
// Get all the assetList where remark is null
defaultAssetShouldNotBeFound("remark.specified=false");
}
@Test
@Transactional
public void getAllAssetsByMemberIsEqualToSomething() throws Exception {
public void getAllAssetsByMembershipIsEqualToSomething() throws Exception {
// Initialize the database
Membership member = MembershipResourceIntTest.createEntity(em);
em.persist(member);
Membership membership = MembershipResourceIntTest.createEntity(em);
em.persist(membership);
em.flush();
asset.setMember(member);
asset.setMembership(membership);
assetRepository.saveAndFlush(asset);
Long memberId = member.getId();
Long membershipId = membership.getId();
// Get all the assetList where member equals to memberId
defaultAssetShouldBeFound("memberId.equals=" + memberId);
// Get all the assetList where membership equals to membershipId
defaultAssetShouldBeFound("membershipId.equals=" + membershipId);
// Get all the assetList where member equals to memberId + 1
defaultAssetShouldNotBeFound("memberId.equals=" + (memberId + 1));
// Get all the assetList where membership equals to membershipId + 1
defaultAssetShouldNotBeFound("membershipId.equals=" + (membershipId + 1));
}
/**
@ -467,10 +564,11 @@ public class AssetResourceIntTest {
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].id").value(hasItem(asset.getId().intValue())))
.andExpect(jsonPath("$.[*].date").value(hasItem(DEFAULT_DATE.toString())))
.andExpect(jsonPath("$.[*].documentDate").value(hasItem(DEFAULT_DOCUMENT_DATE.toString())))
.andExpect(jsonPath("$.[*].valueDate").value(hasItem(DEFAULT_VALUE_DATE.toString())))
.andExpect(jsonPath("$.[*].action").value(hasItem(DEFAULT_ACTION.toString())))
.andExpect(jsonPath("$.[*].amount").value(hasItem(DEFAULT_AMOUNT.intValue())))
.andExpect(jsonPath("$.[*].comment").value(hasItem(DEFAULT_COMMENT)));
.andExpect(jsonPath("$.[*].remark").value(hasItem(DEFAULT_REMARK)));
// Check, that the count call also returns 1
restAssetMockMvc.perform(get("/api/assets/count?sort=id,desc&" + filter))
@ -518,10 +616,11 @@ public class AssetResourceIntTest {
// Disconnect from session so that the updates on updatedAsset are not directly saved in db
em.detach(updatedAsset);
updatedAsset
.date(UPDATED_DATE)
.documentDate(UPDATED_DOCUMENT_DATE)
.valueDate(UPDATED_VALUE_DATE)
.action(UPDATED_ACTION)
.amount(UPDATED_AMOUNT)
.comment(UPDATED_COMMENT);
.remark(UPDATED_REMARK);
AssetDTO assetDTO = assetMapper.toDto(updatedAsset);
restAssetMockMvc.perform(put("/api/assets")
@ -533,10 +632,11 @@ public class AssetResourceIntTest {
List<Asset> assetList = assetRepository.findAll();
assertThat(assetList).hasSize(databaseSizeBeforeUpdate);
Asset testAsset = assetList.get(assetList.size() - 1);
assertThat(testAsset.getDate()).isEqualTo(UPDATED_DATE);
assertThat(testAsset.getDocumentDate()).isEqualTo(UPDATED_DOCUMENT_DATE);
assertThat(testAsset.getValueDate()).isEqualTo(UPDATED_VALUE_DATE);
assertThat(testAsset.getAction()).isEqualTo(UPDATED_ACTION);
assertThat(testAsset.getAmount()).isEqualTo(UPDATED_AMOUNT);
assertThat(testAsset.getComment()).isEqualTo(UPDATED_COMMENT);
assertThat(testAsset.getRemark()).isEqualTo(UPDATED_REMARK);
}
@Test

View File

@ -1,15 +1,18 @@
package org.hostsharing.hsadminng.web.rest;
import org.hostsharing.hsadminng.HsadminNgApp;
import org.hostsharing.hsadminng.domain.Customer;
import org.hostsharing.hsadminng.domain.CustomerContact;
import org.hostsharing.hsadminng.domain.Membership;
import org.hostsharing.hsadminng.domain.SepaMandate;
import org.hostsharing.hsadminng.repository.CustomerRepository;
import org.hostsharing.hsadminng.service.CustomerQueryService;
import org.hostsharing.hsadminng.service.CustomerService;
import org.hostsharing.hsadminng.service.dto.CustomerDTO;
import org.hostsharing.hsadminng.service.mapper.CustomerMapper;
import org.hostsharing.hsadminng.web.rest.errors.ExceptionTranslator;
import org.hostsharing.hsadminng.service.dto.CustomerCriteria;
import org.hostsharing.hsadminng.service.CustomerQueryService;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -28,9 +31,10 @@ import org.springframework.validation.Validator;
import javax.persistence.EntityManager;
import java.util.List;
import static org.hostsharing.hsadminng.web.rest.TestUtil.createFormattingConversionService;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.hasItem;
import static org.hostsharing.hsadminng.web.rest.TestUtil.createFormattingConversionService;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
@ -43,8 +47,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
@SpringBootTest(classes = HsadminNgApp.class)
public class CustomerResourceIntTest {
private static final Integer DEFAULT_NUMBER = 10000;
private static final Integer UPDATED_NUMBER = 10001;
private static final Integer DEFAULT_REFERENCE = 10000;
private static final Integer UPDATED_REFERENCE = 10001;
private static final String DEFAULT_PREFIX = "lzv";
private static final String UPDATED_PREFIX = "zf";
@ -52,17 +56,20 @@ public class CustomerResourceIntTest {
private static final String DEFAULT_NAME = "AAAAAAAAAA";
private static final String UPDATED_NAME = "BBBBBBBBBB";
private static final String DEFAULT_CONTRACTUAL_SALUTATION = "AAAAAAAAAA";
private static final String UPDATED_CONTRACTUAL_SALUTATION = "BBBBBBBBBB";
private static final String DEFAULT_CONTRACTUAL_ADDRESS = "AAAAAAAAAA";
private static final String UPDATED_CONTRACTUAL_ADDRESS = "BBBBBBBBBB";
private static final String DEFAULT_CONTRACTUAL_SALUTATION = "AAAAAAAAAA";
private static final String UPDATED_CONTRACTUAL_SALUTATION = "BBBBBBBBBB";
private static final String DEFAULT_BILLING_SALUTATION = "AAAAAAAAAA";
private static final String UPDATED_BILLING_SALUTATION = "BBBBBBBBBB";
private static final String DEFAULT_BILLING_ADDRESS = "AAAAAAAAAA";
private static final String UPDATED_BILLING_ADDRESS = "BBBBBBBBBB";
private static final String DEFAULT_BILLING_SALUTATION = "AAAAAAAAAA";
private static final String UPDATED_BILLING_SALUTATION = "BBBBBBBBBB";
private static final String DEFAULT_REMARK = "AAAAAAAAAA";
private static final String UPDATED_REMARK = "BBBBBBBBBB";
@Autowired
private CustomerRepository customerRepository;
@ -115,13 +122,14 @@ public class CustomerResourceIntTest {
*/
public static Customer createEntity(EntityManager em) {
Customer customer = new Customer()
.number(DEFAULT_NUMBER)
.reference(DEFAULT_REFERENCE)
.prefix(DEFAULT_PREFIX)
.name(DEFAULT_NAME)
.contractualAddress(DEFAULT_CONTRACTUAL_ADDRESS)
.contractualSalutation(DEFAULT_CONTRACTUAL_SALUTATION)
.contractualAddress(DEFAULT_CONTRACTUAL_ADDRESS)
.billingSalutation(DEFAULT_BILLING_SALUTATION)
.billingAddress(DEFAULT_BILLING_ADDRESS)
.billingSalutation(DEFAULT_BILLING_SALUTATION);
.remark(DEFAULT_REMARK);
return customer;
}
@ -146,13 +154,14 @@ public class CustomerResourceIntTest {
List<Customer> customerList = customerRepository.findAll();
assertThat(customerList).hasSize(databaseSizeBeforeCreate + 1);
Customer testCustomer = customerList.get(customerList.size() - 1);
assertThat(testCustomer.getNumber()).isEqualTo(DEFAULT_NUMBER);
assertThat(testCustomer.getReference()).isEqualTo(DEFAULT_REFERENCE);
assertThat(testCustomer.getPrefix()).isEqualTo(DEFAULT_PREFIX);
assertThat(testCustomer.getName()).isEqualTo(DEFAULT_NAME);
assertThat(testCustomer.getContractualAddress()).isEqualTo(DEFAULT_CONTRACTUAL_ADDRESS);
assertThat(testCustomer.getContractualSalutation()).isEqualTo(DEFAULT_CONTRACTUAL_SALUTATION);
assertThat(testCustomer.getBillingAddress()).isEqualTo(DEFAULT_BILLING_ADDRESS);
assertThat(testCustomer.getContractualAddress()).isEqualTo(DEFAULT_CONTRACTUAL_ADDRESS);
assertThat(testCustomer.getBillingSalutation()).isEqualTo(DEFAULT_BILLING_SALUTATION);
assertThat(testCustomer.getBillingAddress()).isEqualTo(DEFAULT_BILLING_ADDRESS);
assertThat(testCustomer.getRemark()).isEqualTo(DEFAULT_REMARK);
}
@Test
@ -177,10 +186,10 @@ public class CustomerResourceIntTest {
@Test
@Transactional
public void checkNumberIsRequired() throws Exception {
public void checkReferenceIsRequired() throws Exception {
int databaseSizeBeforeTest = customerRepository.findAll().size();
// set the field null
customer.setNumber(null);
customer.setReference(null);
// Create the Customer, which fails.
CustomerDTO customerDTO = customerMapper.toDto(customer);
@ -262,13 +271,14 @@ public class CustomerResourceIntTest {
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].id").value(hasItem(customer.getId().intValue())))
.andExpect(jsonPath("$.[*].number").value(hasItem(DEFAULT_NUMBER)))
.andExpect(jsonPath("$.[*].reference").value(hasItem(DEFAULT_REFERENCE)))
.andExpect(jsonPath("$.[*].prefix").value(hasItem(DEFAULT_PREFIX.toString())))
.andExpect(jsonPath("$.[*].name").value(hasItem(DEFAULT_NAME.toString())))
.andExpect(jsonPath("$.[*].contractualAddress").value(hasItem(DEFAULT_CONTRACTUAL_ADDRESS.toString())))
.andExpect(jsonPath("$.[*].contractualSalutation").value(hasItem(DEFAULT_CONTRACTUAL_SALUTATION.toString())))
.andExpect(jsonPath("$.[*].contractualAddress").value(hasItem(DEFAULT_CONTRACTUAL_ADDRESS.toString())))
.andExpect(jsonPath("$.[*].billingSalutation").value(hasItem(DEFAULT_BILLING_SALUTATION.toString())))
.andExpect(jsonPath("$.[*].billingAddress").value(hasItem(DEFAULT_BILLING_ADDRESS.toString())))
.andExpect(jsonPath("$.[*].billingSalutation").value(hasItem(DEFAULT_BILLING_SALUTATION.toString())));
.andExpect(jsonPath("$.[*].remark").value(hasItem(DEFAULT_REMARK.toString())));
}
@Test
@ -282,78 +292,79 @@ public class CustomerResourceIntTest {
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.id").value(customer.getId().intValue()))
.andExpect(jsonPath("$.number").value(DEFAULT_NUMBER))
.andExpect(jsonPath("$.reference").value(DEFAULT_REFERENCE))
.andExpect(jsonPath("$.prefix").value(DEFAULT_PREFIX.toString()))
.andExpect(jsonPath("$.name").value(DEFAULT_NAME.toString()))
.andExpect(jsonPath("$.contractualAddress").value(DEFAULT_CONTRACTUAL_ADDRESS.toString()))
.andExpect(jsonPath("$.contractualSalutation").value(DEFAULT_CONTRACTUAL_SALUTATION.toString()))
.andExpect(jsonPath("$.contractualAddress").value(DEFAULT_CONTRACTUAL_ADDRESS.toString()))
.andExpect(jsonPath("$.billingSalutation").value(DEFAULT_BILLING_SALUTATION.toString()))
.andExpect(jsonPath("$.billingAddress").value(DEFAULT_BILLING_ADDRESS.toString()))
.andExpect(jsonPath("$.billingSalutation").value(DEFAULT_BILLING_SALUTATION.toString()));
.andExpect(jsonPath("$.remark").value(DEFAULT_REMARK.toString()));
}
@Test
@Transactional
public void getAllCustomersByNumberIsEqualToSomething() throws Exception {
public void getAllCustomersByReferenceIsEqualToSomething() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where number equals to DEFAULT_NUMBER
defaultCustomerShouldBeFound("number.equals=" + DEFAULT_NUMBER);
// Get all the customerList where reference equals to DEFAULT_REFERENCE
defaultCustomerShouldBeFound("reference.equals=" + DEFAULT_REFERENCE);
// Get all the customerList where number equals to UPDATED_NUMBER
defaultCustomerShouldNotBeFound("number.equals=" + UPDATED_NUMBER);
// Get all the customerList where reference equals to UPDATED_REFERENCE
defaultCustomerShouldNotBeFound("reference.equals=" + UPDATED_REFERENCE);
}
@Test
@Transactional
public void getAllCustomersByNumberIsInShouldWork() throws Exception {
public void getAllCustomersByReferenceIsInShouldWork() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where number in DEFAULT_NUMBER or UPDATED_NUMBER
defaultCustomerShouldBeFound("number.in=" + DEFAULT_NUMBER + "," + UPDATED_NUMBER);
// Get all the customerList where reference in DEFAULT_REFERENCE or UPDATED_REFERENCE
defaultCustomerShouldBeFound("reference.in=" + DEFAULT_REFERENCE + "," + UPDATED_REFERENCE);
// Get all the customerList where number equals to UPDATED_NUMBER
defaultCustomerShouldNotBeFound("number.in=" + UPDATED_NUMBER);
// Get all the customerList where reference equals to UPDATED_REFERENCE
defaultCustomerShouldNotBeFound("reference.in=" + UPDATED_REFERENCE);
}
@Test
@Transactional
public void getAllCustomersByNumberIsNullOrNotNull() throws Exception {
public void getAllCustomersByReferenceIsNullOrNotNull() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where number is not null
defaultCustomerShouldBeFound("number.specified=true");
// Get all the customerList where reference is not null
defaultCustomerShouldBeFound("reference.specified=true");
// Get all the customerList where number is null
defaultCustomerShouldNotBeFound("number.specified=false");
// Get all the customerList where reference is null
defaultCustomerShouldNotBeFound("reference.specified=false");
}
@Test
@Transactional
public void getAllCustomersByNumberIsGreaterThanOrEqualToSomething() throws Exception {
public void getAllCustomersByReferenceIsGreaterThanOrEqualToSomething() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where number greater than or equals to DEFAULT_NUMBER
defaultCustomerShouldBeFound("number.greaterOrEqualThan=" + DEFAULT_NUMBER);
// Get all the customerList where reference greater than or equals to DEFAULT_REFERENCE
defaultCustomerShouldBeFound("reference.greaterOrEqualThan=" + DEFAULT_REFERENCE);
// Get all the customerList where number greater than or equals to (DEFAULT_NUMBER + 1)
defaultCustomerShouldNotBeFound("number.greaterOrEqualThan=" + (DEFAULT_NUMBER + 1));
// Get all the customerList where reference greater than or equals to (DEFAULT_REFERENCE + 1)
defaultCustomerShouldNotBeFound("reference.greaterOrEqualThan=" + (DEFAULT_REFERENCE + 1));
}
@Test
@Transactional
public void getAllCustomersByNumberIsLessThanSomething() throws Exception {
public void getAllCustomersByReferenceIsLessThanSomething() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where number less than or equals to DEFAULT_NUMBER
defaultCustomerShouldNotBeFound("number.lessThan=" + DEFAULT_NUMBER);
// Get all the customerList where reference less than or equals to DEFAULT_REFERENCE
defaultCustomerShouldNotBeFound("reference.lessThan=" + DEFAULT_REFERENCE);
// Get all the customerList where number less than or equals to (DEFAULT_NUMBER + 1)
defaultCustomerShouldBeFound("number.lessThan=" + (DEFAULT_NUMBER + 1));
// Get all the customerList where reference less than or equals to (DEFAULT_REFERENCE + 1)
defaultCustomerShouldBeFound("reference.lessThan=" + (DEFAULT_REFERENCE + 1));
}
@ -435,45 +446,6 @@ public class CustomerResourceIntTest {
defaultCustomerShouldNotBeFound("name.specified=false");
}
@Test
@Transactional
public void getAllCustomersByContractualAddressIsEqualToSomething() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where contractualAddress equals to DEFAULT_CONTRACTUAL_ADDRESS
defaultCustomerShouldBeFound("contractualAddress.equals=" + DEFAULT_CONTRACTUAL_ADDRESS);
// Get all the customerList where contractualAddress equals to UPDATED_CONTRACTUAL_ADDRESS
defaultCustomerShouldNotBeFound("contractualAddress.equals=" + UPDATED_CONTRACTUAL_ADDRESS);
}
@Test
@Transactional
public void getAllCustomersByContractualAddressIsInShouldWork() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where contractualAddress in DEFAULT_CONTRACTUAL_ADDRESS or UPDATED_CONTRACTUAL_ADDRESS
defaultCustomerShouldBeFound("contractualAddress.in=" + DEFAULT_CONTRACTUAL_ADDRESS + "," + UPDATED_CONTRACTUAL_ADDRESS);
// Get all the customerList where contractualAddress equals to UPDATED_CONTRACTUAL_ADDRESS
defaultCustomerShouldNotBeFound("contractualAddress.in=" + UPDATED_CONTRACTUAL_ADDRESS);
}
@Test
@Transactional
public void getAllCustomersByContractualAddressIsNullOrNotNull() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where contractualAddress is not null
defaultCustomerShouldBeFound("contractualAddress.specified=true");
// Get all the customerList where contractualAddress is null
defaultCustomerShouldNotBeFound("contractualAddress.specified=false");
}
@Test
@Transactional
public void getAllCustomersByContractualSalutationIsEqualToSomething() throws Exception {
@ -515,41 +487,41 @@ public class CustomerResourceIntTest {
@Test
@Transactional
public void getAllCustomersByBillingAddressIsEqualToSomething() throws Exception {
public void getAllCustomersByContractualAddressIsEqualToSomething() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where billingAddress equals to DEFAULT_BILLING_ADDRESS
defaultCustomerShouldBeFound("billingAddress.equals=" + DEFAULT_BILLING_ADDRESS);
// Get all the customerList where contractualAddress equals to DEFAULT_CONTRACTUAL_ADDRESS
defaultCustomerShouldBeFound("contractualAddress.equals=" + DEFAULT_CONTRACTUAL_ADDRESS);
// Get all the customerList where billingAddress equals to UPDATED_BILLING_ADDRESS
defaultCustomerShouldNotBeFound("billingAddress.equals=" + UPDATED_BILLING_ADDRESS);
// Get all the customerList where contractualAddress equals to UPDATED_CONTRACTUAL_ADDRESS
defaultCustomerShouldNotBeFound("contractualAddress.equals=" + UPDATED_CONTRACTUAL_ADDRESS);
}
@Test
@Transactional
public void getAllCustomersByBillingAddressIsInShouldWork() throws Exception {
public void getAllCustomersByContractualAddressIsInShouldWork() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where billingAddress in DEFAULT_BILLING_ADDRESS or UPDATED_BILLING_ADDRESS
defaultCustomerShouldBeFound("billingAddress.in=" + DEFAULT_BILLING_ADDRESS + "," + UPDATED_BILLING_ADDRESS);
// Get all the customerList where contractualAddress in DEFAULT_CONTRACTUAL_ADDRESS or UPDATED_CONTRACTUAL_ADDRESS
defaultCustomerShouldBeFound("contractualAddress.in=" + DEFAULT_CONTRACTUAL_ADDRESS + "," + UPDATED_CONTRACTUAL_ADDRESS);
// Get all the customerList where billingAddress equals to UPDATED_BILLING_ADDRESS
defaultCustomerShouldNotBeFound("billingAddress.in=" + UPDATED_BILLING_ADDRESS);
// Get all the customerList where contractualAddress equals to UPDATED_CONTRACTUAL_ADDRESS
defaultCustomerShouldNotBeFound("contractualAddress.in=" + UPDATED_CONTRACTUAL_ADDRESS);
}
@Test
@Transactional
public void getAllCustomersByBillingAddressIsNullOrNotNull() throws Exception {
public void getAllCustomersByContractualAddressIsNullOrNotNull() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where billingAddress is not null
defaultCustomerShouldBeFound("billingAddress.specified=true");
// Get all the customerList where contractualAddress is not null
defaultCustomerShouldBeFound("contractualAddress.specified=true");
// Get all the customerList where billingAddress is null
defaultCustomerShouldNotBeFound("billingAddress.specified=false");
// Get all the customerList where contractualAddress is null
defaultCustomerShouldNotBeFound("contractualAddress.specified=false");
}
@Test
@ -593,22 +565,81 @@ public class CustomerResourceIntTest {
@Test
@Transactional
public void getAllCustomersByRoleIsEqualToSomething() throws Exception {
public void getAllCustomersByBillingAddressIsEqualToSomething() throws Exception {
// Initialize the database
CustomerContact role = CustomerContactResourceIntTest.createEntity(em);
em.persist(role);
em.flush();
customer.addRole(role);
customerRepository.saveAndFlush(customer);
Long roleId = role.getId();
// Get all the customerList where role equals to roleId
defaultCustomerShouldBeFound("roleId.equals=" + roleId);
// Get all the customerList where billingAddress equals to DEFAULT_BILLING_ADDRESS
defaultCustomerShouldBeFound("billingAddress.equals=" + DEFAULT_BILLING_ADDRESS);
// Get all the customerList where role equals to roleId + 1
defaultCustomerShouldNotBeFound("roleId.equals=" + (roleId + 1));
// Get all the customerList where billingAddress equals to UPDATED_BILLING_ADDRESS
defaultCustomerShouldNotBeFound("billingAddress.equals=" + UPDATED_BILLING_ADDRESS);
}
@Test
@Transactional
public void getAllCustomersByBillingAddressIsInShouldWork() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where billingAddress in DEFAULT_BILLING_ADDRESS or UPDATED_BILLING_ADDRESS
defaultCustomerShouldBeFound("billingAddress.in=" + DEFAULT_BILLING_ADDRESS + "," + UPDATED_BILLING_ADDRESS);
// Get all the customerList where billingAddress equals to UPDATED_BILLING_ADDRESS
defaultCustomerShouldNotBeFound("billingAddress.in=" + UPDATED_BILLING_ADDRESS);
}
@Test
@Transactional
public void getAllCustomersByBillingAddressIsNullOrNotNull() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where billingAddress is not null
defaultCustomerShouldBeFound("billingAddress.specified=true");
// Get all the customerList where billingAddress is null
defaultCustomerShouldNotBeFound("billingAddress.specified=false");
}
@Test
@Transactional
public void getAllCustomersByRemarkIsEqualToSomething() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where remark equals to DEFAULT_REMARK
defaultCustomerShouldBeFound("remark.equals=" + DEFAULT_REMARK);
// Get all the customerList where remark equals to UPDATED_REMARK
defaultCustomerShouldNotBeFound("remark.equals=" + UPDATED_REMARK);
}
@Test
@Transactional
public void getAllCustomersByRemarkIsInShouldWork() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where remark in DEFAULT_REMARK or UPDATED_REMARK
defaultCustomerShouldBeFound("remark.in=" + DEFAULT_REMARK + "," + UPDATED_REMARK);
// Get all the customerList where remark equals to UPDATED_REMARK
defaultCustomerShouldNotBeFound("remark.in=" + UPDATED_REMARK);
}
@Test
@Transactional
public void getAllCustomersByRemarkIsNullOrNotNull() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where remark is not null
defaultCustomerShouldBeFound("remark.specified=true");
// Get all the customerList where remark is null
defaultCustomerShouldNotBeFound("remark.specified=false");
}
@Test
@Transactional
@ -628,6 +659,25 @@ public class CustomerResourceIntTest {
defaultCustomerShouldNotBeFound("membershipId.equals=" + (membershipId + 1));
}
@Test
@Transactional
public void getAllCustomersBySepamandateIsEqualToSomething() throws Exception {
// Initialize the database
SepaMandate sepamandate = SepaMandateResourceIntTest.createEntity(em);
em.persist(sepamandate);
em.flush();
customer.addSepamandate(sepamandate);
customerRepository.saveAndFlush(customer);
Long sepamandateId = sepamandate.getId();
// Get all the customerList where sepamandate equals to sepamandateId
defaultCustomerShouldBeFound("sepamandateId.equals=" + sepamandateId);
// Get all the customerList where sepamandate equals to sepamandateId + 1
defaultCustomerShouldNotBeFound("sepamandateId.equals=" + (sepamandateId + 1));
}
/**
* Executes the search, and checks that the default entity is returned
*/
@ -636,13 +686,14 @@ public class CustomerResourceIntTest {
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].id").value(hasItem(customer.getId().intValue())))
.andExpect(jsonPath("$.[*].number").value(hasItem(DEFAULT_NUMBER)))
.andExpect(jsonPath("$.[*].reference").value(hasItem(DEFAULT_REFERENCE)))
.andExpect(jsonPath("$.[*].prefix").value(hasItem(DEFAULT_PREFIX)))
.andExpect(jsonPath("$.[*].name").value(hasItem(DEFAULT_NAME)))
.andExpect(jsonPath("$.[*].contractualAddress").value(hasItem(DEFAULT_CONTRACTUAL_ADDRESS)))
.andExpect(jsonPath("$.[*].contractualSalutation").value(hasItem(DEFAULT_CONTRACTUAL_SALUTATION)))
.andExpect(jsonPath("$.[*].contractualAddress").value(hasItem(DEFAULT_CONTRACTUAL_ADDRESS)))
.andExpect(jsonPath("$.[*].billingSalutation").value(hasItem(DEFAULT_BILLING_SALUTATION)))
.andExpect(jsonPath("$.[*].billingAddress").value(hasItem(DEFAULT_BILLING_ADDRESS)))
.andExpect(jsonPath("$.[*].billingSalutation").value(hasItem(DEFAULT_BILLING_SALUTATION)));
.andExpect(jsonPath("$.[*].remark").value(hasItem(DEFAULT_REMARK)));
// Check, that the count call also returns 1
restCustomerMockMvc.perform(get("/api/customers/count?sort=id,desc&" + filter))
@ -690,13 +741,14 @@ public class CustomerResourceIntTest {
// Disconnect from session so that the updates on updatedCustomer are not directly saved in db
em.detach(updatedCustomer);
updatedCustomer
.number(UPDATED_NUMBER)
.reference(UPDATED_REFERENCE)
.prefix(UPDATED_PREFIX)
.name(UPDATED_NAME)
.contractualAddress(UPDATED_CONTRACTUAL_ADDRESS)
.contractualSalutation(UPDATED_CONTRACTUAL_SALUTATION)
.contractualAddress(UPDATED_CONTRACTUAL_ADDRESS)
.billingSalutation(UPDATED_BILLING_SALUTATION)
.billingAddress(UPDATED_BILLING_ADDRESS)
.billingSalutation(UPDATED_BILLING_SALUTATION);
.remark(UPDATED_REMARK);
CustomerDTO customerDTO = customerMapper.toDto(updatedCustomer);
restCustomerMockMvc.perform(put("/api/customers")
@ -708,13 +760,14 @@ public class CustomerResourceIntTest {
List<Customer> customerList = customerRepository.findAll();
assertThat(customerList).hasSize(databaseSizeBeforeUpdate);
Customer testCustomer = customerList.get(customerList.size() - 1);
assertThat(testCustomer.getNumber()).isEqualTo(UPDATED_NUMBER);
assertThat(testCustomer.getReference()).isEqualTo(UPDATED_REFERENCE);
assertThat(testCustomer.getPrefix()).isEqualTo(UPDATED_PREFIX);
assertThat(testCustomer.getName()).isEqualTo(UPDATED_NAME);
assertThat(testCustomer.getContractualAddress()).isEqualTo(UPDATED_CONTRACTUAL_ADDRESS);
assertThat(testCustomer.getContractualSalutation()).isEqualTo(UPDATED_CONTRACTUAL_SALUTATION);
assertThat(testCustomer.getBillingAddress()).isEqualTo(UPDATED_BILLING_ADDRESS);
assertThat(testCustomer.getContractualAddress()).isEqualTo(UPDATED_CONTRACTUAL_ADDRESS);
assertThat(testCustomer.getBillingSalutation()).isEqualTo(UPDATED_BILLING_SALUTATION);
assertThat(testCustomer.getBillingAddress()).isEqualTo(UPDATED_BILLING_ADDRESS);
assertThat(testCustomer.getRemark()).isEqualTo(UPDATED_REMARK);
}
@Test

View File

@ -1,16 +1,19 @@
package org.hostsharing.hsadminng.web.rest;
import org.hostsharing.hsadminng.HsadminNgApp;
import org.hostsharing.hsadminng.domain.Asset;
import org.hostsharing.hsadminng.domain.Customer;
import org.hostsharing.hsadminng.domain.Membership;
import org.hostsharing.hsadminng.domain.Share;
import org.hostsharing.hsadminng.domain.Asset;
import org.hostsharing.hsadminng.domain.Customer;
import org.hostsharing.hsadminng.repository.MembershipRepository;
import org.hostsharing.hsadminng.service.MembershipQueryService;
import org.hostsharing.hsadminng.service.MembershipService;
import org.hostsharing.hsadminng.service.dto.MembershipDTO;
import org.hostsharing.hsadminng.service.mapper.MembershipMapper;
import org.hostsharing.hsadminng.web.rest.errors.ExceptionTranslator;
import org.hostsharing.hsadminng.service.dto.MembershipCriteria;
import org.hostsharing.hsadminng.service.MembershipQueryService;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -31,9 +34,10 @@ import java.time.LocalDate;
import java.time.ZoneId;
import java.util.List;
import static org.hostsharing.hsadminng.web.rest.TestUtil.createFormattingConversionService;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.hasItem;
import static org.hostsharing.hsadminng.web.rest.TestUtil.createFormattingConversionService;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
@ -46,11 +50,17 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
@SpringBootTest(classes = HsadminNgApp.class)
public class MembershipResourceIntTest {
private static final LocalDate DEFAULT_SINCE_DATE = LocalDate.ofEpochDay(0L);
private static final LocalDate UPDATED_SINCE_DATE = LocalDate.now(ZoneId.systemDefault());
private static final LocalDate DEFAULT_DOCUMENT_DATE = LocalDate.ofEpochDay(0L);
private static final LocalDate UPDATED_DOCUMENT_DATE = LocalDate.now(ZoneId.systemDefault());
private static final LocalDate DEFAULT_UNTIL_DATE = LocalDate.ofEpochDay(0L);
private static final LocalDate UPDATED_UNTIL_DATE = LocalDate.now(ZoneId.systemDefault());
private static final LocalDate DEFAULT_MEMBER_FROM = LocalDate.ofEpochDay(0L);
private static final LocalDate UPDATED_MEMBER_FROM = LocalDate.now(ZoneId.systemDefault());
private static final LocalDate DEFAULT_MEMBER_UNTIL = LocalDate.ofEpochDay(0L);
private static final LocalDate UPDATED_MEMBER_UNTIL = LocalDate.now(ZoneId.systemDefault());
private static final String DEFAULT_REMARK = "AAAAAAAAAA";
private static final String UPDATED_REMARK = "BBBBBBBBBB";
@Autowired
private MembershipRepository membershipRepository;
@ -103,8 +113,10 @@ public class MembershipResourceIntTest {
*/
public static Membership createEntity(EntityManager em) {
Membership membership = new Membership()
.sinceDate(DEFAULT_SINCE_DATE)
.untilDate(DEFAULT_UNTIL_DATE);
.documentDate(DEFAULT_DOCUMENT_DATE)
.memberFrom(DEFAULT_MEMBER_FROM)
.memberUntil(DEFAULT_MEMBER_UNTIL)
.remark(DEFAULT_REMARK);
// Add required entity
Customer customer = CustomerResourceIntTest.createEntity(em);
em.persist(customer);
@ -134,8 +146,10 @@ public class MembershipResourceIntTest {
List<Membership> membershipList = membershipRepository.findAll();
assertThat(membershipList).hasSize(databaseSizeBeforeCreate + 1);
Membership testMembership = membershipList.get(membershipList.size() - 1);
assertThat(testMembership.getSinceDate()).isEqualTo(DEFAULT_SINCE_DATE);
assertThat(testMembership.getUntilDate()).isEqualTo(DEFAULT_UNTIL_DATE);
assertThat(testMembership.getDocumentDate()).isEqualTo(DEFAULT_DOCUMENT_DATE);
assertThat(testMembership.getMemberFrom()).isEqualTo(DEFAULT_MEMBER_FROM);
assertThat(testMembership.getMemberUntil()).isEqualTo(DEFAULT_MEMBER_UNTIL);
assertThat(testMembership.getRemark()).isEqualTo(DEFAULT_REMARK);
}
@Test
@ -160,10 +174,29 @@ public class MembershipResourceIntTest {
@Test
@Transactional
public void checkSinceDateIsRequired() throws Exception {
public void checkDocumentDateIsRequired() throws Exception {
int databaseSizeBeforeTest = membershipRepository.findAll().size();
// set the field null
membership.setSinceDate(null);
membership.setDocumentDate(null);
// Create the Membership, which fails.
MembershipDTO membershipDTO = membershipMapper.toDto(membership);
restMembershipMockMvc.perform(post("/api/memberships")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(membershipDTO)))
.andExpect(status().isBadRequest());
List<Membership> membershipList = membershipRepository.findAll();
assertThat(membershipList).hasSize(databaseSizeBeforeTest);
}
@Test
@Transactional
public void checkMemberFromIsRequired() throws Exception {
int databaseSizeBeforeTest = membershipRepository.findAll().size();
// set the field null
membership.setMemberFrom(null);
// Create the Membership, which fails.
MembershipDTO membershipDTO = membershipMapper.toDto(membership);
@ -188,8 +221,10 @@ public class MembershipResourceIntTest {
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].id").value(hasItem(membership.getId().intValue())))
.andExpect(jsonPath("$.[*].sinceDate").value(hasItem(DEFAULT_SINCE_DATE.toString())))
.andExpect(jsonPath("$.[*].untilDate").value(hasItem(DEFAULT_UNTIL_DATE.toString())));
.andExpect(jsonPath("$.[*].documentDate").value(hasItem(DEFAULT_DOCUMENT_DATE.toString())))
.andExpect(jsonPath("$.[*].memberFrom").value(hasItem(DEFAULT_MEMBER_FROM.toString())))
.andExpect(jsonPath("$.[*].memberUntil").value(hasItem(DEFAULT_MEMBER_UNTIL.toString())))
.andExpect(jsonPath("$.[*].remark").value(hasItem(DEFAULT_REMARK.toString())));
}
@Test
@ -203,142 +238,249 @@ public class MembershipResourceIntTest {
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.id").value(membership.getId().intValue()))
.andExpect(jsonPath("$.sinceDate").value(DEFAULT_SINCE_DATE.toString()))
.andExpect(jsonPath("$.untilDate").value(DEFAULT_UNTIL_DATE.toString()));
.andExpect(jsonPath("$.documentDate").value(DEFAULT_DOCUMENT_DATE.toString()))
.andExpect(jsonPath("$.memberFrom").value(DEFAULT_MEMBER_FROM.toString()))
.andExpect(jsonPath("$.memberUntil").value(DEFAULT_MEMBER_UNTIL.toString()))
.andExpect(jsonPath("$.remark").value(DEFAULT_REMARK.toString()));
}
@Test
@Transactional
public void getAllMembershipsBySinceDateIsEqualToSomething() throws Exception {
public void getAllMembershipsByDocumentDateIsEqualToSomething() throws Exception {
// Initialize the database
membershipRepository.saveAndFlush(membership);
// Get all the membershipList where sinceDate equals to DEFAULT_SINCE_DATE
defaultMembershipShouldBeFound("sinceDate.equals=" + DEFAULT_SINCE_DATE);
// Get all the membershipList where documentDate equals to DEFAULT_DOCUMENT_DATE
defaultMembershipShouldBeFound("documentDate.equals=" + DEFAULT_DOCUMENT_DATE);
// Get all the membershipList where sinceDate equals to UPDATED_SINCE_DATE
defaultMembershipShouldNotBeFound("sinceDate.equals=" + UPDATED_SINCE_DATE);
// Get all the membershipList where documentDate equals to UPDATED_DOCUMENT_DATE
defaultMembershipShouldNotBeFound("documentDate.equals=" + UPDATED_DOCUMENT_DATE);
}
@Test
@Transactional
public void getAllMembershipsBySinceDateIsInShouldWork() throws Exception {
public void getAllMembershipsByDocumentDateIsInShouldWork() throws Exception {
// Initialize the database
membershipRepository.saveAndFlush(membership);
// Get all the membershipList where sinceDate in DEFAULT_SINCE_DATE or UPDATED_SINCE_DATE
defaultMembershipShouldBeFound("sinceDate.in=" + DEFAULT_SINCE_DATE + "," + UPDATED_SINCE_DATE);
// Get all the membershipList where documentDate in DEFAULT_DOCUMENT_DATE or UPDATED_DOCUMENT_DATE
defaultMembershipShouldBeFound("documentDate.in=" + DEFAULT_DOCUMENT_DATE + "," + UPDATED_DOCUMENT_DATE);
// Get all the membershipList where sinceDate equals to UPDATED_SINCE_DATE
defaultMembershipShouldNotBeFound("sinceDate.in=" + UPDATED_SINCE_DATE);
// Get all the membershipList where documentDate equals to UPDATED_DOCUMENT_DATE
defaultMembershipShouldNotBeFound("documentDate.in=" + UPDATED_DOCUMENT_DATE);
}
@Test
@Transactional
public void getAllMembershipsBySinceDateIsNullOrNotNull() throws Exception {
public void getAllMembershipsByDocumentDateIsNullOrNotNull() throws Exception {
// Initialize the database
membershipRepository.saveAndFlush(membership);
// Get all the membershipList where sinceDate is not null
defaultMembershipShouldBeFound("sinceDate.specified=true");
// Get all the membershipList where documentDate is not null
defaultMembershipShouldBeFound("documentDate.specified=true");
// Get all the membershipList where sinceDate is null
defaultMembershipShouldNotBeFound("sinceDate.specified=false");
// Get all the membershipList where documentDate is null
defaultMembershipShouldNotBeFound("documentDate.specified=false");
}
@Test
@Transactional
public void getAllMembershipsBySinceDateIsGreaterThanOrEqualToSomething() throws Exception {
public void getAllMembershipsByDocumentDateIsGreaterThanOrEqualToSomething() throws Exception {
// Initialize the database
membershipRepository.saveAndFlush(membership);
// Get all the membershipList where sinceDate greater than or equals to DEFAULT_SINCE_DATE
defaultMembershipShouldBeFound("sinceDate.greaterOrEqualThan=" + DEFAULT_SINCE_DATE);
// Get all the membershipList where documentDate greater than or equals to DEFAULT_DOCUMENT_DATE
defaultMembershipShouldBeFound("documentDate.greaterOrEqualThan=" + DEFAULT_DOCUMENT_DATE);
// Get all the membershipList where sinceDate greater than or equals to UPDATED_SINCE_DATE
defaultMembershipShouldNotBeFound("sinceDate.greaterOrEqualThan=" + UPDATED_SINCE_DATE);
// Get all the membershipList where documentDate greater than or equals to UPDATED_DOCUMENT_DATE
defaultMembershipShouldNotBeFound("documentDate.greaterOrEqualThan=" + UPDATED_DOCUMENT_DATE);
}
@Test
@Transactional
public void getAllMembershipsBySinceDateIsLessThanSomething() throws Exception {
public void getAllMembershipsByDocumentDateIsLessThanSomething() throws Exception {
// Initialize the database
membershipRepository.saveAndFlush(membership);
// Get all the membershipList where sinceDate less than or equals to DEFAULT_SINCE_DATE
defaultMembershipShouldNotBeFound("sinceDate.lessThan=" + DEFAULT_SINCE_DATE);
// Get all the membershipList where documentDate less than or equals to DEFAULT_DOCUMENT_DATE
defaultMembershipShouldNotBeFound("documentDate.lessThan=" + DEFAULT_DOCUMENT_DATE);
// Get all the membershipList where sinceDate less than or equals to UPDATED_SINCE_DATE
defaultMembershipShouldBeFound("sinceDate.lessThan=" + UPDATED_SINCE_DATE);
// Get all the membershipList where documentDate less than or equals to UPDATED_DOCUMENT_DATE
defaultMembershipShouldBeFound("documentDate.lessThan=" + UPDATED_DOCUMENT_DATE);
}
@Test
@Transactional
public void getAllMembershipsByUntilDateIsEqualToSomething() throws Exception {
public void getAllMembershipsByMemberFromIsEqualToSomething() throws Exception {
// Initialize the database
membershipRepository.saveAndFlush(membership);
// Get all the membershipList where untilDate equals to DEFAULT_UNTIL_DATE
defaultMembershipShouldBeFound("untilDate.equals=" + DEFAULT_UNTIL_DATE);
// Get all the membershipList where memberFrom equals to DEFAULT_MEMBER_FROM
defaultMembershipShouldBeFound("memberFrom.equals=" + DEFAULT_MEMBER_FROM);
// Get all the membershipList where untilDate equals to UPDATED_UNTIL_DATE
defaultMembershipShouldNotBeFound("untilDate.equals=" + UPDATED_UNTIL_DATE);
// Get all the membershipList where memberFrom equals to UPDATED_MEMBER_FROM
defaultMembershipShouldNotBeFound("memberFrom.equals=" + UPDATED_MEMBER_FROM);
}
@Test
@Transactional
public void getAllMembershipsByUntilDateIsInShouldWork() throws Exception {
public void getAllMembershipsByMemberFromIsInShouldWork() throws Exception {
// Initialize the database
membershipRepository.saveAndFlush(membership);
// Get all the membershipList where untilDate in DEFAULT_UNTIL_DATE or UPDATED_UNTIL_DATE
defaultMembershipShouldBeFound("untilDate.in=" + DEFAULT_UNTIL_DATE + "," + UPDATED_UNTIL_DATE);
// Get all the membershipList where memberFrom in DEFAULT_MEMBER_FROM or UPDATED_MEMBER_FROM
defaultMembershipShouldBeFound("memberFrom.in=" + DEFAULT_MEMBER_FROM + "," + UPDATED_MEMBER_FROM);
// Get all the membershipList where untilDate equals to UPDATED_UNTIL_DATE
defaultMembershipShouldNotBeFound("untilDate.in=" + UPDATED_UNTIL_DATE);
// Get all the membershipList where memberFrom equals to UPDATED_MEMBER_FROM
defaultMembershipShouldNotBeFound("memberFrom.in=" + UPDATED_MEMBER_FROM);
}
@Test
@Transactional
public void getAllMembershipsByUntilDateIsNullOrNotNull() throws Exception {
public void getAllMembershipsByMemberFromIsNullOrNotNull() throws Exception {
// Initialize the database
membershipRepository.saveAndFlush(membership);
// Get all the membershipList where untilDate is not null
defaultMembershipShouldBeFound("untilDate.specified=true");
// Get all the membershipList where memberFrom is not null
defaultMembershipShouldBeFound("memberFrom.specified=true");
// Get all the membershipList where untilDate is null
defaultMembershipShouldNotBeFound("untilDate.specified=false");
// Get all the membershipList where memberFrom is null
defaultMembershipShouldNotBeFound("memberFrom.specified=false");
}
@Test
@Transactional
public void getAllMembershipsByUntilDateIsGreaterThanOrEqualToSomething() throws Exception {
public void getAllMembershipsByMemberFromIsGreaterThanOrEqualToSomething() throws Exception {
// Initialize the database
membershipRepository.saveAndFlush(membership);
// Get all the membershipList where untilDate greater than or equals to DEFAULT_UNTIL_DATE
defaultMembershipShouldBeFound("untilDate.greaterOrEqualThan=" + DEFAULT_UNTIL_DATE);
// Get all the membershipList where memberFrom greater than or equals to DEFAULT_MEMBER_FROM
defaultMembershipShouldBeFound("memberFrom.greaterOrEqualThan=" + DEFAULT_MEMBER_FROM);
// Get all the membershipList where untilDate greater than or equals to UPDATED_UNTIL_DATE
defaultMembershipShouldNotBeFound("untilDate.greaterOrEqualThan=" + UPDATED_UNTIL_DATE);
// Get all the membershipList where memberFrom greater than or equals to UPDATED_MEMBER_FROM
defaultMembershipShouldNotBeFound("memberFrom.greaterOrEqualThan=" + UPDATED_MEMBER_FROM);
}
@Test
@Transactional
public void getAllMembershipsByUntilDateIsLessThanSomething() throws Exception {
public void getAllMembershipsByMemberFromIsLessThanSomething() throws Exception {
// Initialize the database
membershipRepository.saveAndFlush(membership);
// Get all the membershipList where untilDate less than or equals to DEFAULT_UNTIL_DATE
defaultMembershipShouldNotBeFound("untilDate.lessThan=" + DEFAULT_UNTIL_DATE);
// Get all the membershipList where memberFrom less than or equals to DEFAULT_MEMBER_FROM
defaultMembershipShouldNotBeFound("memberFrom.lessThan=" + DEFAULT_MEMBER_FROM);
// Get all the membershipList where untilDate less than or equals to UPDATED_UNTIL_DATE
defaultMembershipShouldBeFound("untilDate.lessThan=" + UPDATED_UNTIL_DATE);
// Get all the membershipList where memberFrom less than or equals to UPDATED_MEMBER_FROM
defaultMembershipShouldBeFound("memberFrom.lessThan=" + UPDATED_MEMBER_FROM);
}
@Test
@Transactional
public void getAllMembershipsByMemberUntilIsEqualToSomething() throws Exception {
// Initialize the database
membershipRepository.saveAndFlush(membership);
// Get all the membershipList where memberUntil equals to DEFAULT_MEMBER_UNTIL
defaultMembershipShouldBeFound("memberUntil.equals=" + DEFAULT_MEMBER_UNTIL);
// Get all the membershipList where memberUntil equals to UPDATED_MEMBER_UNTIL
defaultMembershipShouldNotBeFound("memberUntil.equals=" + UPDATED_MEMBER_UNTIL);
}
@Test
@Transactional
public void getAllMembershipsByMemberUntilIsInShouldWork() throws Exception {
// Initialize the database
membershipRepository.saveAndFlush(membership);
// Get all the membershipList where memberUntil in DEFAULT_MEMBER_UNTIL or UPDATED_MEMBER_UNTIL
defaultMembershipShouldBeFound("memberUntil.in=" + DEFAULT_MEMBER_UNTIL + "," + UPDATED_MEMBER_UNTIL);
// Get all the membershipList where memberUntil equals to UPDATED_MEMBER_UNTIL
defaultMembershipShouldNotBeFound("memberUntil.in=" + UPDATED_MEMBER_UNTIL);
}
@Test
@Transactional
public void getAllMembershipsByMemberUntilIsNullOrNotNull() throws Exception {
// Initialize the database
membershipRepository.saveAndFlush(membership);
// Get all the membershipList where memberUntil is not null
defaultMembershipShouldBeFound("memberUntil.specified=true");
// Get all the membershipList where memberUntil is null
defaultMembershipShouldNotBeFound("memberUntil.specified=false");
}
@Test
@Transactional
public void getAllMembershipsByMemberUntilIsGreaterThanOrEqualToSomething() throws Exception {
// Initialize the database
membershipRepository.saveAndFlush(membership);
// Get all the membershipList where memberUntil greater than or equals to DEFAULT_MEMBER_UNTIL
defaultMembershipShouldBeFound("memberUntil.greaterOrEqualThan=" + DEFAULT_MEMBER_UNTIL);
// Get all the membershipList where memberUntil greater than or equals to UPDATED_MEMBER_UNTIL
defaultMembershipShouldNotBeFound("memberUntil.greaterOrEqualThan=" + UPDATED_MEMBER_UNTIL);
}
@Test
@Transactional
public void getAllMembershipsByMemberUntilIsLessThanSomething() throws Exception {
// Initialize the database
membershipRepository.saveAndFlush(membership);
// Get all the membershipList where memberUntil less than or equals to DEFAULT_MEMBER_UNTIL
defaultMembershipShouldNotBeFound("memberUntil.lessThan=" + DEFAULT_MEMBER_UNTIL);
// Get all the membershipList where memberUntil less than or equals to UPDATED_MEMBER_UNTIL
defaultMembershipShouldBeFound("memberUntil.lessThan=" + UPDATED_MEMBER_UNTIL);
}
@Test
@Transactional
public void getAllMembershipsByRemarkIsEqualToSomething() throws Exception {
// Initialize the database
membershipRepository.saveAndFlush(membership);
// Get all the membershipList where remark equals to DEFAULT_REMARK
defaultMembershipShouldBeFound("remark.equals=" + DEFAULT_REMARK);
// Get all the membershipList where remark equals to UPDATED_REMARK
defaultMembershipShouldNotBeFound("remark.equals=" + UPDATED_REMARK);
}
@Test
@Transactional
public void getAllMembershipsByRemarkIsInShouldWork() throws Exception {
// Initialize the database
membershipRepository.saveAndFlush(membership);
// Get all the membershipList where remark in DEFAULT_REMARK or UPDATED_REMARK
defaultMembershipShouldBeFound("remark.in=" + DEFAULT_REMARK + "," + UPDATED_REMARK);
// Get all the membershipList where remark equals to UPDATED_REMARK
defaultMembershipShouldNotBeFound("remark.in=" + UPDATED_REMARK);
}
@Test
@Transactional
public void getAllMembershipsByRemarkIsNullOrNotNull() throws Exception {
// Initialize the database
membershipRepository.saveAndFlush(membership);
// Get all the membershipList where remark is not null
defaultMembershipShouldBeFound("remark.specified=true");
// Get all the membershipList where remark is null
defaultMembershipShouldNotBeFound("remark.specified=false");
}
@Test
@Transactional
public void getAllMembershipsByShareIsEqualToSomething() throws Exception {
@ -403,8 +545,10 @@ public class MembershipResourceIntTest {
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].id").value(hasItem(membership.getId().intValue())))
.andExpect(jsonPath("$.[*].sinceDate").value(hasItem(DEFAULT_SINCE_DATE.toString())))
.andExpect(jsonPath("$.[*].untilDate").value(hasItem(DEFAULT_UNTIL_DATE.toString())));
.andExpect(jsonPath("$.[*].documentDate").value(hasItem(DEFAULT_DOCUMENT_DATE.toString())))
.andExpect(jsonPath("$.[*].memberFrom").value(hasItem(DEFAULT_MEMBER_FROM.toString())))
.andExpect(jsonPath("$.[*].memberUntil").value(hasItem(DEFAULT_MEMBER_UNTIL.toString())))
.andExpect(jsonPath("$.[*].remark").value(hasItem(DEFAULT_REMARK)));
// Check, that the count call also returns 1
restMembershipMockMvc.perform(get("/api/memberships/count?sort=id,desc&" + filter))
@ -452,8 +596,10 @@ public class MembershipResourceIntTest {
// Disconnect from session so that the updates on updatedMembership are not directly saved in db
em.detach(updatedMembership);
updatedMembership
.sinceDate(UPDATED_SINCE_DATE)
.untilDate(UPDATED_UNTIL_DATE);
.documentDate(UPDATED_DOCUMENT_DATE)
.memberFrom(UPDATED_MEMBER_FROM)
.memberUntil(UPDATED_MEMBER_UNTIL)
.remark(UPDATED_REMARK);
MembershipDTO membershipDTO = membershipMapper.toDto(updatedMembership);
restMembershipMockMvc.perform(put("/api/memberships")
@ -465,8 +611,10 @@ public class MembershipResourceIntTest {
List<Membership> membershipList = membershipRepository.findAll();
assertThat(membershipList).hasSize(databaseSizeBeforeUpdate);
Membership testMembership = membershipList.get(membershipList.size() - 1);
assertThat(testMembership.getSinceDate()).isEqualTo(UPDATED_SINCE_DATE);
assertThat(testMembership.getUntilDate()).isEqualTo(UPDATED_UNTIL_DATE);
assertThat(testMembership.getDocumentDate()).isEqualTo(UPDATED_DOCUMENT_DATE);
assertThat(testMembership.getMemberFrom()).isEqualTo(UPDATED_MEMBER_FROM);
assertThat(testMembership.getMemberUntil()).isEqualTo(UPDATED_MEMBER_UNTIL);
assertThat(testMembership.getRemark()).isEqualTo(UPDATED_REMARK);
}
@Test

View File

@ -0,0 +1,972 @@
package org.hostsharing.hsadminng.web.rest;
import org.hostsharing.hsadminng.HsadminNgApp;
import org.hostsharing.hsadminng.domain.SepaMandate;
import org.hostsharing.hsadminng.domain.Customer;
import org.hostsharing.hsadminng.repository.SepaMandateRepository;
import org.hostsharing.hsadminng.service.SepaMandateService;
import org.hostsharing.hsadminng.service.dto.SepaMandateDTO;
import org.hostsharing.hsadminng.service.mapper.SepaMandateMapper;
import org.hostsharing.hsadminng.web.rest.errors.ExceptionTranslator;
import org.hostsharing.hsadminng.service.dto.SepaMandateCriteria;
import org.hostsharing.hsadminng.service.SepaMandateQueryService;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.MockitoAnnotations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.Validator;
import javax.persistence.EntityManager;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.List;
import static org.hostsharing.hsadminng.web.rest.TestUtil.createFormattingConversionService;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.hasItem;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
/**
* Test class for the SepaMandateResource REST controller.
*
* @see SepaMandateResource
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = HsadminNgApp.class)
public class SepaMandateResourceIntTest {
private static final String DEFAULT_REFERENCE = "AAAAAAAAAA";
private static final String UPDATED_REFERENCE = "BBBBBBBBBB";
private static final String DEFAULT_IBAN = "AAAAAAAAAA";
private static final String UPDATED_IBAN = "BBBBBBBBBB";
private static final String DEFAULT_BIC = "AAAAAAAAAA";
private static final String UPDATED_BIC = "BBBBBBBBBB";
private static final LocalDate DEFAULT_DOCUMENT_DATE = LocalDate.ofEpochDay(0L);
private static final LocalDate UPDATED_DOCUMENT_DATE = LocalDate.now(ZoneId.systemDefault());
private static final LocalDate DEFAULT_VALID_FROM = LocalDate.ofEpochDay(0L);
private static final LocalDate UPDATED_VALID_FROM = LocalDate.now(ZoneId.systemDefault());
private static final LocalDate DEFAULT_VALID_UNTIL = LocalDate.ofEpochDay(0L);
private static final LocalDate UPDATED_VALID_UNTIL = LocalDate.now(ZoneId.systemDefault());
private static final LocalDate DEFAULT_LAST_USED = LocalDate.ofEpochDay(0L);
private static final LocalDate UPDATED_LAST_USED = LocalDate.now(ZoneId.systemDefault());
private static final LocalDate DEFAULT_CANCELLATION_DATE = LocalDate.ofEpochDay(0L);
private static final LocalDate UPDATED_CANCELLATION_DATE = LocalDate.now(ZoneId.systemDefault());
private static final String DEFAULT_REMARK = "AAAAAAAAAA";
private static final String UPDATED_REMARK = "BBBBBBBBBB";
@Autowired
private SepaMandateRepository sepaMandateRepository;
@Autowired
private SepaMandateMapper sepaMandateMapper;
@Autowired
private SepaMandateService sepaMandateService;
@Autowired
private SepaMandateQueryService sepaMandateQueryService;
@Autowired
private MappingJackson2HttpMessageConverter jacksonMessageConverter;
@Autowired
private PageableHandlerMethodArgumentResolver pageableArgumentResolver;
@Autowired
private ExceptionTranslator exceptionTranslator;
@Autowired
private EntityManager em;
@Autowired
private Validator validator;
private MockMvc restSepaMandateMockMvc;
private SepaMandate sepaMandate;
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
final SepaMandateResource sepaMandateResource = new SepaMandateResource(sepaMandateService, sepaMandateQueryService);
this.restSepaMandateMockMvc = MockMvcBuilders.standaloneSetup(sepaMandateResource)
.setCustomArgumentResolvers(pageableArgumentResolver)
.setControllerAdvice(exceptionTranslator)
.setConversionService(createFormattingConversionService())
.setMessageConverters(jacksonMessageConverter)
.setValidator(validator).build();
}
/**
* Create an entity for this test.
*
* This is a static method, as tests for other entities might also need it,
* if they test an entity which requires the current entity.
*/
public static SepaMandate createEntity(EntityManager em) {
SepaMandate sepaMandate = new SepaMandate()
.reference(DEFAULT_REFERENCE)
.iban(DEFAULT_IBAN)
.bic(DEFAULT_BIC)
.documentDate(DEFAULT_DOCUMENT_DATE)
.validFrom(DEFAULT_VALID_FROM)
.validUntil(DEFAULT_VALID_UNTIL)
.lastUsed(DEFAULT_LAST_USED)
.cancellationDate(DEFAULT_CANCELLATION_DATE)
.remark(DEFAULT_REMARK);
// Add required entity
Customer customer = CustomerResourceIntTest.createEntity(em);
em.persist(customer);
em.flush();
sepaMandate.setCustomer(customer);
return sepaMandate;
}
@Before
public void initTest() {
sepaMandate = createEntity(em);
}
@Test
@Transactional
public void createSepaMandate() throws Exception {
int databaseSizeBeforeCreate = sepaMandateRepository.findAll().size();
// Create the SepaMandate
SepaMandateDTO sepaMandateDTO = sepaMandateMapper.toDto(sepaMandate);
restSepaMandateMockMvc.perform(post("/api/sepa-mandates")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(sepaMandateDTO)))
.andExpect(status().isCreated());
// Validate the SepaMandate in the database
List<SepaMandate> sepaMandateList = sepaMandateRepository.findAll();
assertThat(sepaMandateList).hasSize(databaseSizeBeforeCreate + 1);
SepaMandate testSepaMandate = sepaMandateList.get(sepaMandateList.size() - 1);
assertThat(testSepaMandate.getReference()).isEqualTo(DEFAULT_REFERENCE);
assertThat(testSepaMandate.getIban()).isEqualTo(DEFAULT_IBAN);
assertThat(testSepaMandate.getBic()).isEqualTo(DEFAULT_BIC);
assertThat(testSepaMandate.getDocumentDate()).isEqualTo(DEFAULT_DOCUMENT_DATE);
assertThat(testSepaMandate.getValidFrom()).isEqualTo(DEFAULT_VALID_FROM);
assertThat(testSepaMandate.getValidUntil()).isEqualTo(DEFAULT_VALID_UNTIL);
assertThat(testSepaMandate.getLastUsed()).isEqualTo(DEFAULT_LAST_USED);
assertThat(testSepaMandate.getCancellationDate()).isEqualTo(DEFAULT_CANCELLATION_DATE);
assertThat(testSepaMandate.getRemark()).isEqualTo(DEFAULT_REMARK);
}
@Test
@Transactional
public void createSepaMandateWithExistingId() throws Exception {
int databaseSizeBeforeCreate = sepaMandateRepository.findAll().size();
// Create the SepaMandate with an existing ID
sepaMandate.setId(1L);
SepaMandateDTO sepaMandateDTO = sepaMandateMapper.toDto(sepaMandate);
// An entity with an existing ID cannot be created, so this API call must fail
restSepaMandateMockMvc.perform(post("/api/sepa-mandates")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(sepaMandateDTO)))
.andExpect(status().isBadRequest());
// Validate the SepaMandate in the database
List<SepaMandate> sepaMandateList = sepaMandateRepository.findAll();
assertThat(sepaMandateList).hasSize(databaseSizeBeforeCreate);
}
@Test
@Transactional
public void checkReferenceIsRequired() throws Exception {
int databaseSizeBeforeTest = sepaMandateRepository.findAll().size();
// set the field null
sepaMandate.setReference(null);
// Create the SepaMandate, which fails.
SepaMandateDTO sepaMandateDTO = sepaMandateMapper.toDto(sepaMandate);
restSepaMandateMockMvc.perform(post("/api/sepa-mandates")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(sepaMandateDTO)))
.andExpect(status().isBadRequest());
List<SepaMandate> sepaMandateList = sepaMandateRepository.findAll();
assertThat(sepaMandateList).hasSize(databaseSizeBeforeTest);
}
@Test
@Transactional
public void checkDocumentDateIsRequired() throws Exception {
int databaseSizeBeforeTest = sepaMandateRepository.findAll().size();
// set the field null
sepaMandate.setDocumentDate(null);
// Create the SepaMandate, which fails.
SepaMandateDTO sepaMandateDTO = sepaMandateMapper.toDto(sepaMandate);
restSepaMandateMockMvc.perform(post("/api/sepa-mandates")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(sepaMandateDTO)))
.andExpect(status().isBadRequest());
List<SepaMandate> sepaMandateList = sepaMandateRepository.findAll();
assertThat(sepaMandateList).hasSize(databaseSizeBeforeTest);
}
@Test
@Transactional
public void checkValidFromIsRequired() throws Exception {
int databaseSizeBeforeTest = sepaMandateRepository.findAll().size();
// set the field null
sepaMandate.setValidFrom(null);
// Create the SepaMandate, which fails.
SepaMandateDTO sepaMandateDTO = sepaMandateMapper.toDto(sepaMandate);
restSepaMandateMockMvc.perform(post("/api/sepa-mandates")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(sepaMandateDTO)))
.andExpect(status().isBadRequest());
List<SepaMandate> sepaMandateList = sepaMandateRepository.findAll();
assertThat(sepaMandateList).hasSize(databaseSizeBeforeTest);
}
@Test
@Transactional
public void getAllSepaMandates() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList
restSepaMandateMockMvc.perform(get("/api/sepa-mandates?sort=id,desc"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].id").value(hasItem(sepaMandate.getId().intValue())))
.andExpect(jsonPath("$.[*].reference").value(hasItem(DEFAULT_REFERENCE.toString())))
.andExpect(jsonPath("$.[*].iban").value(hasItem(DEFAULT_IBAN.toString())))
.andExpect(jsonPath("$.[*].bic").value(hasItem(DEFAULT_BIC.toString())))
.andExpect(jsonPath("$.[*].documentDate").value(hasItem(DEFAULT_DOCUMENT_DATE.toString())))
.andExpect(jsonPath("$.[*].validFrom").value(hasItem(DEFAULT_VALID_FROM.toString())))
.andExpect(jsonPath("$.[*].validUntil").value(hasItem(DEFAULT_VALID_UNTIL.toString())))
.andExpect(jsonPath("$.[*].lastUsed").value(hasItem(DEFAULT_LAST_USED.toString())))
.andExpect(jsonPath("$.[*].cancellationDate").value(hasItem(DEFAULT_CANCELLATION_DATE.toString())))
.andExpect(jsonPath("$.[*].remark").value(hasItem(DEFAULT_REMARK.toString())));
}
@Test
@Transactional
public void getSepaMandate() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get the sepaMandate
restSepaMandateMockMvc.perform(get("/api/sepa-mandates/{id}", sepaMandate.getId()))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.id").value(sepaMandate.getId().intValue()))
.andExpect(jsonPath("$.reference").value(DEFAULT_REFERENCE.toString()))
.andExpect(jsonPath("$.iban").value(DEFAULT_IBAN.toString()))
.andExpect(jsonPath("$.bic").value(DEFAULT_BIC.toString()))
.andExpect(jsonPath("$.documentDate").value(DEFAULT_DOCUMENT_DATE.toString()))
.andExpect(jsonPath("$.validFrom").value(DEFAULT_VALID_FROM.toString()))
.andExpect(jsonPath("$.validUntil").value(DEFAULT_VALID_UNTIL.toString()))
.andExpect(jsonPath("$.lastUsed").value(DEFAULT_LAST_USED.toString()))
.andExpect(jsonPath("$.cancellationDate").value(DEFAULT_CANCELLATION_DATE.toString()))
.andExpect(jsonPath("$.remark").value(DEFAULT_REMARK.toString()));
}
@Test
@Transactional
public void getAllSepaMandatesByReferenceIsEqualToSomething() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where reference equals to DEFAULT_REFERENCE
defaultSepaMandateShouldBeFound("reference.equals=" + DEFAULT_REFERENCE);
// Get all the sepaMandateList where reference equals to UPDATED_REFERENCE
defaultSepaMandateShouldNotBeFound("reference.equals=" + UPDATED_REFERENCE);
}
@Test
@Transactional
public void getAllSepaMandatesByReferenceIsInShouldWork() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where reference in DEFAULT_REFERENCE or UPDATED_REFERENCE
defaultSepaMandateShouldBeFound("reference.in=" + DEFAULT_REFERENCE + "," + UPDATED_REFERENCE);
// Get all the sepaMandateList where reference equals to UPDATED_REFERENCE
defaultSepaMandateShouldNotBeFound("reference.in=" + UPDATED_REFERENCE);
}
@Test
@Transactional
public void getAllSepaMandatesByReferenceIsNullOrNotNull() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where reference is not null
defaultSepaMandateShouldBeFound("reference.specified=true");
// Get all the sepaMandateList where reference is null
defaultSepaMandateShouldNotBeFound("reference.specified=false");
}
@Test
@Transactional
public void getAllSepaMandatesByIbanIsEqualToSomething() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where iban equals to DEFAULT_IBAN
defaultSepaMandateShouldBeFound("iban.equals=" + DEFAULT_IBAN);
// Get all the sepaMandateList where iban equals to UPDATED_IBAN
defaultSepaMandateShouldNotBeFound("iban.equals=" + UPDATED_IBAN);
}
@Test
@Transactional
public void getAllSepaMandatesByIbanIsInShouldWork() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where iban in DEFAULT_IBAN or UPDATED_IBAN
defaultSepaMandateShouldBeFound("iban.in=" + DEFAULT_IBAN + "," + UPDATED_IBAN);
// Get all the sepaMandateList where iban equals to UPDATED_IBAN
defaultSepaMandateShouldNotBeFound("iban.in=" + UPDATED_IBAN);
}
@Test
@Transactional
public void getAllSepaMandatesByIbanIsNullOrNotNull() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where iban is not null
defaultSepaMandateShouldBeFound("iban.specified=true");
// Get all the sepaMandateList where iban is null
defaultSepaMandateShouldNotBeFound("iban.specified=false");
}
@Test
@Transactional
public void getAllSepaMandatesByBicIsEqualToSomething() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where bic equals to DEFAULT_BIC
defaultSepaMandateShouldBeFound("bic.equals=" + DEFAULT_BIC);
// Get all the sepaMandateList where bic equals to UPDATED_BIC
defaultSepaMandateShouldNotBeFound("bic.equals=" + UPDATED_BIC);
}
@Test
@Transactional
public void getAllSepaMandatesByBicIsInShouldWork() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where bic in DEFAULT_BIC or UPDATED_BIC
defaultSepaMandateShouldBeFound("bic.in=" + DEFAULT_BIC + "," + UPDATED_BIC);
// Get all the sepaMandateList where bic equals to UPDATED_BIC
defaultSepaMandateShouldNotBeFound("bic.in=" + UPDATED_BIC);
}
@Test
@Transactional
public void getAllSepaMandatesByBicIsNullOrNotNull() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where bic is not null
defaultSepaMandateShouldBeFound("bic.specified=true");
// Get all the sepaMandateList where bic is null
defaultSepaMandateShouldNotBeFound("bic.specified=false");
}
@Test
@Transactional
public void getAllSepaMandatesByDocumentDateIsEqualToSomething() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where documentDate equals to DEFAULT_DOCUMENT_DATE
defaultSepaMandateShouldBeFound("documentDate.equals=" + DEFAULT_DOCUMENT_DATE);
// Get all the sepaMandateList where documentDate equals to UPDATED_DOCUMENT_DATE
defaultSepaMandateShouldNotBeFound("documentDate.equals=" + UPDATED_DOCUMENT_DATE);
}
@Test
@Transactional
public void getAllSepaMandatesByDocumentDateIsInShouldWork() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where documentDate in DEFAULT_DOCUMENT_DATE or UPDATED_DOCUMENT_DATE
defaultSepaMandateShouldBeFound("documentDate.in=" + DEFAULT_DOCUMENT_DATE + "," + UPDATED_DOCUMENT_DATE);
// Get all the sepaMandateList where documentDate equals to UPDATED_DOCUMENT_DATE
defaultSepaMandateShouldNotBeFound("documentDate.in=" + UPDATED_DOCUMENT_DATE);
}
@Test
@Transactional
public void getAllSepaMandatesByDocumentDateIsNullOrNotNull() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where documentDate is not null
defaultSepaMandateShouldBeFound("documentDate.specified=true");
// Get all the sepaMandateList where documentDate is null
defaultSepaMandateShouldNotBeFound("documentDate.specified=false");
}
@Test
@Transactional
public void getAllSepaMandatesByDocumentDateIsGreaterThanOrEqualToSomething() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where documentDate greater than or equals to DEFAULT_DOCUMENT_DATE
defaultSepaMandateShouldBeFound("documentDate.greaterOrEqualThan=" + DEFAULT_DOCUMENT_DATE);
// Get all the sepaMandateList where documentDate greater than or equals to UPDATED_DOCUMENT_DATE
defaultSepaMandateShouldNotBeFound("documentDate.greaterOrEqualThan=" + UPDATED_DOCUMENT_DATE);
}
@Test
@Transactional
public void getAllSepaMandatesByDocumentDateIsLessThanSomething() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where documentDate less than or equals to DEFAULT_DOCUMENT_DATE
defaultSepaMandateShouldNotBeFound("documentDate.lessThan=" + DEFAULT_DOCUMENT_DATE);
// Get all the sepaMandateList where documentDate less than or equals to UPDATED_DOCUMENT_DATE
defaultSepaMandateShouldBeFound("documentDate.lessThan=" + UPDATED_DOCUMENT_DATE);
}
@Test
@Transactional
public void getAllSepaMandatesByValidFromIsEqualToSomething() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where validFrom equals to DEFAULT_VALID_FROM
defaultSepaMandateShouldBeFound("validFrom.equals=" + DEFAULT_VALID_FROM);
// Get all the sepaMandateList where validFrom equals to UPDATED_VALID_FROM
defaultSepaMandateShouldNotBeFound("validFrom.equals=" + UPDATED_VALID_FROM);
}
@Test
@Transactional
public void getAllSepaMandatesByValidFromIsInShouldWork() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where validFrom in DEFAULT_VALID_FROM or UPDATED_VALID_FROM
defaultSepaMandateShouldBeFound("validFrom.in=" + DEFAULT_VALID_FROM + "," + UPDATED_VALID_FROM);
// Get all the sepaMandateList where validFrom equals to UPDATED_VALID_FROM
defaultSepaMandateShouldNotBeFound("validFrom.in=" + UPDATED_VALID_FROM);
}
@Test
@Transactional
public void getAllSepaMandatesByValidFromIsNullOrNotNull() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where validFrom is not null
defaultSepaMandateShouldBeFound("validFrom.specified=true");
// Get all the sepaMandateList where validFrom is null
defaultSepaMandateShouldNotBeFound("validFrom.specified=false");
}
@Test
@Transactional
public void getAllSepaMandatesByValidFromIsGreaterThanOrEqualToSomething() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where validFrom greater than or equals to DEFAULT_VALID_FROM
defaultSepaMandateShouldBeFound("validFrom.greaterOrEqualThan=" + DEFAULT_VALID_FROM);
// Get all the sepaMandateList where validFrom greater than or equals to UPDATED_VALID_FROM
defaultSepaMandateShouldNotBeFound("validFrom.greaterOrEqualThan=" + UPDATED_VALID_FROM);
}
@Test
@Transactional
public void getAllSepaMandatesByValidFromIsLessThanSomething() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where validFrom less than or equals to DEFAULT_VALID_FROM
defaultSepaMandateShouldNotBeFound("validFrom.lessThan=" + DEFAULT_VALID_FROM);
// Get all the sepaMandateList where validFrom less than or equals to UPDATED_VALID_FROM
defaultSepaMandateShouldBeFound("validFrom.lessThan=" + UPDATED_VALID_FROM);
}
@Test
@Transactional
public void getAllSepaMandatesByValidUntilIsEqualToSomething() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where validUntil equals to DEFAULT_VALID_UNTIL
defaultSepaMandateShouldBeFound("validUntil.equals=" + DEFAULT_VALID_UNTIL);
// Get all the sepaMandateList where validUntil equals to UPDATED_VALID_UNTIL
defaultSepaMandateShouldNotBeFound("validUntil.equals=" + UPDATED_VALID_UNTIL);
}
@Test
@Transactional
public void getAllSepaMandatesByValidUntilIsInShouldWork() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where validUntil in DEFAULT_VALID_UNTIL or UPDATED_VALID_UNTIL
defaultSepaMandateShouldBeFound("validUntil.in=" + DEFAULT_VALID_UNTIL + "," + UPDATED_VALID_UNTIL);
// Get all the sepaMandateList where validUntil equals to UPDATED_VALID_UNTIL
defaultSepaMandateShouldNotBeFound("validUntil.in=" + UPDATED_VALID_UNTIL);
}
@Test
@Transactional
public void getAllSepaMandatesByValidUntilIsNullOrNotNull() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where validUntil is not null
defaultSepaMandateShouldBeFound("validUntil.specified=true");
// Get all the sepaMandateList where validUntil is null
defaultSepaMandateShouldNotBeFound("validUntil.specified=false");
}
@Test
@Transactional
public void getAllSepaMandatesByValidUntilIsGreaterThanOrEqualToSomething() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where validUntil greater than or equals to DEFAULT_VALID_UNTIL
defaultSepaMandateShouldBeFound("validUntil.greaterOrEqualThan=" + DEFAULT_VALID_UNTIL);
// Get all the sepaMandateList where validUntil greater than or equals to UPDATED_VALID_UNTIL
defaultSepaMandateShouldNotBeFound("validUntil.greaterOrEqualThan=" + UPDATED_VALID_UNTIL);
}
@Test
@Transactional
public void getAllSepaMandatesByValidUntilIsLessThanSomething() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where validUntil less than or equals to DEFAULT_VALID_UNTIL
defaultSepaMandateShouldNotBeFound("validUntil.lessThan=" + DEFAULT_VALID_UNTIL);
// Get all the sepaMandateList where validUntil less than or equals to UPDATED_VALID_UNTIL
defaultSepaMandateShouldBeFound("validUntil.lessThan=" + UPDATED_VALID_UNTIL);
}
@Test
@Transactional
public void getAllSepaMandatesByLastUsedIsEqualToSomething() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where lastUsed equals to DEFAULT_LAST_USED
defaultSepaMandateShouldBeFound("lastUsed.equals=" + DEFAULT_LAST_USED);
// Get all the sepaMandateList where lastUsed equals to UPDATED_LAST_USED
defaultSepaMandateShouldNotBeFound("lastUsed.equals=" + UPDATED_LAST_USED);
}
@Test
@Transactional
public void getAllSepaMandatesByLastUsedIsInShouldWork() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where lastUsed in DEFAULT_LAST_USED or UPDATED_LAST_USED
defaultSepaMandateShouldBeFound("lastUsed.in=" + DEFAULT_LAST_USED + "," + UPDATED_LAST_USED);
// Get all the sepaMandateList where lastUsed equals to UPDATED_LAST_USED
defaultSepaMandateShouldNotBeFound("lastUsed.in=" + UPDATED_LAST_USED);
}
@Test
@Transactional
public void getAllSepaMandatesByLastUsedIsNullOrNotNull() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where lastUsed is not null
defaultSepaMandateShouldBeFound("lastUsed.specified=true");
// Get all the sepaMandateList where lastUsed is null
defaultSepaMandateShouldNotBeFound("lastUsed.specified=false");
}
@Test
@Transactional
public void getAllSepaMandatesByLastUsedIsGreaterThanOrEqualToSomething() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where lastUsed greater than or equals to DEFAULT_LAST_USED
defaultSepaMandateShouldBeFound("lastUsed.greaterOrEqualThan=" + DEFAULT_LAST_USED);
// Get all the sepaMandateList where lastUsed greater than or equals to UPDATED_LAST_USED
defaultSepaMandateShouldNotBeFound("lastUsed.greaterOrEqualThan=" + UPDATED_LAST_USED);
}
@Test
@Transactional
public void getAllSepaMandatesByLastUsedIsLessThanSomething() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where lastUsed less than or equals to DEFAULT_LAST_USED
defaultSepaMandateShouldNotBeFound("lastUsed.lessThan=" + DEFAULT_LAST_USED);
// Get all the sepaMandateList where lastUsed less than or equals to UPDATED_LAST_USED
defaultSepaMandateShouldBeFound("lastUsed.lessThan=" + UPDATED_LAST_USED);
}
@Test
@Transactional
public void getAllSepaMandatesByCancellationDateIsEqualToSomething() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where cancellationDate equals to DEFAULT_CANCELLATION_DATE
defaultSepaMandateShouldBeFound("cancellationDate.equals=" + DEFAULT_CANCELLATION_DATE);
// Get all the sepaMandateList where cancellationDate equals to UPDATED_CANCELLATION_DATE
defaultSepaMandateShouldNotBeFound("cancellationDate.equals=" + UPDATED_CANCELLATION_DATE);
}
@Test
@Transactional
public void getAllSepaMandatesByCancellationDateIsInShouldWork() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where cancellationDate in DEFAULT_CANCELLATION_DATE or UPDATED_CANCELLATION_DATE
defaultSepaMandateShouldBeFound("cancellationDate.in=" + DEFAULT_CANCELLATION_DATE + "," + UPDATED_CANCELLATION_DATE);
// Get all the sepaMandateList where cancellationDate equals to UPDATED_CANCELLATION_DATE
defaultSepaMandateShouldNotBeFound("cancellationDate.in=" + UPDATED_CANCELLATION_DATE);
}
@Test
@Transactional
public void getAllSepaMandatesByCancellationDateIsNullOrNotNull() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where cancellationDate is not null
defaultSepaMandateShouldBeFound("cancellationDate.specified=true");
// Get all the sepaMandateList where cancellationDate is null
defaultSepaMandateShouldNotBeFound("cancellationDate.specified=false");
}
@Test
@Transactional
public void getAllSepaMandatesByCancellationDateIsGreaterThanOrEqualToSomething() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where cancellationDate greater than or equals to DEFAULT_CANCELLATION_DATE
defaultSepaMandateShouldBeFound("cancellationDate.greaterOrEqualThan=" + DEFAULT_CANCELLATION_DATE);
// Get all the sepaMandateList where cancellationDate greater than or equals to UPDATED_CANCELLATION_DATE
defaultSepaMandateShouldNotBeFound("cancellationDate.greaterOrEqualThan=" + UPDATED_CANCELLATION_DATE);
}
@Test
@Transactional
public void getAllSepaMandatesByCancellationDateIsLessThanSomething() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where cancellationDate less than or equals to DEFAULT_CANCELLATION_DATE
defaultSepaMandateShouldNotBeFound("cancellationDate.lessThan=" + DEFAULT_CANCELLATION_DATE);
// Get all the sepaMandateList where cancellationDate less than or equals to UPDATED_CANCELLATION_DATE
defaultSepaMandateShouldBeFound("cancellationDate.lessThan=" + UPDATED_CANCELLATION_DATE);
}
@Test
@Transactional
public void getAllSepaMandatesByRemarkIsEqualToSomething() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where remark equals to DEFAULT_REMARK
defaultSepaMandateShouldBeFound("remark.equals=" + DEFAULT_REMARK);
// Get all the sepaMandateList where remark equals to UPDATED_REMARK
defaultSepaMandateShouldNotBeFound("remark.equals=" + UPDATED_REMARK);
}
@Test
@Transactional
public void getAllSepaMandatesByRemarkIsInShouldWork() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where remark in DEFAULT_REMARK or UPDATED_REMARK
defaultSepaMandateShouldBeFound("remark.in=" + DEFAULT_REMARK + "," + UPDATED_REMARK);
// Get all the sepaMandateList where remark equals to UPDATED_REMARK
defaultSepaMandateShouldNotBeFound("remark.in=" + UPDATED_REMARK);
}
@Test
@Transactional
public void getAllSepaMandatesByRemarkIsNullOrNotNull() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
// Get all the sepaMandateList where remark is not null
defaultSepaMandateShouldBeFound("remark.specified=true");
// Get all the sepaMandateList where remark is null
defaultSepaMandateShouldNotBeFound("remark.specified=false");
}
@Test
@Transactional
public void getAllSepaMandatesByCustomerIsEqualToSomething() throws Exception {
// Initialize the database
Customer customer = CustomerResourceIntTest.createEntity(em);
em.persist(customer);
em.flush();
sepaMandate.setCustomer(customer);
sepaMandateRepository.saveAndFlush(sepaMandate);
Long customerId = customer.getId();
// Get all the sepaMandateList where customer equals to customerId
defaultSepaMandateShouldBeFound("customerId.equals=" + customerId);
// Get all the sepaMandateList where customer equals to customerId + 1
defaultSepaMandateShouldNotBeFound("customerId.equals=" + (customerId + 1));
}
/**
* Executes the search, and checks that the default entity is returned
*/
private void defaultSepaMandateShouldBeFound(String filter) throws Exception {
restSepaMandateMockMvc.perform(get("/api/sepa-mandates?sort=id,desc&" + filter))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].id").value(hasItem(sepaMandate.getId().intValue())))
.andExpect(jsonPath("$.[*].reference").value(hasItem(DEFAULT_REFERENCE)))
.andExpect(jsonPath("$.[*].iban").value(hasItem(DEFAULT_IBAN)))
.andExpect(jsonPath("$.[*].bic").value(hasItem(DEFAULT_BIC)))
.andExpect(jsonPath("$.[*].documentDate").value(hasItem(DEFAULT_DOCUMENT_DATE.toString())))
.andExpect(jsonPath("$.[*].validFrom").value(hasItem(DEFAULT_VALID_FROM.toString())))
.andExpect(jsonPath("$.[*].validUntil").value(hasItem(DEFAULT_VALID_UNTIL.toString())))
.andExpect(jsonPath("$.[*].lastUsed").value(hasItem(DEFAULT_LAST_USED.toString())))
.andExpect(jsonPath("$.[*].cancellationDate").value(hasItem(DEFAULT_CANCELLATION_DATE.toString())))
.andExpect(jsonPath("$.[*].remark").value(hasItem(DEFAULT_REMARK)));
// Check, that the count call also returns 1
restSepaMandateMockMvc.perform(get("/api/sepa-mandates/count?sort=id,desc&" + filter))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(content().string("1"));
}
/**
* Executes the search, and checks that the default entity is not returned
*/
private void defaultSepaMandateShouldNotBeFound(String filter) throws Exception {
restSepaMandateMockMvc.perform(get("/api/sepa-mandates?sort=id,desc&" + filter))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$").isArray())
.andExpect(jsonPath("$").isEmpty());
// Check, that the count call also returns 0
restSepaMandateMockMvc.perform(get("/api/sepa-mandates/count?sort=id,desc&" + filter))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(content().string("0"));
}
@Test
@Transactional
public void getNonExistingSepaMandate() throws Exception {
// Get the sepaMandate
restSepaMandateMockMvc.perform(get("/api/sepa-mandates/{id}", Long.MAX_VALUE))
.andExpect(status().isNotFound());
}
@Test
@Transactional
public void updateSepaMandate() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
int databaseSizeBeforeUpdate = sepaMandateRepository.findAll().size();
// Update the sepaMandate
SepaMandate updatedSepaMandate = sepaMandateRepository.findById(sepaMandate.getId()).get();
// Disconnect from session so that the updates on updatedSepaMandate are not directly saved in db
em.detach(updatedSepaMandate);
updatedSepaMandate
.reference(UPDATED_REFERENCE)
.iban(UPDATED_IBAN)
.bic(UPDATED_BIC)
.documentDate(UPDATED_DOCUMENT_DATE)
.validFrom(UPDATED_VALID_FROM)
.validUntil(UPDATED_VALID_UNTIL)
.lastUsed(UPDATED_LAST_USED)
.cancellationDate(UPDATED_CANCELLATION_DATE)
.remark(UPDATED_REMARK);
SepaMandateDTO sepaMandateDTO = sepaMandateMapper.toDto(updatedSepaMandate);
restSepaMandateMockMvc.perform(put("/api/sepa-mandates")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(sepaMandateDTO)))
.andExpect(status().isOk());
// Validate the SepaMandate in the database
List<SepaMandate> sepaMandateList = sepaMandateRepository.findAll();
assertThat(sepaMandateList).hasSize(databaseSizeBeforeUpdate);
SepaMandate testSepaMandate = sepaMandateList.get(sepaMandateList.size() - 1);
assertThat(testSepaMandate.getReference()).isEqualTo(UPDATED_REFERENCE);
assertThat(testSepaMandate.getIban()).isEqualTo(UPDATED_IBAN);
assertThat(testSepaMandate.getBic()).isEqualTo(UPDATED_BIC);
assertThat(testSepaMandate.getDocumentDate()).isEqualTo(UPDATED_DOCUMENT_DATE);
assertThat(testSepaMandate.getValidFrom()).isEqualTo(UPDATED_VALID_FROM);
assertThat(testSepaMandate.getValidUntil()).isEqualTo(UPDATED_VALID_UNTIL);
assertThat(testSepaMandate.getLastUsed()).isEqualTo(UPDATED_LAST_USED);
assertThat(testSepaMandate.getCancellationDate()).isEqualTo(UPDATED_CANCELLATION_DATE);
assertThat(testSepaMandate.getRemark()).isEqualTo(UPDATED_REMARK);
}
@Test
@Transactional
public void updateNonExistingSepaMandate() throws Exception {
int databaseSizeBeforeUpdate = sepaMandateRepository.findAll().size();
// Create the SepaMandate
SepaMandateDTO sepaMandateDTO = sepaMandateMapper.toDto(sepaMandate);
// If the entity doesn't have an ID, it will throw BadRequestAlertException
restSepaMandateMockMvc.perform(put("/api/sepa-mandates")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(sepaMandateDTO)))
.andExpect(status().isBadRequest());
// Validate the SepaMandate in the database
List<SepaMandate> sepaMandateList = sepaMandateRepository.findAll();
assertThat(sepaMandateList).hasSize(databaseSizeBeforeUpdate);
}
@Test
@Transactional
public void deleteSepaMandate() throws Exception {
// Initialize the database
sepaMandateRepository.saveAndFlush(sepaMandate);
int databaseSizeBeforeDelete = sepaMandateRepository.findAll().size();
// Delete the sepaMandate
restSepaMandateMockMvc.perform(delete("/api/sepa-mandates/{id}", sepaMandate.getId())
.accept(TestUtil.APPLICATION_JSON_UTF8))
.andExpect(status().isOk());
// Validate the database is empty
List<SepaMandate> sepaMandateList = sepaMandateRepository.findAll();
assertThat(sepaMandateList).hasSize(databaseSizeBeforeDelete - 1);
}
@Test
@Transactional
public void equalsVerifier() throws Exception {
TestUtil.equalsVerifier(SepaMandate.class);
SepaMandate sepaMandate1 = new SepaMandate();
sepaMandate1.setId(1L);
SepaMandate sepaMandate2 = new SepaMandate();
sepaMandate2.setId(sepaMandate1.getId());
assertThat(sepaMandate1).isEqualTo(sepaMandate2);
sepaMandate2.setId(2L);
assertThat(sepaMandate1).isNotEqualTo(sepaMandate2);
sepaMandate1.setId(null);
assertThat(sepaMandate1).isNotEqualTo(sepaMandate2);
}
@Test
@Transactional
public void dtoEqualsVerifier() throws Exception {
TestUtil.equalsVerifier(SepaMandateDTO.class);
SepaMandateDTO sepaMandateDTO1 = new SepaMandateDTO();
sepaMandateDTO1.setId(1L);
SepaMandateDTO sepaMandateDTO2 = new SepaMandateDTO();
assertThat(sepaMandateDTO1).isNotEqualTo(sepaMandateDTO2);
sepaMandateDTO2.setId(sepaMandateDTO1.getId());
assertThat(sepaMandateDTO1).isEqualTo(sepaMandateDTO2);
sepaMandateDTO2.setId(2L);
assertThat(sepaMandateDTO1).isNotEqualTo(sepaMandateDTO2);
sepaMandateDTO1.setId(null);
assertThat(sepaMandateDTO1).isNotEqualTo(sepaMandateDTO2);
}
@Test
@Transactional
public void testEntityFromId() {
assertThat(sepaMandateMapper.fromId(42L).getId()).isEqualTo(42);
assertThat(sepaMandateMapper.fromId(null)).isNull();
}
}

View File

@ -1,15 +1,17 @@
package org.hostsharing.hsadminng.web.rest;
import org.hostsharing.hsadminng.HsadminNgApp;
import org.hostsharing.hsadminng.domain.Membership;
import org.hostsharing.hsadminng.domain.Share;
import org.hostsharing.hsadminng.domain.enumeration.ShareAction;
import org.hostsharing.hsadminng.domain.Membership;
import org.hostsharing.hsadminng.repository.ShareRepository;
import org.hostsharing.hsadminng.service.ShareQueryService;
import org.hostsharing.hsadminng.service.ShareService;
import org.hostsharing.hsadminng.service.dto.ShareDTO;
import org.hostsharing.hsadminng.service.mapper.ShareMapper;
import org.hostsharing.hsadminng.web.rest.errors.ExceptionTranslator;
import org.hostsharing.hsadminng.service.dto.ShareCriteria;
import org.hostsharing.hsadminng.service.ShareQueryService;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -30,11 +32,14 @@ import java.time.LocalDate;
import java.time.ZoneId;
import java.util.List;
import static org.hostsharing.hsadminng.web.rest.TestUtil.createFormattingConversionService;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.hasItem;
import static org.hostsharing.hsadminng.web.rest.TestUtil.createFormattingConversionService;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
import org.hostsharing.hsadminng.domain.enumeration.ShareAction;
/**
* Test class for the ShareResource REST controller.
*
@ -44,8 +49,11 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
@SpringBootTest(classes = HsadminNgApp.class)
public class ShareResourceIntTest {
private static final LocalDate DEFAULT_DATE = LocalDate.ofEpochDay(0L);
private static final LocalDate UPDATED_DATE = LocalDate.now(ZoneId.systemDefault());
private static final LocalDate DEFAULT_DOCUMENT_DATE = LocalDate.ofEpochDay(0L);
private static final LocalDate UPDATED_DOCUMENT_DATE = LocalDate.now(ZoneId.systemDefault());
private static final LocalDate DEFAULT_VALUE_DATE = LocalDate.ofEpochDay(0L);
private static final LocalDate UPDATED_VALUE_DATE = LocalDate.now(ZoneId.systemDefault());
private static final ShareAction DEFAULT_ACTION = ShareAction.SUBSCRIPTION;
private static final ShareAction UPDATED_ACTION = ShareAction.CANCELLATION;
@ -53,8 +61,8 @@ public class ShareResourceIntTest {
private static final Integer DEFAULT_QUANTITY = 1;
private static final Integer UPDATED_QUANTITY = 2;
private static final String DEFAULT_COMMENT = "AAAAAAAAAA";
private static final String UPDATED_COMMENT = "BBBBBBBBBB";
private static final String DEFAULT_REMARK = "AAAAAAAAAA";
private static final String UPDATED_REMARK = "BBBBBBBBBB";
@Autowired
private ShareRepository shareRepository;
@ -107,15 +115,16 @@ public class ShareResourceIntTest {
*/
public static Share createEntity(EntityManager em) {
Share share = new Share()
.date(DEFAULT_DATE)
.documentDate(DEFAULT_DOCUMENT_DATE)
.valueDate(DEFAULT_VALUE_DATE)
.action(DEFAULT_ACTION)
.quantity(DEFAULT_QUANTITY)
.comment(DEFAULT_COMMENT);
.remark(DEFAULT_REMARK);
// Add required entity
Membership membership = MembershipResourceIntTest.createEntity(em);
em.persist(membership);
em.flush();
share.setMember(membership);
share.setMembership(membership);
return share;
}
@ -140,10 +149,11 @@ public class ShareResourceIntTest {
List<Share> shareList = shareRepository.findAll();
assertThat(shareList).hasSize(databaseSizeBeforeCreate + 1);
Share testShare = shareList.get(shareList.size() - 1);
assertThat(testShare.getDate()).isEqualTo(DEFAULT_DATE);
assertThat(testShare.getDocumentDate()).isEqualTo(DEFAULT_DOCUMENT_DATE);
assertThat(testShare.getValueDate()).isEqualTo(DEFAULT_VALUE_DATE);
assertThat(testShare.getAction()).isEqualTo(DEFAULT_ACTION);
assertThat(testShare.getQuantity()).isEqualTo(DEFAULT_QUANTITY);
assertThat(testShare.getComment()).isEqualTo(DEFAULT_COMMENT);
assertThat(testShare.getRemark()).isEqualTo(DEFAULT_REMARK);
}
@Test
@ -168,10 +178,29 @@ public class ShareResourceIntTest {
@Test
@Transactional
public void checkDateIsRequired() throws Exception {
public void checkDocumentDateIsRequired() throws Exception {
int databaseSizeBeforeTest = shareRepository.findAll().size();
// set the field null
share.setDate(null);
share.setDocumentDate(null);
// Create the Share, which fails.
ShareDTO shareDTO = shareMapper.toDto(share);
restShareMockMvc.perform(post("/api/shares")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(shareDTO)))
.andExpect(status().isBadRequest());
List<Share> shareList = shareRepository.findAll();
assertThat(shareList).hasSize(databaseSizeBeforeTest);
}
@Test
@Transactional
public void checkValueDateIsRequired() throws Exception {
int databaseSizeBeforeTest = shareRepository.findAll().size();
// set the field null
share.setValueDate(null);
// Create the Share, which fails.
ShareDTO shareDTO = shareMapper.toDto(share);
@ -234,10 +263,11 @@ public class ShareResourceIntTest {
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].id").value(hasItem(share.getId().intValue())))
.andExpect(jsonPath("$.[*].date").value(hasItem(DEFAULT_DATE.toString())))
.andExpect(jsonPath("$.[*].documentDate").value(hasItem(DEFAULT_DOCUMENT_DATE.toString())))
.andExpect(jsonPath("$.[*].valueDate").value(hasItem(DEFAULT_VALUE_DATE.toString())))
.andExpect(jsonPath("$.[*].action").value(hasItem(DEFAULT_ACTION.toString())))
.andExpect(jsonPath("$.[*].quantity").value(hasItem(DEFAULT_QUANTITY)))
.andExpect(jsonPath("$.[*].comment").value(hasItem(DEFAULT_COMMENT.toString())));
.andExpect(jsonPath("$.[*].remark").value(hasItem(DEFAULT_REMARK.toString())));
}
@Test
@ -251,75 +281,142 @@ public class ShareResourceIntTest {
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.id").value(share.getId().intValue()))
.andExpect(jsonPath("$.date").value(DEFAULT_DATE.toString()))
.andExpect(jsonPath("$.documentDate").value(DEFAULT_DOCUMENT_DATE.toString()))
.andExpect(jsonPath("$.valueDate").value(DEFAULT_VALUE_DATE.toString()))
.andExpect(jsonPath("$.action").value(DEFAULT_ACTION.toString()))
.andExpect(jsonPath("$.quantity").value(DEFAULT_QUANTITY))
.andExpect(jsonPath("$.comment").value(DEFAULT_COMMENT.toString()));
.andExpect(jsonPath("$.remark").value(DEFAULT_REMARK.toString()));
}
@Test
@Transactional
public void getAllSharesByDateIsEqualToSomething() throws Exception {
public void getAllSharesByDocumentDateIsEqualToSomething() throws Exception {
// Initialize the database
shareRepository.saveAndFlush(share);
// Get all the shareList where date equals to DEFAULT_DATE
defaultShareShouldBeFound("date.equals=" + DEFAULT_DATE);
// Get all the shareList where documentDate equals to DEFAULT_DOCUMENT_DATE
defaultShareShouldBeFound("documentDate.equals=" + DEFAULT_DOCUMENT_DATE);
// Get all the shareList where date equals to UPDATED_DATE
defaultShareShouldNotBeFound("date.equals=" + UPDATED_DATE);
// Get all the shareList where documentDate equals to UPDATED_DOCUMENT_DATE
defaultShareShouldNotBeFound("documentDate.equals=" + UPDATED_DOCUMENT_DATE);
}
@Test
@Transactional
public void getAllSharesByDateIsInShouldWork() throws Exception {
public void getAllSharesByDocumentDateIsInShouldWork() throws Exception {
// Initialize the database
shareRepository.saveAndFlush(share);
// Get all the shareList where date in DEFAULT_DATE or UPDATED_DATE
defaultShareShouldBeFound("date.in=" + DEFAULT_DATE + "," + UPDATED_DATE);
// Get all the shareList where documentDate in DEFAULT_DOCUMENT_DATE or UPDATED_DOCUMENT_DATE
defaultShareShouldBeFound("documentDate.in=" + DEFAULT_DOCUMENT_DATE + "," + UPDATED_DOCUMENT_DATE);
// Get all the shareList where date equals to UPDATED_DATE
defaultShareShouldNotBeFound("date.in=" + UPDATED_DATE);
// Get all the shareList where documentDate equals to UPDATED_DOCUMENT_DATE
defaultShareShouldNotBeFound("documentDate.in=" + UPDATED_DOCUMENT_DATE);
}
@Test
@Transactional
public void getAllSharesByDateIsNullOrNotNull() throws Exception {
public void getAllSharesByDocumentDateIsNullOrNotNull() throws Exception {
// Initialize the database
shareRepository.saveAndFlush(share);
// Get all the shareList where date is not null
defaultShareShouldBeFound("date.specified=true");
// Get all the shareList where documentDate is not null
defaultShareShouldBeFound("documentDate.specified=true");
// Get all the shareList where date is null
defaultShareShouldNotBeFound("date.specified=false");
// Get all the shareList where documentDate is null
defaultShareShouldNotBeFound("documentDate.specified=false");
}
@Test
@Transactional
public void getAllSharesByDateIsGreaterThanOrEqualToSomething() throws Exception {
public void getAllSharesByDocumentDateIsGreaterThanOrEqualToSomething() throws Exception {
// Initialize the database
shareRepository.saveAndFlush(share);
// Get all the shareList where date greater than or equals to DEFAULT_DATE
defaultShareShouldBeFound("date.greaterOrEqualThan=" + DEFAULT_DATE);
// Get all the shareList where documentDate greater than or equals to DEFAULT_DOCUMENT_DATE
defaultShareShouldBeFound("documentDate.greaterOrEqualThan=" + DEFAULT_DOCUMENT_DATE);
// Get all the shareList where date greater than or equals to UPDATED_DATE
defaultShareShouldNotBeFound("date.greaterOrEqualThan=" + UPDATED_DATE);
// Get all the shareList where documentDate greater than or equals to UPDATED_DOCUMENT_DATE
defaultShareShouldNotBeFound("documentDate.greaterOrEqualThan=" + UPDATED_DOCUMENT_DATE);
}
@Test
@Transactional
public void getAllSharesByDateIsLessThanSomething() throws Exception {
public void getAllSharesByDocumentDateIsLessThanSomething() throws Exception {
// Initialize the database
shareRepository.saveAndFlush(share);
// Get all the shareList where date less than or equals to DEFAULT_DATE
defaultShareShouldNotBeFound("date.lessThan=" + DEFAULT_DATE);
// Get all the shareList where documentDate less than or equals to DEFAULT_DOCUMENT_DATE
defaultShareShouldNotBeFound("documentDate.lessThan=" + DEFAULT_DOCUMENT_DATE);
// Get all the shareList where date less than or equals to UPDATED_DATE
defaultShareShouldBeFound("date.lessThan=" + UPDATED_DATE);
// Get all the shareList where documentDate less than or equals to UPDATED_DOCUMENT_DATE
defaultShareShouldBeFound("documentDate.lessThan=" + UPDATED_DOCUMENT_DATE);
}
@Test
@Transactional
public void getAllSharesByValueDateIsEqualToSomething() throws Exception {
// Initialize the database
shareRepository.saveAndFlush(share);
// Get all the shareList where valueDate equals to DEFAULT_VALUE_DATE
defaultShareShouldBeFound("valueDate.equals=" + DEFAULT_VALUE_DATE);
// Get all the shareList where valueDate equals to UPDATED_VALUE_DATE
defaultShareShouldNotBeFound("valueDate.equals=" + UPDATED_VALUE_DATE);
}
@Test
@Transactional
public void getAllSharesByValueDateIsInShouldWork() throws Exception {
// Initialize the database
shareRepository.saveAndFlush(share);
// Get all the shareList where valueDate in DEFAULT_VALUE_DATE or UPDATED_VALUE_DATE
defaultShareShouldBeFound("valueDate.in=" + DEFAULT_VALUE_DATE + "," + UPDATED_VALUE_DATE);
// Get all the shareList where valueDate equals to UPDATED_VALUE_DATE
defaultShareShouldNotBeFound("valueDate.in=" + UPDATED_VALUE_DATE);
}
@Test
@Transactional
public void getAllSharesByValueDateIsNullOrNotNull() throws Exception {
// Initialize the database
shareRepository.saveAndFlush(share);
// Get all the shareList where valueDate is not null
defaultShareShouldBeFound("valueDate.specified=true");
// Get all the shareList where valueDate is null
defaultShareShouldNotBeFound("valueDate.specified=false");
}
@Test
@Transactional
public void getAllSharesByValueDateIsGreaterThanOrEqualToSomething() throws Exception {
// Initialize the database
shareRepository.saveAndFlush(share);
// Get all the shareList where valueDate greater than or equals to DEFAULT_VALUE_DATE
defaultShareShouldBeFound("valueDate.greaterOrEqualThan=" + DEFAULT_VALUE_DATE);
// Get all the shareList where valueDate greater than or equals to UPDATED_VALUE_DATE
defaultShareShouldNotBeFound("valueDate.greaterOrEqualThan=" + UPDATED_VALUE_DATE);
}
@Test
@Transactional
public void getAllSharesByValueDateIsLessThanSomething() throws Exception {
// Initialize the database
shareRepository.saveAndFlush(share);
// Get all the shareList where valueDate less than or equals to DEFAULT_VALUE_DATE
defaultShareShouldNotBeFound("valueDate.lessThan=" + DEFAULT_VALUE_DATE);
// Get all the shareList where valueDate less than or equals to UPDATED_VALUE_DATE
defaultShareShouldBeFound("valueDate.lessThan=" + UPDATED_VALUE_DATE);
}
@ -430,59 +527,59 @@ public class ShareResourceIntTest {
@Test
@Transactional
public void getAllSharesByCommentIsEqualToSomething() throws Exception {
public void getAllSharesByRemarkIsEqualToSomething() throws Exception {
// Initialize the database
shareRepository.saveAndFlush(share);
// Get all the shareList where comment equals to DEFAULT_COMMENT
defaultShareShouldBeFound("comment.equals=" + DEFAULT_COMMENT);
// Get all the shareList where remark equals to DEFAULT_REMARK
defaultShareShouldBeFound("remark.equals=" + DEFAULT_REMARK);
// Get all the shareList where comment equals to UPDATED_COMMENT
defaultShareShouldNotBeFound("comment.equals=" + UPDATED_COMMENT);
// Get all the shareList where remark equals to UPDATED_REMARK
defaultShareShouldNotBeFound("remark.equals=" + UPDATED_REMARK);
}
@Test
@Transactional
public void getAllSharesByCommentIsInShouldWork() throws Exception {
public void getAllSharesByRemarkIsInShouldWork() throws Exception {
// Initialize the database
shareRepository.saveAndFlush(share);
// Get all the shareList where comment in DEFAULT_COMMENT or UPDATED_COMMENT
defaultShareShouldBeFound("comment.in=" + DEFAULT_COMMENT + "," + UPDATED_COMMENT);
// Get all the shareList where remark in DEFAULT_REMARK or UPDATED_REMARK
defaultShareShouldBeFound("remark.in=" + DEFAULT_REMARK + "," + UPDATED_REMARK);
// Get all the shareList where comment equals to UPDATED_COMMENT
defaultShareShouldNotBeFound("comment.in=" + UPDATED_COMMENT);
// Get all the shareList where remark equals to UPDATED_REMARK
defaultShareShouldNotBeFound("remark.in=" + UPDATED_REMARK);
}
@Test
@Transactional
public void getAllSharesByCommentIsNullOrNotNull() throws Exception {
public void getAllSharesByRemarkIsNullOrNotNull() throws Exception {
// Initialize the database
shareRepository.saveAndFlush(share);
// Get all the shareList where comment is not null
defaultShareShouldBeFound("comment.specified=true");
// Get all the shareList where remark is not null
defaultShareShouldBeFound("remark.specified=true");
// Get all the shareList where comment is null
defaultShareShouldNotBeFound("comment.specified=false");
// Get all the shareList where remark is null
defaultShareShouldNotBeFound("remark.specified=false");
}
@Test
@Transactional
public void getAllSharesByMemberIsEqualToSomething() throws Exception {
public void getAllSharesByMembershipIsEqualToSomething() throws Exception {
// Initialize the database
Membership member = MembershipResourceIntTest.createEntity(em);
em.persist(member);
Membership membership = MembershipResourceIntTest.createEntity(em);
em.persist(membership);
em.flush();
share.setMember(member);
share.setMembership(membership);
shareRepository.saveAndFlush(share);
Long memberId = member.getId();
Long membershipId = membership.getId();
// Get all the shareList where member equals to memberId
defaultShareShouldBeFound("memberId.equals=" + memberId);
// Get all the shareList where membership equals to membershipId
defaultShareShouldBeFound("membershipId.equals=" + membershipId);
// Get all the shareList where member equals to memberId + 1
defaultShareShouldNotBeFound("memberId.equals=" + (memberId + 1));
// Get all the shareList where membership equals to membershipId + 1
defaultShareShouldNotBeFound("membershipId.equals=" + (membershipId + 1));
}
/**
@ -493,10 +590,11 @@ public class ShareResourceIntTest {
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].id").value(hasItem(share.getId().intValue())))
.andExpect(jsonPath("$.[*].date").value(hasItem(DEFAULT_DATE.toString())))
.andExpect(jsonPath("$.[*].documentDate").value(hasItem(DEFAULT_DOCUMENT_DATE.toString())))
.andExpect(jsonPath("$.[*].valueDate").value(hasItem(DEFAULT_VALUE_DATE.toString())))
.andExpect(jsonPath("$.[*].action").value(hasItem(DEFAULT_ACTION.toString())))
.andExpect(jsonPath("$.[*].quantity").value(hasItem(DEFAULT_QUANTITY)))
.andExpect(jsonPath("$.[*].comment").value(hasItem(DEFAULT_COMMENT)));
.andExpect(jsonPath("$.[*].remark").value(hasItem(DEFAULT_REMARK)));
// Check, that the count call also returns 1
restShareMockMvc.perform(get("/api/shares/count?sort=id,desc&" + filter))
@ -544,10 +642,11 @@ public class ShareResourceIntTest {
// Disconnect from session so that the updates on updatedShare are not directly saved in db
em.detach(updatedShare);
updatedShare
.date(UPDATED_DATE)
.documentDate(UPDATED_DOCUMENT_DATE)
.valueDate(UPDATED_VALUE_DATE)
.action(UPDATED_ACTION)
.quantity(UPDATED_QUANTITY)
.comment(UPDATED_COMMENT);
.remark(UPDATED_REMARK);
ShareDTO shareDTO = shareMapper.toDto(updatedShare);
restShareMockMvc.perform(put("/api/shares")
@ -559,10 +658,11 @@ public class ShareResourceIntTest {
List<Share> shareList = shareRepository.findAll();
assertThat(shareList).hasSize(databaseSizeBeforeUpdate);
Share testShare = shareList.get(shareList.size() - 1);
assertThat(testShare.getDate()).isEqualTo(UPDATED_DATE);
assertThat(testShare.getDocumentDate()).isEqualTo(UPDATED_DOCUMENT_DATE);
assertThat(testShare.getValueDate()).isEqualTo(UPDATED_VALUE_DATE);
assertThat(testShare.getAction()).isEqualTo(UPDATED_ACTION);
assertThat(testShare.getQuantity()).isEqualTo(UPDATED_QUANTITY);
assertThat(testShare.getComment()).isEqualTo(UPDATED_COMMENT);
assertThat(testShare.getRemark()).isEqualTo(UPDATED_REMARK);
}
@Test

View File

@ -1,7 +1,7 @@
/* tslint:disable max-line-length */
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
import { HttpResponse } from '@angular/common/http';
import { of } from 'rxjs';
import { Observable, of } from 'rxjs';
import { HsadminNgTestModule } from '../../../test.module';
import { AssetUpdateComponent } from 'app/entities/asset/asset-update.component';

View File

@ -25,14 +25,15 @@ describe('Service Tests', () => {
httpMock = injector.get(HttpTestingController);
currentDate = moment();
elemDefault = new Asset(0, currentDate, AssetAction.PAYMENT, 0, 'AAAAAAA');
elemDefault = new Asset(0, currentDate, currentDate, AssetAction.PAYMENT, 0, 'AAAAAAA');
});
describe('Service methods', async () => {
it('should find an element', async () => {
const returnedFromService = Object.assign(
{
date: currentDate.format(DATE_FORMAT)
documentDate: currentDate.format(DATE_FORMAT),
valueDate: currentDate.format(DATE_FORMAT)
},
elemDefault
);
@ -49,13 +50,15 @@ describe('Service Tests', () => {
const returnedFromService = Object.assign(
{
id: 0,
date: currentDate.format(DATE_FORMAT)
documentDate: currentDate.format(DATE_FORMAT),
valueDate: currentDate.format(DATE_FORMAT)
},
elemDefault
);
const expected = Object.assign(
{
date: currentDate
documentDate: currentDate,
valueDate: currentDate
},
returnedFromService
);
@ -70,17 +73,19 @@ describe('Service Tests', () => {
it('should update a Asset', async () => {
const returnedFromService = Object.assign(
{
date: currentDate.format(DATE_FORMAT),
documentDate: currentDate.format(DATE_FORMAT),
valueDate: currentDate.format(DATE_FORMAT),
action: 'BBBBBB',
amount: 1,
comment: 'BBBBBB'
remark: 'BBBBBB'
},
elemDefault
);
const expected = Object.assign(
{
date: currentDate
documentDate: currentDate,
valueDate: currentDate
},
returnedFromService
);
@ -95,16 +100,18 @@ describe('Service Tests', () => {
it('should return a list of Asset', async () => {
const returnedFromService = Object.assign(
{
date: currentDate.format(DATE_FORMAT),
documentDate: currentDate.format(DATE_FORMAT),
valueDate: currentDate.format(DATE_FORMAT),
action: 'BBBBBB',
amount: 1,
comment: 'BBBBBB'
remark: 'BBBBBB'
},
elemDefault
);
const expected = Object.assign(
{
date: currentDate
documentDate: currentDate,
valueDate: currentDate
},
returnedFromService
);

View File

@ -1,7 +1,7 @@
/* tslint:disable max-line-length */
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
import { HttpResponse } from '@angular/common/http';
import { of } from 'rxjs';
import { Observable, of } from 'rxjs';
import { HsadminNgTestModule } from '../../../test.module';
import { CustomerUpdateComponent } from 'app/entities/customer/customer-update.component';

View File

@ -1,9 +1,11 @@
/* tslint:disable max-line-length */
import { getTestBed, TestBed } from '@angular/core/testing';
import { TestBed, getTestBed } from '@angular/core/testing';
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
import { map, take } from 'rxjs/operators';
import { HttpClient, HttpResponse } from '@angular/common/http';
import { of } from 'rxjs';
import { take, map } from 'rxjs/operators';
import { CustomerService } from 'app/entities/customer/customer.service';
import { Customer, ICustomer } from 'app/shared/model/customer.model';
import { ICustomer, Customer } from 'app/shared/model/customer.model';
describe('Service Tests', () => {
describe('Customer Service', () => {
@ -19,7 +21,7 @@ describe('Service Tests', () => {
service = injector.get(CustomerService);
httpMock = injector.get(HttpTestingController);
elemDefault = new Customer(0, 0, 'AAAAAAA', 'AAAAAAA', 'AAAAAAA', 'AAAAAAA', 'AAAAAAA', 'AAAAAAA');
elemDefault = new Customer(0, 0, 'AAAAAAA', 'AAAAAAA', 'AAAAAAA', 'AAAAAAA', 'AAAAAAA', 'AAAAAAA', 'AAAAAAA');
});
describe('Service methods', async () => {
@ -53,13 +55,14 @@ describe('Service Tests', () => {
it('should update a Customer', async () => {
const returnedFromService = Object.assign(
{
number: 1,
reference: 1,
prefix: 'BBBBBB',
name: 'BBBBBB',
contractualAddress: 'BBBBBB',
contractualSalutation: 'BBBBBB',
contractualAddress: 'BBBBBB',
billingSalutation: 'BBBBBB',
billingAddress: 'BBBBBB',
billingSalutation: 'BBBBBB'
remark: 'BBBBBB'
},
elemDefault
);
@ -76,13 +79,14 @@ describe('Service Tests', () => {
it('should return a list of Customer', async () => {
const returnedFromService = Object.assign(
{
number: 1,
reference: 1,
prefix: 'BBBBBB',
name: 'BBBBBB',
contractualAddress: 'BBBBBB',
contractualSalutation: 'BBBBBB',
contractualAddress: 'BBBBBB',
billingSalutation: 'BBBBBB',
billingAddress: 'BBBBBB',
billingSalutation: 'BBBBBB'
remark: 'BBBBBB'
},
elemDefault
);

Some files were not shown because too many files have changed in this diff Show More