Merge branch 'jhipster-generated'

This commit is contained in:
Michael Hierweck 2019-04-18 16:33:28 +02:00
commit 633ae1d7d1
25 changed files with 137 additions and 134 deletions

View File

@ -49,7 +49,7 @@
"otherEntityField": "documentDate"
}
],
"changelogDate": "20190403083740",
"changelogDate": "20190418143053",
"entityTableName": "asset",
"dto": "mapstruct",
"pagination": "infinite-scroll",

View File

@ -90,7 +90,7 @@
"relationshipName": "sepamandate"
}
],
"changelogDate": "20190403083735",
"changelogDate": "20190418143050",
"entityTableName": "customer",
"dto": "mapstruct",
"pagination": "infinite-scroll",

View File

@ -50,7 +50,7 @@
"otherEntityField": "prefix"
}
],
"changelogDate": "20190403083738",
"changelogDate": "20190418143051",
"entityTableName": "membership",
"dto": "mapstruct",
"pagination": "infinite-scroll",

View File

@ -72,7 +72,7 @@
"otherEntityField": "prefix"
}
],
"changelogDate": "20190418100951",
"changelogDate": "20190418143054",
"entityTableName": "sepa_mandate",
"dto": "mapstruct",
"pagination": "infinite-scroll",

View File

@ -49,7 +49,7 @@
"otherEntityField": "documentDate"
}
],
"changelogDate": "20190403083739",
"changelogDate": "20190418143052",
"entityTableName": "share",
"dto": "mapstruct",
"pagination": "infinite-scroll",

22
package-lock.json generated
View File

@ -6025,7 +6025,7 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true
"dev": true
},
"aproba": {
"version": "1.2.0",
@ -6046,7 +6046,7 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"dev": true
"dev": true
},
"brace-expansion": {
"version": "1.1.11",
@ -6066,17 +6066,17 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true
"dev": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true
},
"core-util-is": {
"version": "1.0.2",
@ -6193,7 +6193,7 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
"dev": true
"dev": true
},
"ini": {
"version": "1.3.5",
@ -6226,7 +6226,7 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
"dev": true
"dev": true
},
"minipass": {
"version": "2.3.5",
@ -6330,7 +6330,7 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true
"dev": true
},
"object-assign": {
"version": "4.1.1",
@ -6427,7 +6427,7 @@
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"dev": true
"dev": true
},
"safer-buffer": {
"version": "2.1.2",
@ -6525,12 +6525,12 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true
"dev": true
},
"yallist": {
"version": "3.0.3",
"bundled": true,
"dev": true
"dev": true
}
}
},

View File

