From d787544ebf428e481a003c7c160592956ad94390 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Thu, 4 Apr 2019 09:19:50 +0200 Subject: [PATCH] added name+address+salutation to customer --- .jhipster/Customer.json | 42 +++ .../hsadminng/domain/Customer.java | 92 ++++++ .../service/CustomerQueryService.java | 15 + .../service/dto/CustomerCriteria.java | 65 ++++ .../hsadminng/service/dto/CustomerDTO.java | 62 ++++ src/main/jdl/customer.jdl | 6 +- .../20190403083735_added_entity_Customer.xml | 20 ++ .../customer/customer-detail.component.html | 20 ++ .../customer/customer-update.component.html | 63 ++++ .../entities/customer/customer.component.html | 10 + src/main/webapp/app/entities/entity.module.ts | 8 + .../webapp/app/shared/model/customer.model.ts | 10 + src/main/webapp/i18n/de/customer.json | 5 + src/main/webapp/i18n/en/customer.json | 5 + .../web/rest/CustomerResourceIntTest.java | 293 +++++++++++++++++- .../customer/customer.service.spec.ts | 16 +- 16 files changed, 723 insertions(+), 9 deletions(-) diff --git a/.jhipster/Customer.json b/.jhipster/Customer.json index 9725cc51..b449ee9d 100644 --- a/.jhipster/Customer.json +++ b/.jhipster/Customer.json @@ -22,6 +22,48 @@ "pattern" ], "fieldValidateRulesPattern": "[a-z][a-z0-9]+" + }, + { + "fieldName": "name", + "fieldType": "String", + "fieldValidateRules": [ + "required", + "maxlength" + ], + "fieldValidateRulesMaxlength": 80 + }, + { + "fieldName": "contractualAddress", + "fieldType": "String", + "fieldValidateRules": [ + "required", + "maxlength" + ], + "fieldValidateRulesMaxlength": 400 + }, + { + "fieldName": "contractualSalutation", + "fieldType": "String", + "fieldValidateRules": [ + "maxlength" + ], + "fieldValidateRulesMaxlength": 80 + }, + { + "fieldName": "billingAddress", + "fieldType": "String", + "fieldValidateRules": [ + "maxlength" + ], + "fieldValidateRulesMaxlength": 400 + }, + { + "fieldName": "billingSalutation", + "fieldType": "String", + "fieldValidateRules": [ + "maxlength" + ], + "fieldValidateRulesMaxlength": 80 } ], "relationships": [ diff --git a/src/main/java/org/hostsharing/hsadminng/domain/Customer.java b/src/main/java/org/hostsharing/hsadminng/domain/Customer.java index 00e10ab4..1e6b248a 100644 --- a/src/main/java/org/hostsharing/hsadminng/domain/Customer.java +++ b/src/main/java/org/hostsharing/hsadminng/domain/Customer.java @@ -36,6 +36,28 @@ public class Customer implements Serializable { @Column(name = "prefix", nullable = false, unique = true) private String prefix; + @NotNull + @Size(max = 80) + @Column(name = "name", length = 80, nullable = false) + private String name; + + @NotNull + @Size(max = 400) + @Column(name = "contractual_address", length = 400, nullable = false) + private String contractualAddress; + + @Size(max = 80) + @Column(name = "contractual_salutation", length = 80) + private String contractualSalutation; + + @Size(max = 400) + @Column(name = "billing_address", length = 400) + private String billingAddress; + + @Size(max = 80) + @Column(name = "billing_salutation", length = 80) + private String billingSalutation; + @OneToMany(mappedBy = "customer") private Set memberships = new HashSet<>(); @OneToMany(mappedBy = "customer") @@ -75,6 +97,71 @@ public class Customer implements Serializable { this.prefix = prefix; } + public String getName() { + return name; + } + + public Customer name(String name) { + this.name = name; + return this; + } + + public void setName(String name) { + this.name = name; + } + + public String getContractualAddress() { + return contractualAddress; + } + + public Customer contractualAddress(String contractualAddress) { + this.contractualAddress = contractualAddress; + return this; + } + + public void setContractualAddress(String contractualAddress) { + this.contractualAddress = contractualAddress; + } + + public String getContractualSalutation() { + return contractualSalutation; + } + + public Customer contractualSalutation(String contractualSalutation) { + this.contractualSalutation = contractualSalutation; + return this; + } + + public void setContractualSalutation(String contractualSalutation) { + this.contractualSalutation = contractualSalutation; + } + + public String getBillingAddress() { + return billingAddress; + } + + public Customer billingAddress(String billingAddress) { + this.billingAddress = billingAddress; + return this; + } + + public void setBillingAddress(String billingAddress) { + this.billingAddress = billingAddress; + } + + public String getBillingSalutation() { + return billingSalutation; + } + + public Customer billingSalutation(String billingSalutation) { + this.billingSalutation = billingSalutation; + return this; + } + + public void setBillingSalutation(String billingSalutation) { + this.billingSalutation = billingSalutation; + } + public Set getMemberships() { return memberships; } @@ -152,6 +239,11 @@ public class Customer implements Serializable { "id=" + getId() + ", number=" + getNumber() + ", prefix='" + getPrefix() + "'" + + ", name='" + getName() + "'" + + ", contractualAddress='" + getContractualAddress() + "'" + + ", contractualSalutation='" + getContractualSalutation() + "'" + + ", billingAddress='" + getBillingAddress() + "'" + + ", billingSalutation='" + getBillingSalutation() + "'" + "}"; } } diff --git a/src/main/java/org/hostsharing/hsadminng/service/CustomerQueryService.java b/src/main/java/org/hostsharing/hsadminng/service/CustomerQueryService.java index a2a6b056..bc3397e2 100644 --- a/src/main/java/org/hostsharing/hsadminng/service/CustomerQueryService.java +++ b/src/main/java/org/hostsharing/hsadminng/service/CustomerQueryService.java @@ -95,6 +95,21 @@ public class CustomerQueryService extends QueryService { if (criteria.getPrefix() != null) { specification = specification.and(buildStringSpecification(criteria.getPrefix(), Customer_.prefix)); } + if (criteria.getName() != null) { + specification = specification.and(buildStringSpecification(criteria.getName(), Customer_.name)); + } + if (criteria.getContractualAddress() != null) { + specification = specification.and(buildStringSpecification(criteria.getContractualAddress(), Customer_.contractualAddress)); + } + if (criteria.getContractualSalutation() != null) { + specification = specification.and(buildStringSpecification(criteria.getContractualSalutation(), Customer_.contractualSalutation)); + } + if (criteria.getBillingAddress() != null) { + specification = specification.and(buildStringSpecification(criteria.getBillingAddress(), Customer_.billingAddress)); + } + if (criteria.getBillingSalutation() != null) { + specification = specification.and(buildStringSpecification(criteria.getBillingSalutation(), Customer_.billingSalutation)); + } if (criteria.getMembershipId() != null) { specification = specification.and(buildSpecification(criteria.getMembershipId(), root -> root.join(Customer_.memberships, JoinType.LEFT).get(Membership_.id))); diff --git a/src/main/java/org/hostsharing/hsadminng/service/dto/CustomerCriteria.java b/src/main/java/org/hostsharing/hsadminng/service/dto/CustomerCriteria.java index eedf5349..546fef00 100644 --- a/src/main/java/org/hostsharing/hsadminng/service/dto/CustomerCriteria.java +++ b/src/main/java/org/hostsharing/hsadminng/service/dto/CustomerCriteria.java @@ -28,6 +28,16 @@ public class CustomerCriteria implements Serializable { private StringFilter prefix; + private StringFilter name; + + private StringFilter contractualAddress; + + private StringFilter contractualSalutation; + + private StringFilter billingAddress; + + private StringFilter billingSalutation; + private LongFilter membershipId; private LongFilter roleId; @@ -56,6 +66,46 @@ public class CustomerCriteria implements Serializable { this.prefix = prefix; } + public StringFilter getName() { + return name; + } + + public void setName(StringFilter name) { + this.name = name; + } + + public StringFilter getContractualAddress() { + return contractualAddress; + } + + public void setContractualAddress(StringFilter contractualAddress) { + this.contractualAddress = contractualAddress; + } + + public StringFilter getContractualSalutation() { + return contractualSalutation; + } + + public void setContractualSalutation(StringFilter contractualSalutation) { + this.contractualSalutation = contractualSalutation; + } + + public StringFilter getBillingAddress() { + return billingAddress; + } + + public void setBillingAddress(StringFilter billingAddress) { + this.billingAddress = billingAddress; + } + + public StringFilter getBillingSalutation() { + return billingSalutation; + } + + public void setBillingSalutation(StringFilter billingSalutation) { + this.billingSalutation = billingSalutation; + } + public LongFilter getMembershipId() { return membershipId; } @@ -86,6 +136,11 @@ public class CustomerCriteria implements Serializable { Objects.equals(id, that.id) && Objects.equals(number, that.number) && Objects.equals(prefix, that.prefix) && + Objects.equals(name, that.name) && + Objects.equals(contractualAddress, that.contractualAddress) && + Objects.equals(contractualSalutation, that.contractualSalutation) && + Objects.equals(billingAddress, that.billingAddress) && + Objects.equals(billingSalutation, that.billingSalutation) && Objects.equals(membershipId, that.membershipId) && Objects.equals(roleId, that.roleId); } @@ -96,6 +151,11 @@ public class CustomerCriteria implements Serializable { id, number, prefix, + name, + contractualAddress, + contractualSalutation, + billingAddress, + billingSalutation, membershipId, roleId ); @@ -107,6 +167,11 @@ public class CustomerCriteria implements Serializable { (id != null ? "id=" + id + ", " : "") + (number != null ? "number=" + number + ", " : "") + (prefix != null ? "prefix=" + prefix + ", " : "") + + (name != null ? "name=" + name + ", " : "") + + (contractualAddress != null ? "contractualAddress=" + contractualAddress + ", " : "") + + (contractualSalutation != null ? "contractualSalutation=" + contractualSalutation + ", " : "") + + (billingAddress != null ? "billingAddress=" + billingAddress + ", " : "") + + (billingSalutation != null ? "billingSalutation=" + billingSalutation + ", " : "") + (membershipId != null ? "membershipId=" + membershipId + ", " : "") + (roleId != null ? "roleId=" + roleId + ", " : "") + "}"; diff --git a/src/main/java/org/hostsharing/hsadminng/service/dto/CustomerDTO.java b/src/main/java/org/hostsharing/hsadminng/service/dto/CustomerDTO.java index ec8d0e14..ff8bf3d8 100644 --- a/src/main/java/org/hostsharing/hsadminng/service/dto/CustomerDTO.java +++ b/src/main/java/org/hostsharing/hsadminng/service/dto/CustomerDTO.java @@ -19,6 +19,23 @@ public class CustomerDTO implements Serializable { @Pattern(regexp = "[a-z][a-z0-9]+") private String prefix; + @NotNull + @Size(max = 80) + private String name; + + @NotNull + @Size(max = 400) + private String contractualAddress; + + @Size(max = 80) + private String contractualSalutation; + + @Size(max = 400) + private String billingAddress; + + @Size(max = 80) + private String billingSalutation; + public Long getId() { return id; @@ -44,6 +61,46 @@ public class CustomerDTO implements Serializable { this.prefix = prefix; } + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getContractualAddress() { + return contractualAddress; + } + + public void setContractualAddress(String contractualAddress) { + this.contractualAddress = contractualAddress; + } + + public String getContractualSalutation() { + return contractualSalutation; + } + + public void setContractualSalutation(String contractualSalutation) { + this.contractualSalutation = contractualSalutation; + } + + public String getBillingAddress() { + return billingAddress; + } + + public void setBillingAddress(String billingAddress) { + this.billingAddress = billingAddress; + } + + public String getBillingSalutation() { + return billingSalutation; + } + + public void setBillingSalutation(String billingSalutation) { + this.billingSalutation = billingSalutation; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -71,6 +128,11 @@ public class CustomerDTO implements Serializable { "id=" + getId() + ", number=" + getNumber() + ", prefix='" + getPrefix() + "'" + + ", name='" + getName() + "'" + + ", contractualAddress='" + getContractualAddress() + "'" + + ", contractualSalutation='" + getContractualSalutation() + "'" + + ", billingAddress='" + getBillingAddress() + "'" + + ", billingSalutation='" + getBillingSalutation() + "'" + "}"; } } diff --git a/src/main/jdl/customer.jdl b/src/main/jdl/customer.jdl index 707076ea..93ec95d6 100644 --- a/src/main/jdl/customer.jdl +++ b/src/main/jdl/customer.jdl @@ -6,6 +6,11 @@ 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]+/), + name String required maxlength(80), + contractualAddress String required maxlength(400), + contractualSalutation String maxlength(80), + billingAddress String maxlength(400), + billingSalutation String maxlength(80) } entity Contact { @@ -14,7 +19,6 @@ entity Contact { email String required maxlength(80) } - enum CustomerContactRole { CONTRACTUAL, TECHNICAL, diff --git a/src/main/resources/config/liquibase/changelog/20190403083735_added_entity_Customer.xml b/src/main/resources/config/liquibase/changelog/20190403083735_added_entity_Customer.xml index 8b6f2eb3..75090097 100644 --- a/src/main/resources/config/liquibase/changelog/20190403083735_added_entity_Customer.xml +++ b/src/main/resources/config/liquibase/changelog/20190403083735_added_entity_Customer.xml @@ -29,6 +29,26 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/webapp/app/entities/customer/customer-detail.component.html b/src/main/webapp/app/entities/customer/customer-detail.component.html index 9586d033..fbf98ec0 100644 --- a/src/main/webapp/app/entities/customer/customer-detail.component.html +++ b/src/main/webapp/app/entities/customer/customer-detail.component.html @@ -13,6 +13,26 @@
{{customer.prefix}}
+
Name
+
+ {{customer.name}} +
+
Contractual Address
+
+ {{customer.contractualAddress}} +
+
Contractual Salutation
+
+ {{customer.contractualSalutation}} +
+
Billing Address
+
+ {{customer.billingAddress}} +
+
Billing Salutation
+
+ {{customer.billingSalutation}} +