@ -30,15 +30,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
@ -54,30 +62,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() {
@ -168,8 +202,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

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

View File

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

View File

@ -3,6 +3,7 @@ import java.time.LocalDate;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.Objects;
import java.util.function.Consumer;
/**
* A DTO for the Membership entity.

View File

@ -16,7 +16,7 @@
<!--
Added the entity Customer.
-->
<changeSet id="20190403083735-1" author="jhipster">
<changeSet id="20190418143050-1" author="jhipster">
<createTable tableName="customer">
<column name="id" type="bigint" autoIncrement="${autoIncrement}">
<constraints primaryKey="true" nullable="false"/>

View File

@ -16,7 +16,7 @@
<!--
Added the entity Membership.
-->
<changeSet id="20190403083738-1" author="jhipster">
<changeSet id="20190418143051-1" author="jhipster">
<createTable tableName="membership">
<column name="id" type="bigint" autoIncrement="${autoIncrement}">
<constraints primaryKey="true" nullable="false"/>

View File

@ -6,7 +6,7 @@
<!--
Added the constraints for entity Membership.
-->
<changeSet id="20190418073044-2" author="jhipster">
<changeSet id="20190418143051-2" author="jhipster">
<addForeignKeyConstraint baseColumnNames="customer_id"
baseTableName="membership"

View File

@ -16,7 +16,7 @@
<!--
Added the entity Share.
-->
<changeSet id="20190418073045-1" author="jhipster">
<changeSet id="20190418143052-1" author="jhipster">
<createTable tableName="share">
<column name="id" type="bigint" autoIncrement="${autoIncrement}">
<constraints primaryKey="true" nullable="false"/>

View File

@ -6,7 +6,7 @@
<!--
Added the constraints for entity Share.
-->
<changeSet id="20190418073045-2" author="jhipster">
<changeSet id="20190418143052-2" author="jhipster">
<addForeignKeyConstraint baseColumnNames="membership_id"
baseTableName="share"

View File

@ -16,7 +16,7 @@
<!--
Added the entity Asset.
-->
<changeSet id="20190418073046-1" author="jhipster">
<changeSet id="20190418143053-1" author="jhipster">
<createTable tableName="asset">
<column name="id" type="bigint" autoIncrement="${autoIncrement}">
<constraints primaryKey="true" nullable="false"/>

View File

@ -6,7 +6,7 @@
<!--
Added the constraints for entity Asset.
-->
<changeSet id="20190418073046-2" author="jhipster">
<changeSet id="20190418143053-2" author="jhipster">
<addForeignKeyConstraint baseColumnNames="membership_id"
baseTableName="asset"

View File

@ -16,7 +16,7 @@
<!--
Added the entity SepaMandate.
-->
<changeSet id="20190418100951-1" author="jhipster">
<changeSet id="20190418143054-1" author="jhipster">
<createTable tableName="sepa_mandate">
<column name="id" type="bigint" autoIncrement="${autoIncrement}">
<constraints primaryKey="true" nullable="false"/>

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="20190418143054-2" author="jhipster">
<addForeignKeyConstraint baseColumnNames="customer_id"
baseTableName="sepa_mandate"
constraintName="fk_sepa_mandate_customer_id"
referencedColumnNames="id"
referencedTableName="customer"/>
</changeSet>
</databaseChangeLog>

View File

@ -5,22 +5,15 @@
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
<include file="config/liquibase/changelog/00000000000000_initial_schema.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190403083735_added_entity_Customer.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190403083736_added_entity_Contact.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190403083737_added_entity_CustomerContact.xml" relativeToChangelogFile="false"/>
<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"/>
<include file="config/liquibase/changelog/20190418143050_added_entity_Customer.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190418143051_added_entity_Membership.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190418143052_added_entity_Share.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190418143053_added_entity_Asset.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190418143054_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"/>
<include file="config/liquibase/changelog/20190418143051_added_entity_constraints_Membership.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190418143052_added_entity_constraints_Share.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190418143053_added_entity_constraints_Asset.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190418143054_added_entity_constraints_SepaMandate.xml" relativeToChangelogFile="false"/>
<!-- jhipster-needle-liquibase-add-constraints-changelog - JHipster will add liquibase constraints changelogs here -->
<include file="config/liquibase/changelog/sample-data-Customer.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/sample-data-Membership.xml" relativeToChangelogFile="false"/>
</databaseChangeLog>

View File

@ -1,49 +1,9 @@
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { RouterModule } from '@angular/router';
@NgModule({
imports: [
RouterModule.forChild([
{
path: 'customer',
loadChildren: './customer/customer.module#HsadminNgCustomerModule'
},
{
path: 'contact',
loadChildren: './contact/contact.module#HsadminNgContactModule'
},
{
path: 'customer-contact',
loadChildren: './customer-contact/customer-contact.module#HsadminNgCustomerContactModule'
},
{
path: 'membership',
loadChildren: './membership/membership.module#HsadminNgMembershipModule'
},
{
path: 'share',
loadChildren: './share/share.module#HsadminNgShareModule'
},
{
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: 'customer',
loadChildren: './customer/customer.module#HsadminNgCustomerModule'

View File

@ -19,11 +19,11 @@ export class SepaMandateUpdateComponent implements OnInit {
isSaving: boolean;
customers: ICustomer[];
createdDp: any;
documentDateDp: any;
validFromDp: any;
validToDp: any;
validUntilDp: any;
lastUsedDp: any;
cancelledDp: any;
cancellationDateDp: any;
constructor(
protected jhiAlertService: JhiAlertService,

View File

@ -69,7 +69,7 @@ public class MembershipRepositoryIntTest {
private Customer createCustomer() {
final Customer customer = new Customer();
customer.setPrefix(RandomStringUtils.randomAlphabetic(3).toLowerCase());
customer.setNumber(RandomUtils.nextInt(10001, 19999));
customer.setReference(RandomUtils.nextInt(10001, 19999));
customer.setName(RandomStringUtils.randomAlphabetic(10));
customer.setContractualAddress(RandomStringUtils.randomAlphabetic(10));
customerRepository.save(customer);
@ -80,9 +80,9 @@ public class MembershipRepositoryIntTest {
final Customer customer = createCustomer();
final Membership membership = new Membership();
membership.setCustomer(customer);
membership.setTo(LocalDate.parse(from));
membership.setMemberUntil(LocalDate.parse(from));
if (to != null) {
membership.setFrom(LocalDate.parse(to));
membership.setMemberFrom(LocalDate.parse(to));
}
membershipRepository.save(membership);
return customer;

View File

@ -101,12 +101,12 @@ public class MembershipValidatorUnitTest {
GivenMembershipValidationTestCase since(final String sinceDate) {
membershipDto.setFrom(LocalDate.parse(sinceDate));
membershipDto.setMemberFrom(LocalDate.parse(sinceDate));
return this;
}
public GivenMembershipValidationTestCase until(final String untilDate) {
membershipDto.setTo(LocalDate.parse(untilDate));
membershipDto.setMemberUntil(LocalDate.parse(untilDate));
return this;
}

View File

@ -50,8 +50,8 @@ public class CustomerResourceIntTest {
private static final Integer DEFAULT_REFERENCE = 10000;
private static final Integer UPDATED_REFERENCE = 10001;
private static final String DEFAULT_PREFIX = "nf";
private static final String UPDATED_PREFIX = "m2";
private static final String DEFAULT_PREFIX = "hu";
private static final String UPDATED_PREFIX = "umj";
private static final String DEFAULT_NAME = "AAAAAAAAAA";
private static final String UPDATED_NAME = "BBBBBBBBBB";
@ -62,12 +62,6 @@ public class CustomerResourceIntTest {
private static final String DEFAULT_CONTRACTUAL_ADDRESS = "AAAAAAAAAA";
private static final String UPDATED_CONTRACTUAL_ADDRESS = "BBBBBBBBBB";
private static final String DEFAULT_BILLING_SALUTATION = "AAAAAAAAAA";
private static final String UPDATED_BILLING_SALUTATION = "BBBBBBBBBB";
private static final String DEFAULT_CONTRACTUAL_SALUTATION = "AAAAAAAAAA";
private static final String UPDATED_CONTRACTUAL_SALUTATION = "BBBBBBBBBB";
@Autowired
private static final String DEFAULT_BILLING_SALUTATION = "AAAAAAAAAA";
private static final String UPDATED_BILLING_SALUTATION = "BBBBBBBBBB";
@ -77,6 +71,7 @@ public class CustomerResourceIntTest {
private static final String DEFAULT_REMARK = "AAAAAAAAAA";
private static final String UPDATED_REMARK = "BBBBBBBBBB";
@Autowired
private CustomerRepository customerRepository;
@Autowired
@ -570,41 +565,41 @@ public class CustomerResourceIntTest {
@Test
@Transactional
public void getAllCustomersByContractualAddressIsEqualToSomething() throws Exception {
public void getAllCustomersByBillingAddressIsEqualToSomething() 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 billingAddress equals to DEFAULT_BILLING_ADDRESS
defaultCustomerShouldBeFound("billingAddress.equals=" + DEFAULT_BILLING_ADDRESS);
// Get all the customerList where contractualAddress equals to UPDATED_CONTRACTUAL_ADDRESS
defaultCustomerShouldNotBeFound("contractualAddress.equals=" + UPDATED_CONTRACTUAL_ADDRESS);
// Get all the customerList where billingAddress equals to UPDATED_BILLING_ADDRESS
defaultCustomerShouldNotBeFound("billingAddress.equals=" + UPDATED_BILLING_ADDRESS);
}
@Test
@Transactional
public void getAllCustomersByContractualAddressIsInShouldWork() throws Exception {
public void getAllCustomersByBillingAddressIsInShouldWork() 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 billingAddress in DEFAULT_BILLING_ADDRESS or UPDATED_BILLING_ADDRESS
defaultCustomerShouldBeFound("billingAddress.in=" + DEFAULT_BILLING_ADDRESS + "," + UPDATED_BILLING_ADDRESS);
// Get all the customerList where contractualAddress equals to UPDATED_CONTRACTUAL_ADDRESS
defaultCustomerShouldNotBeFound("contractualAddress.in=" + UPDATED_CONTRACTUAL_ADDRESS);
// Get all the customerList where billingAddress equals to UPDATED_BILLING_ADDRESS
defaultCustomerShouldNotBeFound("billingAddress.in=" + UPDATED_BILLING_ADDRESS);
}
@Test
@Transactional
public void getAllCustomersByContractualAddressIsNullOrNotNull() throws Exception {
public void getAllCustomersByBillingAddressIsNullOrNotNull() 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 billingAddress is not null
defaultCustomerShouldBeFound("billingAddress.specified=true");
// Get all the customerList where contractualAddress is null
defaultCustomerShouldNotBeFound("contractualAddress.specified=false");
// Get all the customerList where billingAddress is null
defaultCustomerShouldNotBeFound("billingAddress.specified=false");
}
@Test